merge commit
This commit is contained in:
commit
9beefd6ebe
149 changed files with 4930 additions and 8239 deletions
|
@ -16,9 +16,6 @@ fl filter\source\xsltdialog nmake - all fl_xsltdialog fl_flash fl_inc NULL
|
|||
fl filter\source\docbook nmake - all fl_docbook fl_inc NULL
|
||||
fl filter\source\t602 nmake - all fl_t602 fl_inc NULL
|
||||
fl filter\source\config\cache nmake - all fl_config fl_inc NULL
|
||||
fl filter\source\config\tools\utils nmake - all fl_fcfg_utils fl_inc NULL
|
||||
fl filter\source\config\tools\merge nmake - all fl_fcfg_merge fl_fcfg_utils fl_xsltvalidate fl_inc NULL
|
||||
fl filter\source\config\fragments\types nmake - all fl_fcfg_fragments_types fl_inc NULL
|
||||
fl filter\source\config\fragments\filters nmake - all fl_fcfg_fragments_filters fl_inc NULL
|
||||
fl filter\source\config\fragments nmake - all fl_fcfg_fragments fl_fcfg_merge fl_fcfg_fragments_filters fl_inc NULL
|
||||
|
||||
fl filter\source\config\fragments nmake - all fl_fcfg_fragments fl_fcfg_fragments_filters fl_inc NULL
|
||||
|
|
|
@ -187,7 +187,7 @@ $(ALL_FLAGS) : $(INCLUDE_FRAGMENTS)
|
|||
#cmc, hack to workaround the java build requirement
|
||||
MERGE:=python ../tools/merge/pyAltFCFGMerge
|
||||
.ELSE
|
||||
MERGE := $(JAVAI) -jar $(CLASSDIR)$/FCFGMerge.jar
|
||||
MERGE := $(JAVAI) -jar $(SOLARBINDIR)$/FCFGMerge.jar
|
||||
.ENDIF
|
||||
|
||||
PACKLANG := $(XSLTPROC) --nonet
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<node oor:name="writer_AportisDoc_PalmDB_File" oor:op="replace" >
|
||||
<prop oor:name="DetectService"/>
|
||||
<prop oor:name="DetectService"><value>com.sun.star.comp.filters.XMLFilterDetect</value></prop>
|
||||
<prop oor:name="URLPattern"/>
|
||||
<prop oor:name="Extensions"><value>pdb</value></prop>
|
||||
<prop oor:name="MediaType"/>
|
||||
<prop oor:name="MediaType"><value>application/x-aportisdoc</value></prop>
|
||||
<prop oor:name="Preferred"><value>false</value></prop>
|
||||
<prop oor:name="PreferredFilter"><value>AportisDoc Palm DB</value></prop>
|
||||
<prop oor:name="UIName">
|
||||
<value>AportisDoc (Palm)</value>
|
||||
</prop>
|
||||
<prop oor:name="ClipboardFormat"/>
|
||||
<prop oor:name="ClipboardFormat"><value>doctype:TEXt</value></prop>
|
||||
</node>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<node oor:name="writer_MS_Word_2007" oor:op="replace" >
|
||||
<prop oor:name="DetectService"><value>com.sun.star.comp.Writer.WriterFilterDetector</value></prop>
|
||||
<prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
|
||||
<prop oor:name="URLPattern"/>
|
||||
<prop oor:name="Extensions"><value>docx docm</value></prop>
|
||||
<prop oor:name="MediaType"><value>application/msword</value></prop>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<node oor:name="writer_MS_Word_2007_Template" oor:op="replace" >
|
||||
<prop oor:name="DetectService"><value>com.sun.star.comp.Writer.WriterFilterDetector</value></prop>
|
||||
<prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
|
||||
<prop oor:name="URLPattern"/>
|
||||
<prop oor:name="Extensions"><value>dotx dotm</value></prop>
|
||||
<prop oor:name="MediaType"><value>application/msword</value></prop>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<node oor:name="writer_PocketWord_File" oor:op="replace" >
|
||||
<prop oor:name="DetectService"/>
|
||||
<prop oor:name="DetectService"><value>com.sun.star.comp.filters.XMLFilterDetect</value></prop>
|
||||
<prop oor:name="URLPattern"/>
|
||||
<prop oor:name="Extensions"><value>psw</value></prop>
|
||||
<prop oor:name="MediaType"/>
|
||||
<prop oor:name="MediaType"><value>application/x-pocket-word</value></prop>
|
||||
<prop oor:name="Preferred"><value>false</value></prop>
|
||||
<prop oor:name="PreferredFilter"><value>PocketWord File</value></prop>
|
||||
<prop oor:name="UIName">
|
||||
<value>Pocket Word</value>
|
||||
</prop>
|
||||
<prop oor:name="ClipboardFormat"/>
|
||||
<prop oor:name="ClipboardFormat"><value>doctype:pwi</value></prop>
|
||||
</node>
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
#*************************************************************************
|
||||
#
|
||||
# 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: FCFGMerge.cfg,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.
|
||||
#
|
||||
#*************************************************************************
|
||||
|
||||
#************************************************
|
||||
# Specify the verbose mode of this tool.
|
||||
# 1 = show errors only
|
||||
# 2 = show errors/warnings (default)
|
||||
# 3 = show errors/warnings and some generic infos
|
||||
# 4 = show anything (including detailed infos)
|
||||
#
|
||||
# [OPTIONAL]
|
||||
#************************************************
|
||||
|
||||
loglevel = 2
|
||||
|
||||
#************************************************
|
||||
# This extension is used for all XML files. It doesnt
|
||||
# matter if its used for reading fragments or writing
|
||||
# XML packages.
|
||||
# Must be given without any additional signes like "."
|
||||
# or "*."!
|
||||
#
|
||||
# [REQUIRED]
|
||||
#************************************************
|
||||
|
||||
extension_xcu=xcu
|
||||
|
||||
#************************************************
|
||||
# This extension is used for all Package files. It doesnt
|
||||
# matter if its used for reading such files or writing
|
||||
# it.
|
||||
# Must be given without any additional signes like "."
|
||||
# or "*."!
|
||||
#
|
||||
# [REQUIRED]
|
||||
#************************************************
|
||||
|
||||
extension_pkg=pkg
|
||||
|
||||
#************************************************
|
||||
# These values are used to generate a correct XML
|
||||
# header.
|
||||
# Note: The property "xmlpackage" must be specified
|
||||
# via command line. There exists more then one
|
||||
# possible value.
|
||||
#
|
||||
# [REQUIRED]
|
||||
#************************************************
|
||||
|
||||
xmlversion = 1.0
|
||||
xmlencoding = UTF-8
|
||||
xmlpath = org.openoffice.TypeDetection
|
||||
#xmlpackage =
|
||||
|
||||
#************************************************
|
||||
# These values are used to name the configuration
|
||||
# sets inside the generated XCM file for different
|
||||
# item groups like e.g. types, filters etcpp.
|
||||
#
|
||||
# [REQUIRED]
|
||||
#************************************************
|
||||
|
||||
setname_types = Types
|
||||
setname_filters = Filters
|
||||
setname_frameloaders = FrameLoaders
|
||||
setname_contenthandlers = ContentHandlers
|
||||
|
||||
subdir_types = types
|
||||
subdir_filters = filters
|
||||
subdir_frameloaders = frameloaders
|
||||
subdir_contenthandlers = contenthandlers
|
||||
|
||||
#************************************************
|
||||
# This delimiter is used to split every
|
||||
# item list of the package configuration files
|
||||
# (which are temp. created by the make proccess)
|
||||
# into its tokens.
|
||||
#
|
||||
# [REQUIRED]
|
||||
#************************************************
|
||||
delimiter=,
|
||||
|
||||
#************************************************
|
||||
# Enable/disable removing of leading/trailing withespaces
|
||||
# during splitting stringlists.
|
||||
#
|
||||
# [REQUIRED]
|
||||
#************************************************
|
||||
trim=true
|
||||
|
||||
#************************************************
|
||||
# Enable/disable removing of leading/trailing "-signs
|
||||
# during splitting stringlists.
|
||||
#
|
||||
# [REQUIRED]
|
||||
#************************************************
|
||||
decode=false
|
|
@ -1,128 +0,0 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* 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: FCFGMerge.java,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.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
package com.sun.star.filter.config.tools.merge;
|
||||
|
||||
//_______________________________________________
|
||||
|
||||
import com.sun.star.filter.config.tools.utils.*;
|
||||
|
||||
//_______________________________________________
|
||||
|
||||
/**
|
||||
* Its a simple command line tool, which can merge different XML fragments
|
||||
* together. Such fragments must exist as files on disk, will be moved into
|
||||
* one file together on disk.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class FCFGMerge
|
||||
{
|
||||
//___________________________________________
|
||||
// const
|
||||
|
||||
private static final java.lang.String CFGFILE = "com/sun/star/filter/config/tools/merge/FCFGMerge.cfg";
|
||||
private static final java.lang.String PROP_LOGLEVEL = "loglevel";
|
||||
|
||||
//___________________________________________
|
||||
// main
|
||||
|
||||
public static void main(java.lang.String[] sCmdLine)
|
||||
{
|
||||
FCFGMerge.printCopyright();
|
||||
|
||||
// create log object in default mode "WARNINGS"
|
||||
// If a command line parameter indicates another
|
||||
// level - change it!
|
||||
Logger aLog = new Logger();
|
||||
|
||||
try
|
||||
{
|
||||
// merge config file and overwrite properties
|
||||
// via command line
|
||||
ConfigHelper aCfg = null;
|
||||
aCfg = new ConfigHelper(CFGFILE, sCmdLine);
|
||||
|
||||
// update log level
|
||||
int nLogLevel = aCfg.getInt(PROP_LOGLEVEL, Logger.LEVEL_WARNINGS);
|
||||
aLog = new Logger(nLogLevel);
|
||||
|
||||
// help requested?
|
||||
if (aCfg.isHelp())
|
||||
{
|
||||
FCFGMerge.printHelp();
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
// create new merge object and start operation
|
||||
Merger aMerger = new Merger(aCfg, aLog);
|
||||
aMerger.merge();
|
||||
}
|
||||
catch(java.lang.Throwable ex)
|
||||
{
|
||||
aLog.setException(ex);
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** prints out a copyright message on stdout.
|
||||
*/
|
||||
private static void printCopyright()
|
||||
{
|
||||
java.lang.StringBuffer sOut = new java.lang.StringBuffer(256);
|
||||
sOut.append("FCFGMerge\n");
|
||||
sOut.append("Copyright: 2003 by Sun Microsystems, Inc.\n");
|
||||
sOut.append("All Rights Reserved.\n");
|
||||
System.out.println(sOut.toString());
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** prints out a help message on stdout.
|
||||
*/
|
||||
private static void printHelp()
|
||||
{
|
||||
java.lang.StringBuffer sOut = new java.lang.StringBuffer(256);
|
||||
sOut.append("____________________________________________________________\n");
|
||||
sOut.append("usage: FCFGMerge cfg=<file name>\n" );
|
||||
sOut.append("parameters:\n" );
|
||||
sOut.append("\tcfg=<file name>\n" );
|
||||
sOut.append("\t\tmust point to a system file, which contains\n" );
|
||||
sOut.append("\t\tall neccessary configuration data for the merge process.\n");
|
||||
sOut.append("\n\tFurther cou can specify every parameter allowed in the\n" );
|
||||
sOut.append("\n\tconfig file as command line parameter too, to overwrite\n" );
|
||||
sOut.append("\n\tthe value from the file.\n" );
|
||||
System.out.println(sOut.toString());
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Main-Class: com.sun.star.filter.config.tools.merge.FCFGMerge
|
|
@ -1,362 +0,0 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* 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: Merger.java,v $
|
||||
* $Revision: 1.8 $
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************/
|
||||
package com.sun.star.filter.config.tools.merge;
|
||||
|
||||
//_______________________________________________
|
||||
|
||||
import java.io.*;
|
||||
import com.sun.star.filter.config.tools.utils.*;
|
||||
|
||||
//_______________________________________________
|
||||
|
||||
/** can merge different xml fragments together.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class Merger
|
||||
{
|
||||
//___________________________________________
|
||||
// const
|
||||
|
||||
private static final java.lang.String PROP_XMLVERSION = "xmlversion" ; // <= global cfg file
|
||||
private static final java.lang.String PROP_XMLENCODING = "xmlencoding" ; // <= global cfg file
|
||||
private static final java.lang.String PROP_XMLPATH = "xmlpath" ; // <= global cfg file
|
||||
private static final java.lang.String PROP_XMLPACKAGE = "xmlpackage" ; // <= global cfg file
|
||||
|
||||
private static final java.lang.String PROP_SETNAME_TYPES = "setname_types" ; // <= global cfg file
|
||||
private static final java.lang.String PROP_SETNAME_FILTERS = "setname_filters" ; // <= global cfg file
|
||||
private static final java.lang.String PROP_SETNAME_LOADERS = "setname_frameloaders" ; // <= global cfg file
|
||||
private static final java.lang.String PROP_SETNAME_HANDLERS = "setname_contenthandlers" ; // <= global cfg file
|
||||
|
||||
private static final java.lang.String PROP_SUBDIR_TYPES = "subdir_types" ; // <= global cfg file
|
||||
private static final java.lang.String PROP_SUBDIR_FILTERS = "subdir_filters" ; // <= global cfg file
|
||||
private static final java.lang.String PROP_SUBDIR_LOADERS = "subdir_frameloaders" ; // <= global cfg file
|
||||
private static final java.lang.String PROP_SUBDIR_HANDLERS = "subdir_contenthandlers" ; // <= global cfg file
|
||||
|
||||
private static final java.lang.String PROP_EXTENSION_XCU = "extension_xcu" ; // <= global cfg file
|
||||
private static final java.lang.String PROP_EXTENSION_PKG = "extension_pkg" ; // <= global cfg file
|
||||
|
||||
private static final java.lang.String PROP_DELIMITER = "delimiter" ; // <= global cfg file
|
||||
private static final java.lang.String PROP_TRIM = "trim" ; // <= global cfg file
|
||||
private static final java.lang.String PROP_DECODE = "decode" ; // <= global cfg file
|
||||
|
||||
private static final java.lang.String PROP_FRAGMENTSDIR = "fragmentsdir" ; // <= cmdline
|
||||
private static final java.lang.String PROP_TEMPDIR = "tempdir" ; // <= cmdline
|
||||
private static final java.lang.String PROP_OUTDIR = "outdir" ; // <= cmdline
|
||||
private static final java.lang.String PROP_PKG = "pkg" ; // <= cmdline
|
||||
private static final java.lang.String PROP_DEBUG = "debug" ; // <= cmdline
|
||||
|
||||
private static final java.lang.String PROP_TCFG = "tcfg" ; // <= cmdline
|
||||
private static final java.lang.String PROP_FCFG = "fcfg" ; // <= cmdline
|
||||
private static final java.lang.String PROP_LCFG = "lcfg" ; // <= cmdline
|
||||
private static final java.lang.String PROP_CCFG = "ccfg" ; // <= cmdline
|
||||
private static final java.lang.String PROP_LANGUAGEPACK = "languagepack" ; // <= cmdline
|
||||
|
||||
private static final java.lang.String PROP_ITEMS = "items" ; // <= pkg cfg files!
|
||||
|
||||
//___________________________________________
|
||||
// member
|
||||
|
||||
//-------------------------------------------
|
||||
/** TODO */
|
||||
private ConfigHelper m_aCfg;
|
||||
|
||||
//-------------------------------------------
|
||||
/** TODO */
|
||||
private Logger m_aLog;
|
||||
|
||||
//-------------------------------------------
|
||||
/** TODO */
|
||||
private java.io.File m_aFragmentsDir;
|
||||
|
||||
//-------------------------------------------
|
||||
/** TODO */
|
||||
private java.io.File m_aTempDir;
|
||||
|
||||
//-------------------------------------------
|
||||
/** TODO */
|
||||
private java.io.File m_aOutDir;
|
||||
|
||||
//-------------------------------------------
|
||||
/** TODO */
|
||||
private java.util.Vector m_lTypes;
|
||||
private java.util.Vector m_lFilters;
|
||||
private java.util.Vector m_lLoaders;
|
||||
private java.util.Vector m_lHandlers;
|
||||
|
||||
//___________________________________________
|
||||
// interface
|
||||
|
||||
//-------------------------------------------
|
||||
/** initialize a new instance of this class and
|
||||
* try to get all needed resources from the config module.
|
||||
*
|
||||
* @param aCfg
|
||||
* provides access to all values of the global
|
||||
* config file and to the command line.
|
||||
*
|
||||
* @param aLog
|
||||
* can be used to print out log informations.
|
||||
*/
|
||||
public Merger(ConfigHelper aCfg,
|
||||
Logger aLog)
|
||||
throws java.lang.Exception
|
||||
{
|
||||
m_aCfg = aCfg;
|
||||
m_aLog = aLog;
|
||||
|
||||
m_aFragmentsDir = new java.io.File(m_aCfg.getString(PROP_FRAGMENTSDIR));
|
||||
m_aTempDir = new java.io.File(m_aCfg.getString(PROP_TEMPDIR ));
|
||||
// m_aOutDir = new java.io.File(m_aCfg.getString(PROP_OUTDIR ));
|
||||
|
||||
java.lang.String sDelimiter = m_aCfg.getString(PROP_DELIMITER);
|
||||
boolean bTrim = m_aCfg.getBoolean(PROP_TRIM);
|
||||
boolean bDecode = m_aCfg.getBoolean(PROP_DECODE);
|
||||
|
||||
try
|
||||
{
|
||||
ConfigHelper aFcfg = new ConfigHelper(m_aCfg.getString(PROP_TCFG), null);
|
||||
m_lTypes = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode);
|
||||
}
|
||||
catch(java.util.NoSuchElementException ex1)
|
||||
{
|
||||
m_lTypes = new java.util.Vector();
|
||||
//m_aLog.setWarning("Fragment list of types is missing. Parameter \"items\" seems to be invalid.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ConfigHelper aFcfg = new ConfigHelper(m_aCfg.getString(PROP_FCFG), null);
|
||||
m_lFilters = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode);
|
||||
}
|
||||
catch(java.util.NoSuchElementException ex1)
|
||||
{
|
||||
m_lFilters = new java.util.Vector();
|
||||
//m_aLog.setWarning("Fragment list of filters is missing. Parameter \"items\" seems to be invalid.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ConfigHelper aFcfg = new ConfigHelper(m_aCfg.getString(PROP_LCFG), null);
|
||||
m_lLoaders = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode);
|
||||
}
|
||||
catch(java.util.NoSuchElementException ex1)
|
||||
{
|
||||
m_lLoaders = new java.util.Vector();
|
||||
//m_aLog.setWarning("Fragment list of frame loader objects is missing. Parameter \"items\" seems to be invalid.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ConfigHelper aFcfg = new ConfigHelper(m_aCfg.getString(PROP_CCFG), null);
|
||||
m_lHandlers = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode);
|
||||
}
|
||||
catch(java.util.NoSuchElementException ex1)
|
||||
{
|
||||
m_lHandlers = new java.util.Vector();
|
||||
//m_aLog.setWarning("Fragment list of content handler objects is missing. Parameter \"items\" seems to be invalid.");
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
/** TODO */
|
||||
public synchronized void merge()
|
||||
throws java.lang.Exception
|
||||
{
|
||||
java.lang.StringBuffer sBuffer = new java.lang.StringBuffer(1000000);
|
||||
java.lang.String sPackage = m_aCfg.getString(PROP_PKG);
|
||||
|
||||
m_aLog.setGlobalInfo("create package \""+sPackage+"\" ...");
|
||||
m_aLog.setDetailedInfo("generate package header ... ");
|
||||
|
||||
sBuffer.append(
|
||||
XMLHelper.generateHeader(
|
||||
m_aCfg.getString (PROP_XMLVERSION ),
|
||||
m_aCfg.getString (PROP_XMLENCODING ),
|
||||
m_aCfg.getString (PROP_XMLPATH ),
|
||||
m_aCfg.getString (PROP_XMLPACKAGE ),
|
||||
m_aCfg.getBoolean(PROP_LANGUAGEPACK, false)));
|
||||
|
||||
// counts all transfered fragments
|
||||
// Can be used later to decide, if a generated package file
|
||||
// contains "nothing"!
|
||||
int nItemCount = 0;
|
||||
|
||||
for (int i=0; i<4; ++i)
|
||||
{
|
||||
java.lang.String sSetName = null;
|
||||
java.lang.String sSubDir = null;
|
||||
java.util.Vector lFragments = null;
|
||||
|
||||
try
|
||||
{
|
||||
switch(i)
|
||||
{
|
||||
case 0: // types
|
||||
{
|
||||
m_aLog.setDetailedInfo("generate set for types ... ");
|
||||
sSetName = m_aCfg.getString(PROP_SETNAME_TYPES);
|
||||
sSubDir = m_aCfg.getString(PROP_SUBDIR_TYPES );
|
||||
lFragments = m_lTypes;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: // filters
|
||||
{
|
||||
m_aLog.setDetailedInfo("generate set for filter ... ");
|
||||
sSetName = m_aCfg.getString(PROP_SETNAME_FILTERS);
|
||||
sSubDir = m_aCfg.getString(PROP_SUBDIR_FILTERS );
|
||||
lFragments = m_lFilters;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // loaders
|
||||
{
|
||||
m_aLog.setDetailedInfo("generate set for frame loader ... ");
|
||||
sSetName = m_aCfg.getString(PROP_SETNAME_LOADERS);
|
||||
sSubDir = m_aCfg.getString(PROP_SUBDIR_LOADERS );
|
||||
lFragments = m_lLoaders;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: // handlers
|
||||
{
|
||||
m_aLog.setDetailedInfo("generate set for content handler ... ");
|
||||
sSetName = m_aCfg.getString(PROP_SETNAME_HANDLERS);
|
||||
sSubDir = m_aCfg.getString(PROP_SUBDIR_HANDLERS );
|
||||
lFragments = m_lHandlers;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
nItemCount += lFragments.size();
|
||||
|
||||
getFragments(
|
||||
new java.io.File(m_aFragmentsDir, sSubDir),
|
||||
sSetName,
|
||||
lFragments,
|
||||
1,
|
||||
sBuffer);
|
||||
}
|
||||
catch(java.util.NoSuchElementException exIgnore)
|
||||
{ continue; }
|
||||
}
|
||||
|
||||
m_aLog.setDetailedInfo("generate package footer ... ");
|
||||
sBuffer.append(XMLHelper.generateFooter());
|
||||
|
||||
// Attention!
|
||||
// If the package seem to be empty, it make no sense to generate a corresponding
|
||||
// xml file. We should suppress writing of this file on disk completly ...
|
||||
if (nItemCount < 1)
|
||||
{
|
||||
m_aLog.setWarning("Package is empty and will not result into a xml file on disk!? Please check configuration file.");
|
||||
return;
|
||||
}
|
||||
m_aLog.setGlobalInfo("package contains "+nItemCount+" items");
|
||||
|
||||
java.io.File aPackage = new File(sPackage);
|
||||
m_aLog.setGlobalInfo("write temp package \""+aPackage.getPath()); // TODO encoding must be readed from the configuration
|
||||
FileHelper.writeEncodedBufferToFile(aPackage, "UTF-8", false, sBuffer); // check for success is done inside this method!
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
/** TODO */
|
||||
private void getFragments(java.io.File aDir ,
|
||||
java.lang.String sSetName ,
|
||||
java.util.Vector lFragments ,
|
||||
int nPrettyTabs,
|
||||
java.lang.StringBuffer sBuffer )
|
||||
throws java.lang.Exception
|
||||
{
|
||||
if (lFragments.size()<1)
|
||||
{
|
||||
m_aLog.setWarning("List of fragments is empty!? Will be ignored ...");
|
||||
return;
|
||||
}
|
||||
|
||||
java.util.Enumeration pFragments = lFragments.elements();
|
||||
java.lang.String sExtXcu = m_aCfg.getString(PROP_EXTENSION_XCU);
|
||||
|
||||
for (int tabs=0; tabs<nPrettyTabs; ++tabs)
|
||||
sBuffer.append("\t");
|
||||
sBuffer.append("<node oor:name=\""+sSetName+"\">\n");
|
||||
++nPrettyTabs;
|
||||
|
||||
// special mode for generating language packs.
|
||||
// In such case we must live with some missing fragment files.
|
||||
// Reason behind; Not all filters are realy localized.
|
||||
// But we dont use a different fragment list. We try to locate
|
||||
// any fragment file in its language-pack version ...
|
||||
boolean bHandleLanguagePacks = m_aCfg.getBoolean(PROP_LANGUAGEPACK, false);
|
||||
boolean bDebug = m_aCfg.getBoolean(PROP_DEBUG , false);
|
||||
java.lang.String sEncoding = "UTF-8";
|
||||
if (bDebug)
|
||||
sEncoding = "UTF-8Special";
|
||||
|
||||
while(pFragments.hasMoreElements())
|
||||
{
|
||||
java.lang.String sFragment = (java.lang.String)pFragments.nextElement();
|
||||
java.io.File aFragment = new java.io.File(aDir, sFragment+"."+sExtXcu);
|
||||
|
||||
// handle simple files only and check for existence!
|
||||
if (!aFragment.exists())
|
||||
{
|
||||
if (bHandleLanguagePacks)
|
||||
{
|
||||
m_aLog.setWarning("language fragment \""+aFragment.getPath()+"\" does not exist. Will be ignored.");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
throw new java.io.IOException("fragment \""+aFragment.getPath()+"\" does not exists.");
|
||||
}
|
||||
|
||||
if (!aFragment.isFile())
|
||||
{
|
||||
m_aLog.setWarning("fragment \""+aFragment.getPath()+"\" seem to be not a valid file.");
|
||||
continue;
|
||||
}
|
||||
|
||||
// copy file content of original fragment
|
||||
// Note: A FileNotFoundException will be thrown automaticly by the
|
||||
// used reader objects. Let it break this method too. Our calli is interested
|
||||
// on such errors :-)
|
||||
m_aLog.setDetailedInfo("merge fragment \""+aFragment.getPath()+"\" ...");
|
||||
FileHelper.readEncodedBufferFromFile(aFragment, sEncoding, sBuffer);
|
||||
|
||||
sBuffer.append("\n");
|
||||
}
|
||||
|
||||
--nPrettyTabs;
|
||||
for (int tabs=0; tabs<nPrettyTabs; ++tabs)
|
||||
sBuffer.append("\t");
|
||||
sBuffer.append("</node>\n");
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
#*************************************************************************
|
||||
#
|
||||
# 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: makefile.mk,v $
|
||||
#
|
||||
# $Revision: 1.9.102.1 $
|
||||
#
|
||||
# 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 = ..$/..$/..$/..
|
||||
TARGET = FCFGMerge
|
||||
PRJNAME = filter
|
||||
PACKAGE = com$/sun$/star$/filter$/config$/tools$/merge
|
||||
|
||||
# --- Settings -----------------------------------------------------
|
||||
|
||||
.INCLUDE: settings.mk
|
||||
|
||||
#----- compile .java files -----------------------------------------
|
||||
|
||||
OWNCOPY = \
|
||||
$(MISC)$/$(TARGET)_copied.done
|
||||
|
||||
JARFILES = \
|
||||
ridl.jar \
|
||||
unoil.jar \
|
||||
jurt.jar \
|
||||
juh.jar \
|
||||
java_uno.jar
|
||||
|
||||
CFGFILES = \
|
||||
FCFGMerge.cfg
|
||||
|
||||
JAVACLASSFILES = \
|
||||
$(CLASSDIR)$/$(PACKAGE)$/Merger.class \
|
||||
$(CLASSDIR)$/$(PACKAGE)$/FCFGMerge.class
|
||||
|
||||
CUSTOMMANIFESTFILE = \
|
||||
Manifest.mf
|
||||
|
||||
MAXLINELENGTH = 100000
|
||||
|
||||
#----- make a jar from compiled files ------------------------------
|
||||
|
||||
JARCLASSDIRS = \
|
||||
com$/sun$/star$/filter$/config$/tools$/utils \
|
||||
com$/sun$/star$/filter$/config$/tools$/merge
|
||||
|
||||
JARTARGET = $(TARGET).jar
|
||||
|
||||
JARCOMPRESS = TRUE
|
||||
|
||||
# --- targets -----------------------------------------------------
|
||||
|
||||
.INCLUDE : target.mk
|
||||
|
||||
.IF "$(SOLAR_JAVA)" != "" || "$(GUI)"=="OS2"
|
||||
ALLTAR : $(OWNCOPY)
|
||||
|
||||
.IF "$(JARTARGETN)" != ""
|
||||
$(JARTARGETN) : $(OWNCOPY)
|
||||
.ENDIF
|
||||
|
||||
$(OWNCOPY) : $(CFGFILES)
|
||||
-$(MKDIR) $(CLASSDIR)$/$(PACKAGE)
|
||||
$(COPY) $? $(CLASSDIR)$/$(PACKAGE) && $(TOUCH) $@
|
||||
|
||||
.ENDIF # "$(SOLAR_JAVA)" != ""
|
|
@ -1,324 +0,0 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* 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: AnalyzeStartupLog.java,v $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
package com.sun.star.filter.config.tools.utils;
|
||||
|
||||
|
||||
//_______________________________________________
|
||||
// implementation
|
||||
public class AnalyzeStartupLog
|
||||
{
|
||||
private class OperationTime
|
||||
{
|
||||
/** name the measured operation. */
|
||||
public java.lang.String sOperation;
|
||||
|
||||
/** contains the time value, when this operation was started. */
|
||||
public long nStartTime;
|
||||
|
||||
/** contains the time value, when this operation was finished. */
|
||||
public long nEndTime;
|
||||
|
||||
/** text inside log file, which identifies the start time value. */
|
||||
public java.lang.String sStartMsg;
|
||||
|
||||
/** text inside log file, which identifies the end time value. */
|
||||
public java.lang.String sEndMsg;
|
||||
}
|
||||
|
||||
//_________________________________
|
||||
// main
|
||||
|
||||
public static void main(java.lang.String[] lCmdLine)
|
||||
{
|
||||
int nExit = 0;
|
||||
try
|
||||
{
|
||||
// analyze command line
|
||||
ConfigHelper aCmdLine = new ConfigHelper("", lCmdLine);
|
||||
java.lang.String sLogDir = aCmdLine.getString("logdir" );
|
||||
java.lang.String sDataFile = aCmdLine.getString("datafile");
|
||||
|
||||
if (sLogDir == null || sDataFile == null)
|
||||
{
|
||||
System.err.println("AnalyzeStartupLog lodir=<dir> datafile=<file>");
|
||||
System.err.println("E.g.: AnalyzeStartupLog lodir=c:\\temp\\logs datafile=c:\\temp\\data.csv");
|
||||
System.exit(--nExit);
|
||||
}
|
||||
|
||||
// get list of all log files
|
||||
boolean bRecursive = true;
|
||||
java.util.Vector lLogs = FileHelper.getSystemFilesFromDir(new java.io.File(sLogDir), bRecursive);
|
||||
if (lLogs == null || lLogs.isEmpty())
|
||||
{
|
||||
System.err.println("log dir is empty");
|
||||
System.exit(--nExit);
|
||||
}
|
||||
|
||||
// analyze it
|
||||
java.lang.StringBuffer sOut = new java.lang.StringBuffer(1000);
|
||||
sOut.append("log;t_cfg_start;t_cfg_end;t_fwk_start;t_fwk_end;t_sfx_start;t_sfx_end;t_types_start;t_types_end;t_filters_start;t_filters_end;");
|
||||
sOut.append("t_filters_swriter_start;t_filters_swriter_end;t_filters_sweb_start;t_filters_sweb_end;t_filters_sglobal_start;t_filters_sglobal_end;t_filters_scalc_start;t_filters_scalc_end;t_filters_sdraw_start;t_filters_sdraw_end;t_filters_simpress_start;t_filters_simpress_end;t_filters_schart_start;t_filters_schart_end;t_filters_smath_start;t_filters_smath_end;");
|
||||
sOut.append("t_others_start;t_others_end;d_cfg;d_fwk;d_sfx;d_types;d_filters;d_others;d_complete\n");
|
||||
|
||||
java.util.Enumeration aIt = lLogs.elements();
|
||||
while (aIt.hasMoreElements())
|
||||
{
|
||||
java.io.File aLog = (java.io.File)aIt.nextElement();
|
||||
java.io.FileReader aReader = new java.io.FileReader(aLog);
|
||||
java.io.BufferedReader aBuffer = new java.io.BufferedReader(aReader);
|
||||
|
||||
long t_cfg_start = 0;
|
||||
long t_cfg_end = 0;
|
||||
|
||||
long t_fwk_start = 0;
|
||||
long t_fwk_end = 0;
|
||||
|
||||
long t_sfx_start = 0;
|
||||
long t_sfx_end = 0;
|
||||
|
||||
long t_types_start = 0;
|
||||
long t_types_end = 0;
|
||||
|
||||
long t_filters_start = 0;
|
||||
long t_filters_end = 0;
|
||||
|
||||
long t_filters_swriter_start = 0;
|
||||
long t_filters_swriter_end = 0;
|
||||
|
||||
long t_filters_sweb_start = 0;
|
||||
long t_filters_sweb_end = 0;
|
||||
|
||||
long t_filters_sglobal_start = 0;
|
||||
long t_filters_sglobal_end = 0;
|
||||
|
||||
long t_filters_scalc_start = 0;
|
||||
long t_filters_scalc_end = 0;
|
||||
|
||||
long t_filters_sdraw_start = 0;
|
||||
long t_filters_sdraw_end = 0;
|
||||
|
||||
long t_filters_simpress_start = 0;
|
||||
long t_filters_simpress_end = 0;
|
||||
|
||||
long t_filters_schart_start = 0;
|
||||
long t_filters_schart_end = 0;
|
||||
|
||||
long t_filters_smath_start = 0;
|
||||
long t_filters_smath_end = 0;
|
||||
|
||||
long t_others_start = 0;
|
||||
long t_others_end = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
java.lang.String sLine = aBuffer.readLine();
|
||||
if (sLine == null)
|
||||
break;
|
||||
|
||||
if (sLine.endsWith("| framework (as96863) ::FilterCache::FilterCache : { creation ConfigItem [file=standard, version=6, mode=3]"))
|
||||
t_cfg_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("| framework (as96863) ::FilterCache::FilterCache : } creation ConfigItem"))
|
||||
t_cfg_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("| framework (as96863) ::FilterCache::FilterCache : { reading TypeDetection.xml"))
|
||||
t_fwk_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("| framework (as96863) ::FilterCache::FilterCache : } reading TypeDetection.xml"))
|
||||
t_fwk_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("{ framework (as96863) ::FilterCFGAccess::impl_loadTypes"))
|
||||
t_types_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} framework (as96863) ::FilterCFGAccess::impl_loadTypes"))
|
||||
t_types_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("{ framework (as96863) ::FilterCFGAccess::impl_loadFilters"))
|
||||
t_filters_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} framework (as96863) ::FilterCFGAccess::impl_loadFilters"))
|
||||
t_filters_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("{ reading FilterGroup [swriter]"))
|
||||
t_filters_swriter_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} reading FilterGroup [swriter]"))
|
||||
t_filters_swriter_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("{ reading FilterGroup [sweb]"))
|
||||
t_filters_sweb_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} reading FilterGroup [sweb]"))
|
||||
t_filters_sweb_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("{ reading FilterGroup [sglobal]"))
|
||||
t_filters_sglobal_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} reading FilterGroup [sglobal]"))
|
||||
t_filters_sglobal_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("{ reading FilterGroup [scalc]"))
|
||||
t_filters_scalc_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} reading FilterGroup [scalc]"))
|
||||
t_filters_scalc_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("{ reading FilterGroup [sdraw]"))
|
||||
t_filters_sdraw_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} reading FilterGroup [sdraw]"))
|
||||
t_filters_sdraw_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("{ reading FilterGroup [simpress]"))
|
||||
t_filters_simpress_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} reading FilterGroup [simpress]"))
|
||||
t_filters_simpress_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("{ reading FilterGroup [schart]"))
|
||||
t_filters_schart_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} reading FilterGroup [schart]"))
|
||||
t_filters_schart_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("{ reading FilterGroup [smath]"))
|
||||
t_filters_smath_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} reading FilterGroup [smath]"))
|
||||
t_filters_smath_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("{ framework (as96863) ::FilterCFGAccess::impl_loadDetectors"))
|
||||
t_others_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} framework (as96863) ::FilterCFGAccess::impl_loadContentHandlers"))
|
||||
t_others_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} framework (as96863) ::FilterCache::FilterCache"))
|
||||
t_sfx_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
else
|
||||
if (sLine.endsWith("} desktop (lo119109) OfficeWrapper::OfficeWrapper"))
|
||||
t_sfx_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
|
||||
}
|
||||
|
||||
sOut.append(aLog.getName() );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_cfg_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_cfg_end );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_fwk_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_fwk_end );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_sfx_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_sfx_end );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_types_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_types_end );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_end );
|
||||
sOut.append(";" );
|
||||
|
||||
sOut.append(t_filters_swriter_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_swriter_end );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_sweb_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_sweb_end );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_sglobal_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_sglobal_end );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_scalc_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_scalc_end );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_sdraw_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_sdraw_end );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_simpress_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_simpress_end );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_schart_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_schart_end );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_smath_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_smath_end );
|
||||
sOut.append(";" );
|
||||
|
||||
sOut.append(t_others_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_others_end );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_cfg_end -t_cfg_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_fwk_end -t_fwk_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_sfx_end -t_sfx_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_types_end -t_types_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_filters_end-t_filters_start);
|
||||
sOut.append(";" );
|
||||
sOut.append(t_others_end -t_others_start );
|
||||
sOut.append(";" );
|
||||
sOut.append(t_others_end -t_cfg_start );
|
||||
sOut.append("\n" );
|
||||
|
||||
aBuffer.close();
|
||||
}
|
||||
|
||||
java.io.FileWriter aCSV = new java.io.FileWriter(sDataFile);
|
||||
java.lang.String sData = sOut.toString();
|
||||
aCSV.write(sData, 0, sData.length());
|
||||
aCSV.flush();
|
||||
aCSV.close();
|
||||
}
|
||||
catch(java.lang.Throwable exAny)
|
||||
{
|
||||
System.err.println(exAny.getMessage());
|
||||
exAny.printStackTrace();
|
||||
System.exit(--nExit);
|
||||
}
|
||||
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,297 +0,0 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* 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: ConfigHelper.java,v $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
**********************************************************************_*/
|
||||
|
||||
package com.sun.star.filter.config.tools.utils;
|
||||
|
||||
|
||||
//_______________________________________________
|
||||
// definition
|
||||
|
||||
/** can be used to analyze command line parameters
|
||||
* and merge it together with might existing config
|
||||
* files. That provides the possibility to overwrite
|
||||
* config values via command line parameter.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ConfigHelper extends java.util.Properties
|
||||
{
|
||||
//___________________________________________
|
||||
// member
|
||||
|
||||
/** indicates an empty command line. */
|
||||
private boolean m_bEmpty = true;
|
||||
|
||||
//___________________________________________
|
||||
// ctor
|
||||
|
||||
//-------------------------------------------
|
||||
/** initialize a new helper with the list of
|
||||
* command line parameters and bind this new instance
|
||||
* to a property file on disk.
|
||||
*
|
||||
* @param sPropFile
|
||||
* name of the property file.
|
||||
* If its set to null or an empty value
|
||||
* it will be ignored.
|
||||
*
|
||||
* @param lCommandLineArgs
|
||||
* the list of original command line arguments.
|
||||
*
|
||||
* @throws [Exception]
|
||||
* in case the command line contains an unknown
|
||||
* schema for specifiying parameters or the
|
||||
* specified property file does not exists
|
||||
* or seem to be corrupted.
|
||||
*/
|
||||
public ConfigHelper(java.lang.String sPropFile ,
|
||||
java.lang.String[] lCommandLineArgs)
|
||||
throws java.lang.Exception
|
||||
{
|
||||
// first load prop file, so its values can be overwritten
|
||||
// by command line args later
|
||||
// Do it only, if a valid file name was given.
|
||||
// But in case this file name is wrong, throw an exception.
|
||||
// So the outside code can react!
|
||||
if (
|
||||
(sPropFile != null) &&
|
||||
(sPropFile.length() > 0 )
|
||||
)
|
||||
{
|
||||
java.lang.ClassLoader aLoader = getClass().getClassLoader();
|
||||
java.io.InputStream aStream = aLoader.getResourceAsStream(sPropFile);
|
||||
if (aStream == null)
|
||||
aStream = new java.io.FileInputStream(sPropFile);
|
||||
load(aStream);
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
if (lCommandLineArgs != null)
|
||||
count = lCommandLineArgs.length;
|
||||
m_bEmpty = (count < 1);
|
||||
|
||||
for (int arg=0; arg<count; ++arg)
|
||||
{
|
||||
// is it a named-value argument?
|
||||
// Note: We ignores double "=" signs! => search from left to right
|
||||
int len = lCommandLineArgs[arg].length();
|
||||
int pos = lCommandLineArgs[arg].indexOf('=');
|
||||
if (pos != -1)
|
||||
{
|
||||
java.lang.String sArg = lCommandLineArgs[arg].substring(0,pos);
|
||||
java.lang.String sValue = lCommandLineArgs[arg].substring(pos+1);
|
||||
setProperty(sArg, sValue);
|
||||
continue;
|
||||
}
|
||||
|
||||
// is it a boolean argument?
|
||||
// Note: Because "--" and "-" will be interpreted as the same
|
||||
// we search from right to left!
|
||||
pos = lCommandLineArgs[arg].lastIndexOf('-');
|
||||
if (pos == -1)
|
||||
pos = lCommandLineArgs[arg].lastIndexOf('/');
|
||||
if (pos != -1)
|
||||
{
|
||||
java.lang.String sArg = lCommandLineArgs[arg].substring(pos+1);
|
||||
setProperty(sArg, java.lang.String.valueOf(true));
|
||||
continue;
|
||||
}
|
||||
|
||||
// There is an unknown format used by this argument ...
|
||||
throw new MalformedCommandLineException("Invalid command line detected. The argument \""+lCommandLineArgs[arg]+"\" use an unsupported format.");
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
/** indicates if the given command line includes
|
||||
* a help request.
|
||||
*
|
||||
* @return True if there was an explicit help request.
|
||||
*/
|
||||
public synchronized boolean isHelp()
|
||||
{
|
||||
return (
|
||||
(containsKey("help")) ||
|
||||
(containsKey("?") ) ||
|
||||
(containsKey("h") )
|
||||
);
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
/** indicates if the gioven command line was empty.
|
||||
*
|
||||
* @return True if there was an empty command line.
|
||||
*/
|
||||
public synchronized boolean isEmpty()
|
||||
{
|
||||
return m_bEmpty;
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
/** returns the value of sProp as boolean value.
|
||||
*
|
||||
* @param sProp
|
||||
* the name of the parameter.
|
||||
*
|
||||
* @return The boolean value of the requested property.
|
||||
*
|
||||
* @throw [NoSuchElementException]
|
||||
* if the requested property does not exists.
|
||||
*/
|
||||
public synchronized boolean getBoolean(java.lang.String sProp)
|
||||
throws java.util.NoSuchElementException
|
||||
{
|
||||
java.lang.String sValue = getProperty(sProp);
|
||||
if (sValue == null)
|
||||
throw new java.util.NoSuchElementException("The requested config value \""+sProp+"\" does not exists!");
|
||||
return new java.lang.Boolean(sValue).booleanValue();
|
||||
}
|
||||
|
||||
public synchronized boolean getBoolean(java.lang.String sProp ,
|
||||
boolean bDefault)
|
||||
{
|
||||
java.lang.String sDefault = java.lang.String.valueOf(bDefault);
|
||||
java.lang.String sValue = getProperty(sProp, sDefault);
|
||||
return new java.lang.Boolean(sValue).booleanValue();
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
/** returns the value of sProp as int value.
|
||||
*
|
||||
* @param sProp
|
||||
* the name of the parameter.
|
||||
*
|
||||
* @return The int value of the requested property.
|
||||
*
|
||||
* @throw [NoSuchElementException]
|
||||
* if the requested property does not exists.
|
||||
*/
|
||||
public synchronized int getInt(java.lang.String sProp)
|
||||
throws java.util.NoSuchElementException
|
||||
{
|
||||
java.lang.String sValue = getProperty(sProp);
|
||||
if (sValue == null)
|
||||
throw new java.util.NoSuchElementException("The requested config value \""+sProp+"\" does not exists!");
|
||||
return new java.lang.Integer(sValue).intValue();
|
||||
}
|
||||
|
||||
public synchronized int getInt(java.lang.String sProp ,
|
||||
int nDefault)
|
||||
{
|
||||
java.lang.String sDefault = java.lang.String.valueOf(nDefault);
|
||||
java.lang.String sValue = getProperty(sProp, sDefault);
|
||||
return new java.lang.Integer(sValue).intValue();
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
/** returns the value of sProp as string value.
|
||||
*
|
||||
* @param sProp
|
||||
* the name of the parameter.
|
||||
*
|
||||
* @return The string value of the requested property.
|
||||
*
|
||||
* @throw [NoSuchElementException]
|
||||
* if the requested property does not exists.
|
||||
*/
|
||||
public synchronized java.lang.String getString(java.lang.String sProp)
|
||||
throws java.util.NoSuchElementException
|
||||
{
|
||||
java.lang.String sValue = getProperty(sProp);
|
||||
if (sValue == null)
|
||||
throw new java.util.NoSuchElementException("The requested config value \""+sProp+"\" does not exists!");
|
||||
return sValue;
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
/** returns the value of sProp as string list value!
|
||||
*
|
||||
* @descr The delimiter must be well known and
|
||||
* it must be clear if trailing/leading
|
||||
* whitespaces must be ignored or not.
|
||||
*
|
||||
* @param sProp
|
||||
* the name of the parameter.
|
||||
*
|
||||
* @param sDelim
|
||||
* the delimiter, which must be used to split
|
||||
* the config string value into an array.
|
||||
*
|
||||
* @param bTrim
|
||||
* if its set to true, trailing and leading whitespace
|
||||
* characters will be ommited.
|
||||
*
|
||||
* @param bDecode
|
||||
* if its set to TRUE all liste items will be
|
||||
* interpreted as "<xxx>" and converted to <xxx>!
|
||||
*
|
||||
* @return The string list value of the requested property.
|
||||
*
|
||||
* @throw [NoSuchElementException]
|
||||
* if the requested property does not exists.
|
||||
*/
|
||||
public synchronized java.util.Vector getStringList(java.lang.String sProp ,
|
||||
java.lang.String sDelimiter,
|
||||
boolean bTrim ,
|
||||
boolean bDecode )
|
||||
throws java.util.NoSuchElementException
|
||||
{
|
||||
java.lang.String sValue = getProperty(sProp);
|
||||
if (sValue == null)
|
||||
throw new java.util.NoSuchElementException("The requested config value \""+sProp+"\" does not exists!");
|
||||
|
||||
java.util.Vector lValue = new java.util.Vector();
|
||||
try
|
||||
{
|
||||
java.util.StringTokenizer lTokens = new java.util.StringTokenizer(sValue, sDelimiter);
|
||||
while(lTokens.hasMoreTokens())
|
||||
{
|
||||
java.lang.String sToken = lTokens.nextToken();
|
||||
// remove trailing/leading whitespaces
|
||||
if (bTrim)
|
||||
sToken = sToken.trim();
|
||||
// remove ""
|
||||
if (
|
||||
(bDecode ) &&
|
||||
(sToken.indexOf("\"") == 0 ) &&
|
||||
(sToken.lastIndexOf("\"") == sToken.length()-1)
|
||||
)
|
||||
{
|
||||
sToken = sToken.substring(1, sToken.length()-1);
|
||||
}
|
||||
lValue.add(sToken);
|
||||
}
|
||||
}
|
||||
catch(java.lang.Throwable ex)
|
||||
{ lValue.clear(); }
|
||||
|
||||
return lValue;
|
||||
}
|
||||
}
|
|
@ -1,760 +0,0 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* 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: FileHelper.java,v $
|
||||
* $Revision: 1.13 $
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
package com.sun.star.filter.config.tools.utils;
|
||||
|
||||
|
||||
// __________ Implementation __________
|
||||
|
||||
/**
|
||||
* It collects some static helper functons to handle file system specific problems.
|
||||
* Sometimes it's neccessary to convert URL from/to system pathes;
|
||||
* or from string notation to structural versions (e.g. com.sun.star.util.URL).
|
||||
* And sometimes java had another notation then the office it has.
|
||||
* Further it provides functionality to work easiear with the java.io.File class of java.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class FileHelper
|
||||
{
|
||||
// ____________________
|
||||
|
||||
/**
|
||||
* Because the office need URLs for loading/saving documents
|
||||
* we must convert used system pathes.
|
||||
* And java use another notation for file URLs ... correct it.
|
||||
*
|
||||
* @param aSystemPath
|
||||
* represent the file in system notation
|
||||
*
|
||||
* @return [String]
|
||||
* a file url which represent the given system path
|
||||
*/
|
||||
public static java.lang.String getFileURLFromSystemPath(java.io.File aSystemPath)
|
||||
{
|
||||
System.out.println("TODO: must be adapted to java 1.3 :-(");
|
||||
System.exit(-1);
|
||||
/*TODO_JAVA
|
||||
try
|
||||
{
|
||||
sFileURL = aSystemPath.toURI().toURL().toString();
|
||||
}
|
||||
catch( MalformedURLException exWrong )
|
||||
{
|
||||
sFileURL = null;
|
||||
}
|
||||
*/
|
||||
java.lang.String sFileURL = null;
|
||||
|
||||
// problem of java: file URL's are coded with 1 slash instead of 2 or 3 ones!
|
||||
// => correct this problem first, otherwise office can't use these URL's
|
||||
if(
|
||||
(sFileURL != null ) &&
|
||||
(sFileURL.startsWith("file:/") == true ) &&
|
||||
(sFileURL.startsWith("file://") == false)
|
||||
)
|
||||
{
|
||||
java.lang.StringBuffer sWorkBuffer = new java.lang.StringBuffer(sFileURL);
|
||||
sWorkBuffer.insert(6,"//");
|
||||
sFileURL = sWorkBuffer.toString();
|
||||
}
|
||||
|
||||
return sFileURL;
|
||||
}
|
||||
|
||||
// ____________________
|
||||
|
||||
/**
|
||||
* The same as getFileURLFromSystemPath() before but uses string parameter instead
|
||||
* of a java.io.File type. It exist to supress converting of neccessary parameters in the
|
||||
* outside code. But of course getFileURLFromSystemPath(File) will be a little bit faster
|
||||
* then this method ...
|
||||
*
|
||||
* @param sSystemPath
|
||||
* represent the file in system notation
|
||||
*
|
||||
* @return [String]
|
||||
* a file url which represent the given system path
|
||||
*/
|
||||
public static java.lang.String getFileURLFromSystemPath(java.lang.String sSystemPath)
|
||||
{
|
||||
return getFileURLFromSystemPath(new java.io.File(sSystemPath));
|
||||
}
|
||||
|
||||
// ____________________
|
||||
|
||||
/**
|
||||
* Does the same as getFileURLFromSystemPath() before ... but uses
|
||||
* the given protocol string (e.g."http://") insted of "file:///".
|
||||
*
|
||||
* @param aSystemPath
|
||||
* represent the file in system notation
|
||||
*
|
||||
* @param aBasePath
|
||||
* define the base path of the aSystemPath value,
|
||||
* which must be replaced with the value of "sServerPath".
|
||||
*
|
||||
* @param sServerURL
|
||||
* Will be used to replace sBasePath.
|
||||
*
|
||||
* @example
|
||||
* System Path = "d:\test\file.txt"
|
||||
* Base Path = "d:\test"
|
||||
* Server Path = "http://alaska:8000"
|
||||
* => "http://alaska:8000/file.txt"
|
||||
*
|
||||
* @return [String]
|
||||
* an url which represent the given system path
|
||||
* and uses the given protocol
|
||||
*/
|
||||
public static java.lang.String getURLWithProtocolFromSystemPath(java.io.File aSystemPath,
|
||||
java.io.File aBasePath ,
|
||||
java.lang.String sServerURL )
|
||||
{
|
||||
System.out.println("TODO: must be adapted to java 1.3 :-(");
|
||||
System.exit(-1);
|
||||
|
||||
java.lang.String sFileURL = FileHelper.getFileURLFromSystemPath(aSystemPath);
|
||||
java.lang.String sBaseURL = FileHelper.getFileURLFromSystemPath(aBasePath );
|
||||
|
||||
// cut last '/'!
|
||||
if (sBaseURL.lastIndexOf('/')==(sBaseURL.length()-1))
|
||||
sBaseURL = sBaseURL.substring(0,sBaseURL.length()-1);
|
||||
|
||||
// cut last '/'!
|
||||
if (sServerURL.lastIndexOf('/')==(sServerURL.length()-1))
|
||||
sServerURL = sServerURL.substring(0,sServerURL.length()-1);
|
||||
|
||||
//TODO_JAVA java.lang.String sURL = sFileURL.replaceFirst(sBaseURL,sServerURL);
|
||||
java.lang.String sURL = null;
|
||||
return sURL;
|
||||
}
|
||||
|
||||
// ____________________
|
||||
|
||||
/**
|
||||
* The same as getURLWithProtocolFromSystemPath() before but uses string parameter instead
|
||||
* of a java.io.File types. It exist to supress converting of neccessary parameters in the
|
||||
* outside code. But of course getURLWithProtocolFromSystemPath(File,File,String) will be
|
||||
* a little bit faster then this method ...
|
||||
*
|
||||
* @param sSystemPath
|
||||
* represent the file in system notation
|
||||
*
|
||||
* @param sBasePath
|
||||
* define the base path of the aSystemPath value,
|
||||
* which must be replaced with the value of "sServerPath".
|
||||
*
|
||||
* @param sServerPath
|
||||
* Will be used to replace sBasePath.
|
||||
*
|
||||
* @example
|
||||
* System Path = "d:\test\file.txt"
|
||||
* Base Path = "d:\test"
|
||||
* Server Path = "http://alaska:8000"
|
||||
* => "http://alaska:8000/file.txt"
|
||||
*
|
||||
* @return [String]
|
||||
* an url which represent the given system path
|
||||
* and uses the given protocol
|
||||
*/
|
||||
public static java.lang.String getURLWithProtocolFromSystemPath(java.lang.String sSystemPath,
|
||||
java.lang.String sBasePath ,
|
||||
java.lang.String sServerPath)
|
||||
{
|
||||
return getURLWithProtocolFromSystemPath(new java.io.File(sSystemPath), new java.io.File(sBasePath), sServerPath);
|
||||
}
|
||||
|
||||
//_________________________________
|
||||
|
||||
/**
|
||||
* Return a list of all available files of a directory.
|
||||
* We filter sub directories. All other files
|
||||
* are returned. So they can be used for further purposes.
|
||||
* One parameter define the start directory,
|
||||
* another one enable/disable recursive search into sub directories.
|
||||
*
|
||||
* @param aRoot
|
||||
* the start directory, which should be analyzed.
|
||||
*
|
||||
* @param bRecursive
|
||||
* enable/disable search in sub directories.
|
||||
*
|
||||
* @return [Vector]
|
||||
* a filtered list of java java.io.File objects of all available files
|
||||
* of the start dir (and may of its sub directories).
|
||||
*/
|
||||
public static java.util.Vector getSystemFilesFromDir(java.io.File aRoot ,
|
||||
boolean bRecursive)
|
||||
{
|
||||
java.io.File[] lAllFiles = aRoot.listFiles();
|
||||
if (lAllFiles == null)
|
||||
return null;
|
||||
|
||||
int c = lAllFiles.length;
|
||||
java.util.Vector lFilteredFiles = new java.util.Vector(c);
|
||||
for (int i=0; i<c; ++i)
|
||||
{
|
||||
// simple files!
|
||||
if (lAllFiles[i].isFile())
|
||||
lFilteredFiles.add(lAllFiles[i]);
|
||||
else
|
||||
// recursion?
|
||||
if (bRecursive && lAllFiles[i].isDirectory())
|
||||
{
|
||||
java.util.Vector lSubFiles = FileHelper.getSystemFilesFromDir(lAllFiles[i],bRecursive);
|
||||
if (lSubFiles != null)
|
||||
{
|
||||
java.util.Enumeration aSnapshot = lSubFiles.elements();
|
||||
while (aSnapshot.hasMoreElements())
|
||||
lFilteredFiles.add(aSnapshot.nextElement());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lFilteredFiles;
|
||||
}
|
||||
|
||||
//_________________________________
|
||||
/** it converts the given name (e.g. an internal type name) to
|
||||
* an usable system file name.
|
||||
*
|
||||
* Do so some special characters (e.g. "/") must be replaced with other ones.
|
||||
*
|
||||
* @param sName
|
||||
* the name, which should be analyzed and converted.
|
||||
*
|
||||
* @return A valid system file name, which should be similar to the
|
||||
* given name, but does not contain special characters any longer.
|
||||
*/
|
||||
public static java.lang.String convertName2FileName(String sName)
|
||||
{
|
||||
int i = 0;
|
||||
int nLength = sName.length();
|
||||
char[] lBuffer = sName.toCharArray();
|
||||
|
||||
java.lang.StringBuffer sNewName = new java.lang.StringBuffer(nLength);
|
||||
for (i=0; i<nLength; ++i)
|
||||
{
|
||||
char c = lBuffer[i];
|
||||
if (
|
||||
c>=48 && c<=57 // 0-9
|
||||
&&
|
||||
c>=97 && c<=122 // a-z
|
||||
&&
|
||||
c>=65 && c<=90 // A-Z
|
||||
)
|
||||
{
|
||||
sNewName.append(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
sNewName.append("_");
|
||||
}
|
||||
}
|
||||
|
||||
return sNewName.toString();
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** it removes all child nodes of a file system directory.
|
||||
*
|
||||
* @param aDirectory
|
||||
* points to the directory, which should be made empty.
|
||||
*
|
||||
* @param bFilesOnly
|
||||
* force deletion of files only. If its set to TRUE,
|
||||
* no subdirectory will be removed.
|
||||
*
|
||||
* @throw [java.io.IOException]
|
||||
* if some of the child nodes couldn't be removed.
|
||||
*/
|
||||
public static void makeDirectoryEmpty(java.io.File aDirectory,
|
||||
boolean bFilesOnly)
|
||||
throws java.io.IOException
|
||||
{
|
||||
if (!aDirectory.isDirectory())
|
||||
throw new java.io.FileNotFoundException("\""+aDirectory.toString()+"\" is not a directory.");
|
||||
|
||||
java.io.File[] lChilds = aDirectory.listFiles();
|
||||
for (int f=0; f<lChilds.length; ++f)
|
||||
{
|
||||
if (lChilds[f].isDirectory())
|
||||
{
|
||||
FileHelper.makeDirectoryEmpty(lChilds[f], bFilesOnly);
|
||||
if (!bFilesOnly)
|
||||
{
|
||||
if (!lChilds[f].delete())
|
||||
throw new java.io.IOException("\""+lChilds[f].toString()+"\" could not be deleted.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!lChilds[f].delete())
|
||||
throw new java.io.IOException("\""+lChilds[f].toString()+"\" could not be deleted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** it try to generate a new file with a unique ID
|
||||
* inside given directory.
|
||||
*
|
||||
* Call this method with a directory and a base name for
|
||||
* a file. It will be used to generate a new files inside
|
||||
* the directory. Existing files will be checked and new file
|
||||
* name will be tested till a non existing file name would be found.
|
||||
*
|
||||
* @param aBaseDir
|
||||
* must be a system path
|
||||
* e.g.: "c:\temp"
|
||||
*
|
||||
* @param sBaseName
|
||||
* must be a system file name without extensions.
|
||||
* e.g.: "myfile_"
|
||||
*
|
||||
* @param sExtension
|
||||
* the whished extension.
|
||||
* e.g.: "dat"
|
||||
*
|
||||
* @return A valid file object, if an unique file could be created -
|
||||
* Null otherwhise.
|
||||
* e.g.: "c:\temp\myfile_1.dat"
|
||||
*/
|
||||
public static java.io.File createUniqueFile(java.io.File aBaseDir ,
|
||||
java.lang.String sBaseName ,
|
||||
java.lang.String sExtension)
|
||||
{
|
||||
java.io.File aBaseFile = new java.io.File(aBaseDir, sBaseName);
|
||||
java.io.File aFile = null;
|
||||
long nr = 0;
|
||||
while (aFile == null && nr < java.lang.Long.MAX_VALUE)
|
||||
{
|
||||
java.lang.String sFileName = aBaseFile.getPath() + java.lang.String.valueOf(nr) + "." + sExtension;
|
||||
aFile = new java.io.File(sFileName);
|
||||
if (aFile.exists())
|
||||
aFile=null;
|
||||
++nr;
|
||||
}
|
||||
return aFile;
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** reads the complete file, using the right encoding,
|
||||
* into the given string buffer.
|
||||
*
|
||||
* @param aFile
|
||||
* must point to a system file, which must exist.
|
||||
* e.g.: "c:\temp\test.txt"
|
||||
* "/tmp/test.txt"
|
||||
*
|
||||
* @param sEncoding
|
||||
* will be used to encode the string content
|
||||
* inside the file.
|
||||
* e.g.: "UTF8"
|
||||
*
|
||||
* @param sBuffer
|
||||
* used to return the file content.
|
||||
*
|
||||
* @throw [IOException]
|
||||
* - if the file couldnt be opened
|
||||
* - if the file does not use the right encoding
|
||||
*/
|
||||
public static void readEncodedBufferFromFile(java.io.File aFile ,
|
||||
java.lang.String sEncoding,
|
||||
java.lang.StringBuffer sBuffer )
|
||||
throws java.io.IOException
|
||||
{
|
||||
if (sEncoding.equals("UTF-8Special"))
|
||||
{
|
||||
FileHelper.readAndCheckUTF8File(aFile,sBuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
java.io.FileInputStream aByteStream = new java.io.FileInputStream(aFile.getAbsolutePath());
|
||||
java.io.InputStreamReader aEncodedReader = new java.io.InputStreamReader(aByteStream, sEncoding);
|
||||
char[] aEncodedBuffer = new char[4096];
|
||||
int nReadCount = 0;
|
||||
|
||||
while((nReadCount=aEncodedReader.read(aEncodedBuffer))>0)
|
||||
sBuffer.append(aEncodedBuffer, 0, nReadCount);
|
||||
|
||||
aEncodedReader.close();
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
private static void logEncodingData(java.lang.StringBuffer sLog ,
|
||||
int nUTF8 ,
|
||||
int nByteOrg1 ,
|
||||
int nByteOrg2 ,
|
||||
int nByteOrg3 ,
|
||||
int nByteOrg4 ,
|
||||
int nByte1 ,
|
||||
int nByte2 ,
|
||||
int nByte3 ,
|
||||
int nByte4 ,
|
||||
int nEncodingType)
|
||||
{
|
||||
sLog.append("["+nEncodingType+"]\t");
|
||||
sLog.append((int)nUTF8+"\t=");
|
||||
sLog.append("\t"+nByteOrg1+"/"+nByte1);
|
||||
sLog.append("\t"+nByteOrg2+"/"+nByte2);
|
||||
sLog.append("\t"+nByteOrg3+"/"+nByte3);
|
||||
sLog.append("\t"+nByteOrg4+"/"+nByte4);
|
||||
sLog.append("\n");
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
private static char impl_convertBytesToChar(int nByte1, int nByte2, int nByte3, int nByte4)
|
||||
{
|
||||
return (char)((nByte1*0x40000)+(nByte2*0x1000)+(nByte3*0x40)+nByte4);
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
private static int impl_readAndCheckNextByte(byte[] aBuffer ,
|
||||
int nBufPos ,
|
||||
int nBufLength ,
|
||||
int nMinRange ,
|
||||
int nMaxRange )
|
||||
throws java.lang.Exception
|
||||
{
|
||||
if (nBufPos>=nBufLength)
|
||||
throw new java.lang.Exception("impl_readAndCheckNextByte()\nEnd of buffer reached.");
|
||||
|
||||
int nByte = aBuffer[nBufPos] & 0xFF;
|
||||
if (
|
||||
(nByte < nMinRange) ||
|
||||
(nByte > nMaxRange)
|
||||
)
|
||||
{
|
||||
throw new java.lang.Exception("impl_readAndCheckNextByte()\nByte does not fit the specified range.");
|
||||
}
|
||||
|
||||
return nByte;
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
public static void readAndCheckUTF8File(java.io.File aFile ,
|
||||
java.lang.StringBuffer sBuffer)
|
||||
throws java.io.IOException
|
||||
{
|
||||
java.io.FileInputStream aByteStream = new java.io.FileInputStream(aFile.getAbsolutePath());
|
||||
byte[] aBuffer = new byte[4096];
|
||||
int nReadCount = 0;
|
||||
int nByteOrg_1 = 0;
|
||||
int nByteOrg_2 = 0;
|
||||
int nByteOrg_3 = 0;
|
||||
int nByteOrg_4 = 0;
|
||||
int nByte_1 = 0;
|
||||
int nByte_2 = 0;
|
||||
int nByte_3 = 0;
|
||||
int nByte_4 = 0;
|
||||
char nUTF8 = 0;
|
||||
int i = 0;
|
||||
int nEncodingType = 0;
|
||||
java.lang.StringBuffer sLog = new java.lang.StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
while((nReadCount=aByteStream.read(aBuffer))>0)
|
||||
{
|
||||
i=0;
|
||||
while (i<nReadCount)
|
||||
{
|
||||
nByteOrg_1 = 0;
|
||||
nByteOrg_2 = 0;
|
||||
nByteOrg_3 = 0;
|
||||
nByteOrg_4 = 0;
|
||||
nByte_1 = 0;
|
||||
nByte_2 = 0;
|
||||
nByte_3 = 0;
|
||||
nByte_4 = 0;
|
||||
nUTF8 = 0;
|
||||
nEncodingType = 0;
|
||||
|
||||
nByteOrg_1 = aBuffer[i++] & 0xFF;
|
||||
nByte_1 = nByteOrg_1;
|
||||
/*
|
||||
Table 3-6. Well-Formed UTF-8 Byte Sequences
|
||||
|
||||
============================================================================
|
||||
Nr. Code Points 1st Byte 2nd Byte 3rd Byte 4th Byte
|
||||
============================================================================
|
||||
01 U+ 0..U+ 7F 00..7F
|
||||
02 U+ 80..U+ 7FF C2..DF 80..BF
|
||||
03 U+ 800..U+ FFF E0 A0..BF 80..BF
|
||||
04 U+ 1000..U+ CFFF E1..EC 80..BF 80..BF
|
||||
05 U+ D000..U+ D7FF ED 80..9F 80..BF
|
||||
06 U+ E000..U+ FFFF EE..EF 80..BF 80..BF
|
||||
07 U+ 10000..U+ 3FFFF F0 90..BF 80..BF 80..BF
|
||||
08 U+ 40000..U+ FFFFF F1..F3 80..BF 80..BF 80..BF
|
||||
09 U+100000..U+10FFFF F4 80..8F 80..BF 80..BF
|
||||
*/
|
||||
// ------------------------------------------------------------
|
||||
// 01
|
||||
// 1 byte: 0xxxxxxx
|
||||
// ------------------------------------------------------------
|
||||
if (
|
||||
(nByteOrg_1 >= 0x00) &&
|
||||
(nByteOrg_1 <= 0x7F)
|
||||
)
|
||||
{
|
||||
nEncodingType = 1;
|
||||
nUTF8 = (char)nByte_1;
|
||||
}
|
||||
// ------------------------------------------------------------
|
||||
// 02
|
||||
// 1 byte: 110xxxxx
|
||||
// 2 byte: 101xxxxx
|
||||
// ------------------------------------------------------------
|
||||
else
|
||||
if (
|
||||
(nByteOrg_1 >= 0xC2) &&
|
||||
(nByteOrg_1 <= 0xDF)
|
||||
)
|
||||
{
|
||||
nEncodingType = 2;
|
||||
nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByte_1 = nByteOrg_1-0xC2;
|
||||
nByte_2 = nByteOrg_2-0x80;
|
||||
nUTF8 = FileHelper.impl_convertBytesToChar(0,0,nByte_1, nByte_2);
|
||||
}
|
||||
// ------------------------------------------------------------
|
||||
// 03
|
||||
// 1 byte: 11100000
|
||||
// 2 byte: 101xxxxx
|
||||
// 3 byte: 10xxxxxx
|
||||
// ------------------------------------------------------------
|
||||
else
|
||||
if (nByteOrg_1 == 0xE0)
|
||||
{
|
||||
nEncodingType = 3;
|
||||
nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0xA0, 0xBF);
|
||||
nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByte_2 = nByteOrg_2-0xA0;
|
||||
nByte_3 = nByteOrg_3-0x80;
|
||||
nUTF8 = FileHelper.impl_convertBytesToChar(0,0,nByte_2, nByte_3);
|
||||
}
|
||||
// ------------------------------------------------------------
|
||||
// 04
|
||||
// 1 byte: 111xxxxx
|
||||
// 2 byte: 10xxxxxx
|
||||
// 3 byte: 10xxxxxx
|
||||
// ------------------------------------------------------------
|
||||
else
|
||||
if (
|
||||
(nByteOrg_1 >= 0xE1) &&
|
||||
(nByteOrg_1 <= 0xEC)
|
||||
)
|
||||
{
|
||||
nEncodingType = 4;
|
||||
nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByte_1 = nByteOrg_1-0xE1;
|
||||
nByte_2 = nByteOrg_2-0x80;
|
||||
nByte_3 = nByteOrg_3-0x80;
|
||||
nUTF8 = FileHelper.impl_convertBytesToChar(0,nByte_1, nByte_2, nByte_3);
|
||||
}
|
||||
// ------------------------------------------------------------
|
||||
// 05
|
||||
// 1 byte: 11101101
|
||||
// 2 byte: 10xxxxxx
|
||||
// 3 byte: 10xxxxxx
|
||||
// ------------------------------------------------------------
|
||||
else
|
||||
if (nByteOrg_1 == 0xED)
|
||||
{
|
||||
nEncodingType = 5;
|
||||
nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0x9F);
|
||||
nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByte_2 = nByteOrg_2-0x80;
|
||||
nByte_3 = nByteOrg_3-0x80;
|
||||
nUTF8 = FileHelper.impl_convertBytesToChar(0,0, nByte_2, nByte_3);
|
||||
}
|
||||
// ------------------------------------------------------------
|
||||
// 06
|
||||
// 1 byte: 1110111x
|
||||
// 2 byte: 10xxxxxx
|
||||
// 3 byte: 10xxxxxx
|
||||
// ------------------------------------------------------------
|
||||
else
|
||||
if (
|
||||
(nByteOrg_1 >= 0xEE) &&
|
||||
(nByteOrg_1 <= 0xEF)
|
||||
)
|
||||
{
|
||||
nEncodingType = 6;
|
||||
nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByte_1 = nByteOrg_1-0xEE;
|
||||
nByte_2 = nByteOrg_2-0x80;
|
||||
nByte_3 = nByteOrg_3-0x80;
|
||||
nUTF8 = FileHelper.impl_convertBytesToChar(0,nByte_1, nByte_2, nByte_3);
|
||||
}
|
||||
// ------------------------------------------------------------
|
||||
// 07
|
||||
// 1 byte: 11110000
|
||||
// 2 byte: 1001xxxx
|
||||
// 3 byte: 10xxxxxx
|
||||
// 4 byte: 10xxxxxx
|
||||
// ------------------------------------------------------------
|
||||
else
|
||||
if (nByteOrg_1 == 0xF0)
|
||||
{
|
||||
nEncodingType = 7;
|
||||
nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x90, 0xBF);
|
||||
nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByteOrg_4 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByte_2 = nByteOrg_2-0x90;
|
||||
nByte_3 = nByteOrg_3-0x80;
|
||||
nByte_4 = nByteOrg_4-0x80;
|
||||
nUTF8 = FileHelper.impl_convertBytesToChar(0, nByte_2, nByte_3, nByte_4);
|
||||
}
|
||||
// ------------------------------------------------------------
|
||||
// 08
|
||||
// 1 byte: 111100xx
|
||||
// 2 byte: 10xxxxxx
|
||||
// 3 byte: 10xxxxxx
|
||||
// 3 byte: 10xxxxxx
|
||||
// ------------------------------------------------------------
|
||||
else
|
||||
if (
|
||||
(nByteOrg_1 >= 0xF1) &&
|
||||
(nByteOrg_1 <= 0xF3)
|
||||
)
|
||||
{
|
||||
nEncodingType = 8;
|
||||
nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByteOrg_4 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByte_1 = nByteOrg_1-0xF1;
|
||||
nByte_2 = nByteOrg_2-0x80;
|
||||
nByte_3 = nByteOrg_3-0x80;
|
||||
nByte_4 = nByteOrg_4-0x80;
|
||||
nUTF8 = FileHelper.impl_convertBytesToChar(nByte_1, nByte_2, nByte_3, nByte_4);
|
||||
}
|
||||
// ------------------------------------------------------------
|
||||
// 09
|
||||
// 1 byte: 11110100
|
||||
// 2 byte: 10xxxxxx
|
||||
// 3 byte: 10xxxxxx
|
||||
// 4 byte: 10xxxxxx
|
||||
// ------------------------------------------------------------
|
||||
else
|
||||
if (nByteOrg_1 == 0xF0)
|
||||
{
|
||||
nEncodingType = 9;
|
||||
nByteOrg_2 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByteOrg_3 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByteOrg_4 = FileHelper.impl_readAndCheckNextByte(aBuffer, i++, nReadCount, 0x80, 0xBF);
|
||||
nByte_2 = nByteOrg_2-0x80;
|
||||
nByte_3 = nByteOrg_3-0x80;
|
||||
nByte_4 = nByteOrg_4-0x80;
|
||||
nUTF8 = FileHelper.impl_convertBytesToChar(0, nByte_2, nByte_3, nByte_4);
|
||||
}
|
||||
// wrong encoding ?
|
||||
else
|
||||
{
|
||||
throw new java.lang.Exception("Non well formed UTF-8 encoding.");
|
||||
}
|
||||
|
||||
sBuffer.append(nUTF8);
|
||||
// -> DEBUG !
|
||||
FileHelper.logEncodingData(sLog, nUTF8, nByteOrg_1, nByteOrg_2, nByteOrg_3, nByteOrg_4, nByte_1, nByte_2, nByte_3, nByte_4, nEncodingType);
|
||||
// <- DEBUG !
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch(java.lang.Throwable ex)
|
||||
{
|
||||
// -> DEBUG !
|
||||
FileHelper.logEncodingData(sLog, nUTF8, nByteOrg_1, nByteOrg_2, nByteOrg_3, nByteOrg_4, nByte_1, nByte_2, nByte_3, nByte_4, nEncodingType);
|
||||
|
||||
java.io.File aDir = new java.io.File(aFile.getParent());
|
||||
java.lang.String sDump = aFile.getName();
|
||||
java.io.File aDump = FileHelper.createUniqueFile(aDir, sDump, "dump");
|
||||
FileHelper.writeEncodedBufferToFile(aDump, "UTF-8", false, sLog);
|
||||
// <- DEBUG !
|
||||
|
||||
java.lang.String sMsg = "File '"+aFile.getPath()+"' is not encoded right as UTF-8.";
|
||||
throw new java.io.IOException(sMsg);
|
||||
}
|
||||
|
||||
aByteStream.close();
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** writes the given string buffer into the specified file
|
||||
* using the specified encoding.
|
||||
*
|
||||
* Further it can be set, if the file should be expanded
|
||||
* or replaced by this new string buffer.
|
||||
*
|
||||
* @param aFile
|
||||
* must point to a system file. It can already exist!
|
||||
* e.g.: "c:\temp\test.txt"
|
||||
* "/tmp/test.txt"
|
||||
*
|
||||
* @param sEncoding
|
||||
* will be used to encode the string content inside the file.
|
||||
* e.g.: "UTF8"
|
||||
*
|
||||
* @param bAppend
|
||||
* specify if an already existing file will be
|
||||
* expanded or replaced.
|
||||
*
|
||||
* @param sBuffer
|
||||
* the new string content for this file.
|
||||
*/
|
||||
public static void writeEncodedBufferToFile(java.io.File aFile ,
|
||||
java.lang.String sEncoding,
|
||||
boolean bAppend ,
|
||||
java.lang.StringBuffer sBuffer )
|
||||
throws java.io.IOException
|
||||
{
|
||||
java.io.FileOutputStream aByteStream = new java.io.FileOutputStream(aFile.getAbsolutePath(), bAppend);
|
||||
java.io.OutputStreamWriter aEncodedWriter = new java.io.OutputStreamWriter(aByteStream, sEncoding);
|
||||
|
||||
java.lang.String sTemp = sBuffer.toString();
|
||||
aEncodedWriter.write(sTemp, 0, sTemp.length());
|
||||
|
||||
aEncodedWriter.flush();
|
||||
aEncodedWriter.close();
|
||||
|
||||
if (!aFile.exists())
|
||||
throw new java.io.IOException("File \""+aFile.getAbsolutePath()+"\" not written correctly.");
|
||||
}
|
||||
}
|
|
@ -1,172 +0,0 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* 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: Logger.java,v $
|
||||
* $Revision: 1.8 $
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
package com.sun.star.filter.config.tools.utils;
|
||||
|
||||
|
||||
//_______________________________________________
|
||||
// definition
|
||||
|
||||
/** can be used to print out some debug messages
|
||||
* and group it into warnings/errors or info statements.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class Logger
|
||||
{
|
||||
//___________________________________________
|
||||
// const
|
||||
|
||||
/** only error message will be shown. */
|
||||
public static final int LEVEL_ERRORS = 1;
|
||||
|
||||
/** only errors and warnings will be shown. */
|
||||
public static final int LEVEL_WARNINGS = 2;
|
||||
|
||||
/** enable errors/warnings and some global info
|
||||
* message. */
|
||||
public static final int LEVEL_GLOBALINFOS = 3;
|
||||
|
||||
/** enable anything! */
|
||||
public static final int LEVEL_DETAILEDINFOS = 4;
|
||||
|
||||
//___________________________________________
|
||||
// member
|
||||
|
||||
/** enable/disable different output level.
|
||||
* e.g. warnings/errors/infos */
|
||||
private int m_nLevel;
|
||||
|
||||
//___________________________________________
|
||||
// ctor
|
||||
|
||||
/** initialize new debug object with the specified
|
||||
* debug level.
|
||||
*
|
||||
* @param nLevel
|
||||
* the new debug level.
|
||||
* See const values LEVEL_xxx too.
|
||||
*/
|
||||
public Logger(int nLevel)
|
||||
{
|
||||
m_nLevel = nLevel;
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
// interface
|
||||
|
||||
/** initialize new debug object with a default
|
||||
* debug level.
|
||||
*/
|
||||
public Logger()
|
||||
{
|
||||
m_nLevel = LEVEL_DETAILEDINFOS;
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
// interface
|
||||
|
||||
/** prints out an exception ... if the right level is set.
|
||||
*
|
||||
* @param ex
|
||||
* the exception object
|
||||
*/
|
||||
public synchronized void setException(java.lang.Throwable ex)
|
||||
{
|
||||
if (m_nLevel >= LEVEL_ERRORS)
|
||||
{
|
||||
System.err.println("Exception:\n");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
// interface
|
||||
|
||||
/** prints out an error ... if the right level is set.
|
||||
*
|
||||
* @param sError
|
||||
* the error message.
|
||||
*/
|
||||
public synchronized void setError(java.lang.String sError)
|
||||
{
|
||||
if (m_nLevel >= LEVEL_ERRORS)
|
||||
System.err.println("Error :\t\""+sError+"\"");
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
// interface
|
||||
|
||||
/** prints out a warning ... if the right level is set.
|
||||
*
|
||||
* @param sWarning
|
||||
* the warning message.
|
||||
*/
|
||||
public synchronized void setWarning(java.lang.String sWarning)
|
||||
{
|
||||
if (m_nLevel >= LEVEL_WARNINGS)
|
||||
System.err.println("Warning :\t\""+sWarning+"\"");
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
// interface
|
||||
|
||||
/** prints out a global info message ... if the right level is set.
|
||||
*
|
||||
* Global infos should be used to describe a complex operation.
|
||||
* E.g.: loading of a document.
|
||||
* But not for every sub operation like e.g. analyzing lines
|
||||
* during loading the document!
|
||||
*
|
||||
* @param sInfo
|
||||
* the info message.
|
||||
*/
|
||||
public synchronized void setGlobalInfo(java.lang.String sInfo)
|
||||
{
|
||||
if (m_nLevel >= LEVEL_GLOBALINFOS)
|
||||
System.out.println("Info :\t\""+sInfo+"\"");
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
// interface
|
||||
|
||||
/** prints out a mode detailed info message ... if the right level is set.
|
||||
*
|
||||
* Such detailed message are e.g. "analyze line [n] of file ...".
|
||||
*
|
||||
* @param sInfo
|
||||
* the info message.
|
||||
*/
|
||||
public synchronized void setDetailedInfo(java.lang.String sInfo)
|
||||
{
|
||||
if (m_nLevel >= LEVEL_DETAILEDINFOS)
|
||||
System.out.println("Detail :\t\""+sInfo+"\"");
|
||||
}
|
||||
}
|
|
@ -1,820 +0,0 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* 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: XMLHelper.java,v $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
package com.sun.star.filter.config.tools.utils;
|
||||
|
||||
|
||||
//_______________________________________________
|
||||
|
||||
/**
|
||||
* It provides some constant values and some static helper routines
|
||||
* which are neccessary to work with a xml file - especialy
|
||||
* the filter configuration.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class XMLHelper
|
||||
{
|
||||
//___________________________________________
|
||||
// public const
|
||||
|
||||
/** its a possible value of the xml attribute "oor:type" and identify an integer type. */
|
||||
public static final java.lang.String XMLTYPE_INTEGER = "xs:int";
|
||||
|
||||
/** its a possible value of the xml attribute "oor:type" and identify an boolean type. */
|
||||
public static final java.lang.String XMLTYPE_BOOLEAN = "xs:boolean";
|
||||
|
||||
/** its a possible value of the xml attribute "oor:type" and identify an string type. */
|
||||
public static final java.lang.String XMLTYPE_STRING = "xs:string";
|
||||
|
||||
/** its a possible value of the xml attribute "oor:type" and identify an string list type. */
|
||||
public static final java.lang.String XMLTYPE_STRINGLIST = "oor:string-list";
|
||||
|
||||
/** its a xml attribute, which specify a property name. */
|
||||
public static final java.lang.String XMLATTRIB_OOR_NAME = "oor:name";
|
||||
|
||||
/** its a xml attribute, which specify a property type. */
|
||||
public static final java.lang.String XMLATTRIB_OOR_TYPE = "oor:type";
|
||||
|
||||
/** its a xml attribute, which specify a list separator. */
|
||||
public static final java.lang.String XMLATTRIB_OOR_SEPARATOR = "oor:separator";
|
||||
|
||||
/** its a xml attribute, which specify a localized value. */
|
||||
public static final java.lang.String XMLATTRIB_OOR_LOCALIZED = "oor:localized";
|
||||
|
||||
/** its a xml attribute, which specify a merge operation for cfg layering. */
|
||||
public static final java.lang.String XMLATTRIB_OOR_OP = "oor:op";
|
||||
|
||||
/** can be used as value for XMLATTRIB_OOR_OP. */
|
||||
public static final java.lang.String XMLATTRIB_OP_REPLACE = "replace";
|
||||
|
||||
/** its a xml attribute, which specify a locale value. */
|
||||
public static final java.lang.String XMLATTRIB_XML_LANG = "xml:lang";
|
||||
|
||||
/** its the tag name of a <value ...> entry. */
|
||||
public static final java.lang.String XMLTAG_VALUE = "value";
|
||||
|
||||
/** its the tag name of a <prop ...> entry. */
|
||||
public static final java.lang.String XMLTAG_PROP = "prop";
|
||||
|
||||
/** its the tag name of a <node ...> entry. */
|
||||
public static final java.lang.String XMLTAG_NODE = "node";
|
||||
|
||||
//___________________________________________
|
||||
// private const
|
||||
|
||||
/** a static list of all possible separators, which can be used for configuration type string-list. */
|
||||
private static final java.lang.String[] DELIMS = {" ", ",", ";", ".", ":", "-", "_", "#", "'", "+", "*", "~", "=", "?"};
|
||||
|
||||
/** index of the default separator inside list DELIMS.
|
||||
* Its neccessary to know such default separator; because it can
|
||||
* be supressed as xml attribute of the corresponding value tag. */
|
||||
private static final int DEFAULT_SEPARATOR = 0;
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** analyze the structures of the given XML node and
|
||||
* return a property set of all found sub nodes.
|
||||
*
|
||||
* Such properties are organized as [name, value] pairs.
|
||||
* The type of a xml node will be detected automaticly.
|
||||
* Following types are supported:
|
||||
* xs:int => java.lang.Integer
|
||||
* xs:bool => java.lang.Boolean
|
||||
* xs:string => java.lang.String
|
||||
* oor:string-list => java.util.LinkedList[java.lang.String]
|
||||
* oor:set => java.util.Vector[java.lang.Object]
|
||||
* oor:localized => java.util.HashMap[java.lang.Object]
|
||||
*
|
||||
* @param aNode
|
||||
* points directly to the xml node, where we should analyze
|
||||
* the children nodes.
|
||||
*
|
||||
* @return [java.util.HashMap]
|
||||
* contains every node name as key and its string(!) as value.
|
||||
*/
|
||||
public static java.util.HashMap convertNodeToPropSet(org.w3c.dom.Node aNode)
|
||||
throws java.lang.Exception
|
||||
{
|
||||
java.util.HashMap aPropSet = new java.util.HashMap();
|
||||
|
||||
// get all child nodes, which seems to be properties
|
||||
java.util.Vector lChildNodes = XMLHelper.extractChildNodesByTagName(aNode, XMLTAG_PROP);
|
||||
java.util.Enumeration en1 = lChildNodes.elements();
|
||||
while(en1.hasMoreElements())
|
||||
{
|
||||
org.w3c.dom.Node aChildNode = (org.w3c.dom.Node)en1.nextElement();
|
||||
|
||||
// read its name
|
||||
java.lang.String sChildName = XMLHelper.extractNodeAttribByName(aChildNode, XMLATTRIB_OOR_NAME);
|
||||
if (sChildName == null)
|
||||
throw new java.io.IOException("unsupported format: could not extract child node name");
|
||||
|
||||
// read its type info
|
||||
java.lang.String sChildType = XMLHelper.extractNodeAttribByName(aChildNode, XMLATTRIB_OOR_TYPE);
|
||||
if (sChildType == null)
|
||||
{
|
||||
/** Special patch:
|
||||
* If an xml tag has no type information set ... we can restore it
|
||||
* by analyzing the already readed tag name :-)
|
||||
* Not very nice - but it can help to read stripped xml files too. */
|
||||
sChildType = XMLHelper.getTypeForTag(sChildName);
|
||||
if (sChildType == null)
|
||||
throw new java.io.IOException("unsupported format: could not extract child node type");
|
||||
}
|
||||
|
||||
// read its value(s?)
|
||||
java.util.Vector lChildValues = XMLHelper.extractChildNodesByTagName(aChildNode, XMLTAG_VALUE);
|
||||
java.util.Enumeration en2 = lChildValues.elements();
|
||||
int nValue = 0;
|
||||
java.lang.Object aValue = null;
|
||||
while(en2.hasMoreElements())
|
||||
{
|
||||
org.w3c.dom.Node aValueNode = (org.w3c.dom.Node)en2.nextElement();
|
||||
java.lang.String sChildLocale = XMLHelper.extractNodeAttribByName(aValueNode, XMLATTRIB_XML_LANG);
|
||||
boolean bLocalized = (sChildLocale != null);
|
||||
|
||||
++nValue;
|
||||
|
||||
if (sChildType.equals(XMLTYPE_INTEGER))
|
||||
{
|
||||
if (!bLocalized && nValue > 1)
|
||||
throw new java.io.IOException("unsupported format: more then one value for non localized but atomic type detected");
|
||||
java.lang.String sData = ((org.w3c.dom.CharacterData)aValueNode.getFirstChild()).getData();
|
||||
aValue = new java.lang.Integer(sData);
|
||||
}
|
||||
else
|
||||
if (sChildType.equals(XMLTYPE_BOOLEAN))
|
||||
{
|
||||
if (!bLocalized && nValue > 1)
|
||||
throw new java.io.IOException("unsupported format: more then one value for non localized but atomic type detected");
|
||||
java.lang.String sData = ((org.w3c.dom.CharacterData)aValueNode.getFirstChild()).getData();
|
||||
aValue = new java.lang.Boolean(sData);
|
||||
}
|
||||
else
|
||||
if (sChildType.equals(XMLTYPE_STRING))
|
||||
{
|
||||
if (!bLocalized && nValue > 1)
|
||||
throw new java.io.IOException("unsupported format: more then one value for non localized but atomic type detected");
|
||||
|
||||
java.lang.String sData = ((org.w3c.dom.CharacterData)aValueNode.getFirstChild()).getData();
|
||||
|
||||
java.util.HashMap lLocalized = null;
|
||||
if (bLocalized)
|
||||
{
|
||||
if (aValue == null)
|
||||
aValue = new java.util.HashMap();
|
||||
lLocalized = (java.util.HashMap)aValue;
|
||||
lLocalized.put(sChildLocale, sData);
|
||||
}
|
||||
else
|
||||
aValue = sData;
|
||||
}
|
||||
else
|
||||
if (sChildType.equals(XMLTYPE_STRINGLIST))
|
||||
{
|
||||
if (!bLocalized && nValue > 1)
|
||||
throw new java.io.IOException("unsupported format: more then one value for non localized but atomic type detected");
|
||||
|
||||
java.lang.String sSeparator = XMLHelper.extractNodeAttribByName(aChildNode, XMLATTRIB_OOR_SEPARATOR);
|
||||
if (sSeparator == null)
|
||||
sSeparator = " ";
|
||||
|
||||
java.lang.String sData = ((org.w3c.dom.CharacterData)aValueNode.getFirstChild()).getData();
|
||||
sData = sData.replace('\t', ' ');
|
||||
sData = sData.replace('\n', ' ');
|
||||
java.util.StringTokenizer aTokenizer = new java.util.StringTokenizer(sData, sSeparator);
|
||||
java.util.Vector lList = new java.util.Vector();
|
||||
while(aTokenizer.hasMoreTokens())
|
||||
{
|
||||
java.lang.String sToken = (java.lang.String)aTokenizer.nextToken();
|
||||
sToken.trim();
|
||||
if (sToken.length() < 1)
|
||||
continue;
|
||||
lList.add(sToken);
|
||||
}
|
||||
aValue = lList;
|
||||
}
|
||||
|
||||
aPropSet.put(sChildName, aValue);
|
||||
}
|
||||
}
|
||||
|
||||
return aPropSet;
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
private static java.lang.String getTypeForTag(java.lang.String sTag)
|
||||
{
|
||||
java.lang.String sType = null;
|
||||
|
||||
if (
|
||||
(sTag.equals(Cache.PROPNAME_DATA )) ||
|
||||
(sTag.equals(Cache.PROPNAME_NAME )) ||
|
||||
(sTag.equals(Cache.PROPNAME_UINAME )) ||
|
||||
(sTag.equals(Cache.PROPNAME_MEDIATYPE )) ||
|
||||
(sTag.equals(Cache.PROPNAME_CLIPBOARDFORMAT )) ||
|
||||
(sTag.equals(Cache.PROPNAME_PREFERREDFILTER )) ||
|
||||
(sTag.equals(Cache.PROPNAME_DETECTSERVICE )) ||
|
||||
(sTag.equals(Cache.PROPNAME_FRAMELOADER )) ||
|
||||
(sTag.equals(Cache.PROPNAME_CONTENTHANDLER )) ||
|
||||
(sTag.equals(Cache.PROPNAME_DOCUMENTSERVICE )) ||
|
||||
(sTag.equals(Cache.PROPNAME_FILTERSERVICE )) ||
|
||||
(sTag.equals(Cache.PROPNAME_TEMPLATENAME )) ||
|
||||
(sTag.equals(Cache.PROPNAME_TYPE )) ||
|
||||
(sTag.equals(Cache.PROPNAME_UICOMPONENT ))
|
||||
)
|
||||
sType = XMLTYPE_STRING;
|
||||
else
|
||||
if (
|
||||
(sTag.equals(Cache.PROPNAME_PREFERRED )) ||
|
||||
(sTag.equals("Installed" ))
|
||||
)
|
||||
sType = XMLTYPE_BOOLEAN;
|
||||
else
|
||||
if (
|
||||
(sTag.equals(Cache.PROPNAME_UIORDER )) ||
|
||||
(sTag.equals(Cache.PROPNAME_DOCUMENTICONID )) ||
|
||||
(sTag.equals(Cache.PROPNAME_FILEFORMATVERSION))
|
||||
)
|
||||
sType = XMLTYPE_INTEGER;
|
||||
else
|
||||
if (
|
||||
(sTag.equals(Cache.PROPNAME_URLPATTERN )) ||
|
||||
(sTag.equals(Cache.PROPNAME_EXTENSIONS )) ||
|
||||
(sTag.equals(Cache.PROPNAME_USERDATA )) ||
|
||||
(sTag.equals(Cache.PROPNAME_FLAGS )) ||
|
||||
(sTag.equals(Cache.PROPNAME_TYPES ))
|
||||
)
|
||||
sType = XMLTYPE_STRINGLIST;
|
||||
|
||||
if (sType == null)
|
||||
System.err.println("getTypeForTag("+sTag+") = "+sType);
|
||||
|
||||
return sType;
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** return a xml representation of the given property set.
|
||||
*
|
||||
* @param aPropSet
|
||||
* a set of <name,value> pairs, which should be translated to xml
|
||||
*
|
||||
* @return [java.lang.String]
|
||||
* the xml string representation.
|
||||
*
|
||||
* @throws [java.lang.Exception]
|
||||
* if anything during convertion fill fail.
|
||||
*/
|
||||
public static java.lang.String convertPropSetToXML(java.util.HashMap aPropSet ,
|
||||
int nPrettyTabs)
|
||||
throws java.lang.Exception
|
||||
{
|
||||
java.lang.StringBuffer sXML = new java.lang.StringBuffer(256);
|
||||
|
||||
java.util.Iterator it1 = aPropSet.keySet().iterator();
|
||||
while(it1.hasNext())
|
||||
{
|
||||
java.lang.String sProp = (java.lang.String)it1.next();
|
||||
java.lang.Object aVal = aPropSet.get(sProp);
|
||||
|
||||
sProp = encodeHTMLSigns(sProp);
|
||||
|
||||
// is it a simple type?
|
||||
if (
|
||||
(aVal instanceof java.lang.Integer) ||
|
||||
(aVal instanceof java.lang.Boolean) ||
|
||||
(aVal instanceof java.lang.String )
|
||||
)
|
||||
{
|
||||
sXML.append(XMLHelper.convertSimpleObjectToXML(sProp, aVal, nPrettyTabs));
|
||||
continue;
|
||||
}
|
||||
|
||||
// no!
|
||||
// is it a list value?
|
||||
if (aVal instanceof java.util.Vector)
|
||||
{
|
||||
java.util.Vector lVal = (java.util.Vector)aVal;
|
||||
sXML.append(XMLHelper.convertListToXML(sProp, lVal, nPrettyTabs));
|
||||
continue;
|
||||
}
|
||||
|
||||
// its a localized value?
|
||||
if (aVal instanceof java.util.HashMap)
|
||||
{
|
||||
java.util.HashMap lVal = (java.util.HashMap)aVal;
|
||||
sXML.append(XMLHelper.convertLocalizedValueToXML(sProp, lVal, nPrettyTabs));
|
||||
continue;
|
||||
}
|
||||
|
||||
// unknown type!
|
||||
java.lang.StringBuffer sMsg = new java.lang.StringBuffer(256);
|
||||
sMsg.append("unsupported object type detected.");
|
||||
sMsg.append("\ttype ? : \""+sProp+"\" = "+aVal);
|
||||
sMsg.append("\tprop set: \""+aPropSet );
|
||||
throw new java.lang.Exception(sMsg.toString());
|
||||
}
|
||||
|
||||
return sXML.toString();
|
||||
}
|
||||
|
||||
public static java.lang.String encodeHTMLSigns(java.lang.String sValue)
|
||||
{
|
||||
java.lang.StringBuffer sSource = new java.lang.StringBuffer(sValue);
|
||||
java.lang.StringBuffer sDestination = new java.lang.StringBuffer(1000 );
|
||||
|
||||
for (int i=0; i<sSource.length(); ++i)
|
||||
{
|
||||
char c = sSource.charAt(i);
|
||||
if (c == '&')
|
||||
sDestination.append("&");
|
||||
else
|
||||
sDestination.append(c);
|
||||
}
|
||||
|
||||
java.lang.String sReturn = sDestination.toString();
|
||||
if (!sReturn.equals(sValue))
|
||||
System.out.println("encode \""+sValue+"\" => \""+sReturn+"\"");
|
||||
|
||||
return sReturn;
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** return a xml representation of an atomic property.
|
||||
*
|
||||
* Atomic property types are e.g. Integer, Boolean, String.
|
||||
*
|
||||
* @param sName
|
||||
* the name of the property.
|
||||
|
||||
* @param aValue
|
||||
* the value of the property.
|
||||
*
|
||||
* @param nPrettyTabs
|
||||
* count of tab signs for pretty format the xml code :-)
|
||||
*
|
||||
* @return [java.lang.String]
|
||||
* the xml string representation.
|
||||
*
|
||||
* @throws [java.lang.Exception]
|
||||
* if anything during convertion fill fail.
|
||||
*/
|
||||
private static java.lang.String convertSimpleObjectToXML(java.lang.String sName ,
|
||||
java.lang.Object aValue ,
|
||||
int nPrettyTabs)
|
||||
throws java.lang.Exception
|
||||
{
|
||||
java.lang.StringBuffer sXML = new java.lang.StringBuffer(256);
|
||||
for (int t=0; t<nPrettyTabs; ++t)
|
||||
sXML.append("\t");
|
||||
|
||||
if (aValue instanceof java.lang.Integer)
|
||||
{
|
||||
sXML.append("<prop "+XMLATTRIB_OOR_NAME+"=\""+sName+"\">");
|
||||
sXML.append("<value>"+aValue.toString()+"</value>");
|
||||
sXML.append("</prop>\n");
|
||||
}
|
||||
else
|
||||
if (aValue instanceof java.lang.Boolean)
|
||||
{
|
||||
sXML.append("<prop "+XMLATTRIB_OOR_NAME+"=\""+sName+"\">");
|
||||
sXML.append("<value>"+aValue.toString()+"</value>");
|
||||
sXML.append("</prop>\n");
|
||||
}
|
||||
else
|
||||
if (aValue instanceof java.lang.String)
|
||||
{
|
||||
sXML.append("<prop "+XMLATTRIB_OOR_NAME+"=\""+sName+"\"");
|
||||
java.lang.String sValue = (java.lang.String)aValue;
|
||||
|
||||
sValue = encodeHTMLSigns(sValue);
|
||||
|
||||
if (sValue.length() < 1)
|
||||
sXML.append("/>\n");
|
||||
else
|
||||
{
|
||||
sXML.append("><value>"+sValue+"</value>");
|
||||
sXML.append("</prop>\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("name = "+sName);
|
||||
System.err.println("value = "+aValue);
|
||||
// ! can be used outside to detect - that it was not a simple type :-)
|
||||
throw new java.lang.Exception("not an atomic type.");
|
||||
}
|
||||
|
||||
return sXML.toString();
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** return a xml representation of a string-list property.
|
||||
*
|
||||
* @param sName
|
||||
* the name of the property.
|
||||
|
||||
* @param aValue
|
||||
* the value of the property.
|
||||
*
|
||||
* @param nPrettyTabs
|
||||
* count of tab signs for pretty format the xml code :-)
|
||||
*
|
||||
* @return [java.lang.String]
|
||||
* the xml string representation.
|
||||
*
|
||||
* @throws [java.lang.Exception]
|
||||
* if anything during convertion fill fail.
|
||||
*/
|
||||
private static java.lang.String convertListToXML(java.lang.String sName ,
|
||||
java.util.Vector aValue ,
|
||||
int nPrettyTabs)
|
||||
throws java.lang.Exception
|
||||
{
|
||||
java.lang.StringBuffer sXML = new java.lang.StringBuffer(256);
|
||||
|
||||
for (int t=0; t<nPrettyTabs; ++t)
|
||||
sXML.append("\t");
|
||||
|
||||
int c = aValue.size();
|
||||
if (c < 1)
|
||||
{
|
||||
sXML.append("<prop "+XMLATTRIB_OOR_NAME+"=\""+sName+"\"/>\n");
|
||||
return sXML.toString();
|
||||
}
|
||||
|
||||
// step over all list items and add it to a string buffer
|
||||
// Every item will be separated by a default separator "\n" first.
|
||||
// Because "\n" is not a valid separator at all and can`t occure inside
|
||||
// our list items. During we step over all items, we check if our current separator
|
||||
// (we use a list of possible ones!) clash with an item.
|
||||
// If it clash - we step to the next possible separator.
|
||||
// If our list of possible separator values runs out of range we throw
|
||||
// an exception :-) Its better then generating of wrong values
|
||||
// If we found a valid seperator - we use it to replace our "\n" place holder
|
||||
// at the end of the following loop ...
|
||||
|
||||
int d = 0;
|
||||
java.lang.StringBuffer sValBuff = new java.lang.StringBuffer(256);
|
||||
for (int i=0; i<c; ++i)
|
||||
{
|
||||
// get the next list item
|
||||
java.lang.Object aItem = aValue.get(i);
|
||||
if (!(aItem instanceof java.lang.String))
|
||||
throw new java.lang.Exception("Current implementation supports string-list only!");
|
||||
|
||||
java.lang.String sValue = (java.lang.String)aItem;
|
||||
|
||||
sValue = encodeHTMLSigns(sValue);
|
||||
|
||||
// append item with default separator, which isn a valid separator at all
|
||||
// But supress adding of the separator if last element is reached.
|
||||
sValBuff.append(sValue);
|
||||
if (i<(c-1))
|
||||
sValBuff.append("\n");
|
||||
|
||||
// check for delim clash
|
||||
// Attention: An empty (means default) element forbid using
|
||||
// of a whitespace character as separator!
|
||||
while(true)
|
||||
{
|
||||
if (d >= DELIMS.length)
|
||||
throw new java.lang.Exception("No valid separator found for a string list item.");
|
||||
if (sValue.length() < 1 && DELIMS[d].equals(" "))
|
||||
{
|
||||
++d;
|
||||
continue;
|
||||
}
|
||||
if (sValue.indexOf(DELIMS[d]) != -1)
|
||||
{
|
||||
++d;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// replace default separator with right one
|
||||
System.out.println("TODO: must be adapted to java 1.3 :-(");
|
||||
System.exit(-1);
|
||||
//TODO_JAVA java.lang.String sListVal = sValBuff.toString().replaceAll("\n", DELIMS[d]);
|
||||
java.lang.String sListVal = null;
|
||||
|
||||
sXML.append("<prop "+XMLATTRIB_OOR_NAME+"=\""+sName+"\">");
|
||||
if (d == DEFAULT_SEPARATOR)
|
||||
sXML.append("<value>");
|
||||
else
|
||||
sXML.append("<value "+XMLATTRIB_OOR_SEPARATOR+"=\""+DELIMS[d]+"\">");
|
||||
sXML.append(sListVal);
|
||||
sXML.append("</value>");
|
||||
sXML.append("</prop>\n");
|
||||
|
||||
return sXML.toString();
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** return a xml representation of a localized property.
|
||||
*
|
||||
* @param sName
|
||||
* the name of the property.
|
||||
|
||||
* @param aValue
|
||||
* the value of the property.
|
||||
*
|
||||
* @param nPrettyTabs
|
||||
* count of tab signs for pretty format the xml code :-)
|
||||
*
|
||||
* @return [java.lang.String]
|
||||
* the xml string representation.
|
||||
*
|
||||
* @throws [java.lang.Exception]
|
||||
* if anything during convertion fill fail.
|
||||
*/
|
||||
private static java.lang.String convertLocalizedValueToXML(java.lang.String sName ,
|
||||
java.util.HashMap aValue ,
|
||||
int nPrettyTabs)
|
||||
throws java.lang.Exception
|
||||
{
|
||||
java.lang.StringBuffer sXML = new java.lang.StringBuffer(256);
|
||||
|
||||
int c = aValue.size();
|
||||
if (c < 1)
|
||||
throw new java.lang.Exception("Cant detect type of localized values. Because the given list is empty.");
|
||||
|
||||
for (int t=0; t<nPrettyTabs; ++t)
|
||||
sXML.append("\t");
|
||||
// !Our localized values must be formated at a deeper coloum
|
||||
// then its property name!
|
||||
++nPrettyTabs;
|
||||
|
||||
sXML.append("<prop "+XMLATTRIB_OOR_NAME+"=\""+sName+"\">\n");
|
||||
java.util.Iterator it = aValue.keySet().iterator();
|
||||
// boolean bTypeKnown = false;
|
||||
while(it.hasNext())
|
||||
{
|
||||
java.lang.String sLocale = (java.lang.String)it.next();
|
||||
java.lang.Object aLocalizedValue = aValue.get(sLocale);
|
||||
/*
|
||||
if (!bTypeKnown)
|
||||
{
|
||||
bTypeKnown = true;
|
||||
if (aLocalizedValue instanceof java.lang.Integer)
|
||||
sXML.append(" "+XMLATTRIB_OOR_TYPE+"=\""+XMLTYPE_INTEGER+"\">\n");
|
||||
else
|
||||
if (aLocalizedValue instanceof java.lang.Boolean)
|
||||
sXML.append(" "+XMLATTRIB_OOR_TYPE+"=\""+XMLTYPE_BOOLEAN+"\">\n");
|
||||
else
|
||||
if (aLocalizedValue instanceof java.lang.String)
|
||||
sXML.append(" "+XMLATTRIB_OOR_TYPE+"=\""+XMLTYPE_STRING+"\">\n");
|
||||
else
|
||||
throw new java.lang.Exception("Unsupported type for localized value detected.");
|
||||
}
|
||||
*/
|
||||
java.lang.String sLocValue = aLocalizedValue.toString();
|
||||
java.lang.String sValue = encodeHTMLSigns(sLocValue);
|
||||
|
||||
for (int t=0; t<nPrettyTabs; ++t)
|
||||
sXML.append("\t");
|
||||
sXML.append("<value "+XMLATTRIB_XML_LANG+"=\""+sLocale+"\">"+sValue+"</value>\n");
|
||||
}
|
||||
--nPrettyTabs;
|
||||
for (int t=0; t<nPrettyTabs; ++t)
|
||||
sXML.append("\t");
|
||||
sXML.append("</prop>\n");
|
||||
|
||||
return sXML.toString();
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** returns the value of an attribute of the given node.
|
||||
*
|
||||
* If the given node represent an lement node, may it supports some attributes.
|
||||
* Then this method search for an attribute with the specified name and return it's value.
|
||||
* If nothing could be found ... or the given node isn't a suitable node ... it returns null.
|
||||
*
|
||||
* @param aNode
|
||||
* the node, which should be analyzed.
|
||||
*
|
||||
* @param sAttrib
|
||||
* name of the attribute, which should be searched.
|
||||
*
|
||||
* @return The value of the specified attribute if it could be found at the given node.
|
||||
* Can be null if node doesn't support attributes or the searched one does not exist there.
|
||||
*/
|
||||
public static java.lang.String extractNodeAttribByName(org.w3c.dom.Node aNode ,
|
||||
java.lang.String sAttrib)
|
||||
throws java.lang.Exception
|
||||
{
|
||||
// We can get valid attributes for element nodes only!
|
||||
if (aNode.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE)
|
||||
{
|
||||
// System.err.println("not an element node");
|
||||
return null;
|
||||
}
|
||||
|
||||
// may it supports attributes in general ... but doesn't have anyone realy.
|
||||
org.w3c.dom.NamedNodeMap lAttribs = aNode.getAttributes();
|
||||
if (lAttribs==null)
|
||||
{
|
||||
// System.err.println("no attributes at all");
|
||||
return null;
|
||||
}
|
||||
|
||||
// step over the attribute list and search for the requested one
|
||||
for (int i=0; i<lAttribs.getLength(); ++i)
|
||||
{
|
||||
org.w3c.dom.Attr aAttrib = (org.w3c.dom.Attr)lAttribs.item(i);
|
||||
if (aAttrib.getName().equals(sAttrib))
|
||||
{
|
||||
java.lang.String sValue = aAttrib.getValue();
|
||||
return sValue;
|
||||
}
|
||||
}
|
||||
|
||||
// the searched attribute was not found!
|
||||
// System.err.println("required attribute \""+sAttrib+"\" does not exist for node ["+aNode.toString()+"]");
|
||||
return null;
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** returns a list of childs, which are ELEMENT_NODES and have the right tag name.
|
||||
*
|
||||
* It analyze the list of all possible child nodes. Only ELEMENT_NODES are candidates.
|
||||
* All other ones will be ignored. Further these element nodes are compared by it's tag
|
||||
* names. If it match with the specified value it's added to the return list.
|
||||
* So the return list includes references to the DOM tree nodes only, which are child
|
||||
* element nodes with the right tag name.
|
||||
*
|
||||
* @param aNode
|
||||
* provides access to the child nodes, which should be analyzed
|
||||
*
|
||||
* @param sTag
|
||||
* the searched tag name.
|
||||
*
|
||||
* @return A list of child nodes, which are element nodes and have the right tag name.
|
||||
*/
|
||||
public static java.util.Vector extractChildNodesByTagName(org.w3c.dom.Node aNode,
|
||||
java.lang.String sTag )
|
||||
{
|
||||
// extract first all ELEMENT_NODES of he given parent
|
||||
// Such nodes only provide tag names.
|
||||
java.util.Vector lChilds = XMLHelper.extractChildNodesByType(aNode,org.w3c.dom.Node.ELEMENT_NODE);
|
||||
java.util.Vector lExtractedChilds = new java.util.Vector(lChilds.size());
|
||||
|
||||
// step over the list and search for the right tags using the specified name
|
||||
java.util.Enumeration en = lChilds.elements();
|
||||
while (en.hasMoreElements())
|
||||
{
|
||||
org.w3c.dom.Node aChild = (org.w3c.dom.Node)en.nextElement();
|
||||
if (aChild.getNodeName().equals(sTag))
|
||||
lExtractedChilds.add(aChild);
|
||||
}
|
||||
|
||||
// pack(!) and return the list
|
||||
lExtractedChilds.trimToSize();
|
||||
return lExtractedChilds;
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** returns a list of childs, which supports the right node type.
|
||||
*
|
||||
* It analyze the list of all possible child nodes. If a node represent the right node type
|
||||
* it is added to the return list. Otherwhise it will be ignored.
|
||||
*
|
||||
* @param aNode
|
||||
* provides access to the list of possible children nodes.
|
||||
*
|
||||
* @param nType
|
||||
* represent the searched node type.
|
||||
* Possible values are constant fields of a org.w3c.dom.Node - e.g. org.w3c.dom.Node.ELEMENT_NODE.
|
||||
*
|
||||
* @return A list of child nodes, which provides the right node type.
|
||||
*/
|
||||
public static java.util.Vector extractChildNodesByType(org.w3c.dom.Node aNode,
|
||||
short nType)
|
||||
{
|
||||
// get list of all possibe childs and reserve enough space for our return list
|
||||
// Attention: A null pointer is not allowed for return! (means lExtractedChilds)
|
||||
org.w3c.dom.NodeList lChilds = aNode.getChildNodes();
|
||||
int c = lChilds.getLength();
|
||||
java.util.Vector lExtractedChilds = new java.util.Vector(c);
|
||||
|
||||
// step of these childs and select only needed ones
|
||||
for (int i=0; i<c; ++i)
|
||||
{
|
||||
org.w3c.dom.Node aChild = lChilds.item(i);
|
||||
if (aChild.getNodeType() == nType)
|
||||
lExtractedChilds.add(aChild);
|
||||
}
|
||||
|
||||
// pack(!) and return the list
|
||||
lExtractedChilds.trimToSize();
|
||||
return lExtractedChilds;
|
||||
}
|
||||
|
||||
//___________________________________________
|
||||
|
||||
/** generates an xml header, using parameters.
|
||||
*
|
||||
* @param sVersion
|
||||
* number of the xml version.
|
||||
*
|
||||
* @param sEncoding
|
||||
* used file encoding.
|
||||
*
|
||||
* @param sPath
|
||||
* name of the configuration root.
|
||||
*
|
||||
* @param sPackage
|
||||
* name of the configuration package.
|
||||
*
|
||||
* @param bLanguagepack
|
||||
* force creation of a special header,
|
||||
* which is needed for language packs only.
|
||||
*
|
||||
* @return [java.lang.String]
|
||||
* the generated xml header.
|
||||
|
||||
*/
|
||||
public static java.lang.String generateHeader(java.lang.String sVersion ,
|
||||
java.lang.String sEncoding ,
|
||||
java.lang.String sPath ,
|
||||
java.lang.String sPackage ,
|
||||
boolean bLanguagePack)
|
||||
{
|
||||
java.lang.StringBuffer sHeader = new java.lang.StringBuffer(256);
|
||||
|
||||
if (bLanguagePack)
|
||||
{
|
||||
sHeader.append("<?xml version=\"");
|
||||
sHeader.append(sVersion);
|
||||
sHeader.append("\" encoding=\"");
|
||||
sHeader.append(sEncoding);
|
||||
sHeader.append("\"?>\n");
|
||||
sHeader.append("<oor:component-data oor:package=\"");
|
||||
sHeader.append(sPath);
|
||||
sHeader.append("\" oor:name=\"");
|
||||
sHeader.append(sPackage);
|
||||
sHeader.append("\" xmlns:install=\"http://openoffice.org/2004/installation\"");
|
||||
sHeader.append(" xmlns:oor=\"http://openoffice.org/2001/registry\"");
|
||||
sHeader.append(" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"");
|
||||
sHeader.append(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
sHeader.append("<?xml version=\"");
|
||||
sHeader.append(sVersion);
|
||||
sHeader.append("\" encoding=\"");
|
||||
sHeader.append(sEncoding);
|
||||
sHeader.append("\"?>\n<!DOCTYPE oor:component-data SYSTEM \"../../../../component-update.dtd\">\n");
|
||||
sHeader.append("<oor:component-data xmlns:oor=\"http://openoffice.org/2001/registry\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" oor:package=\"");
|
||||
sHeader.append(sPath);
|
||||
sHeader.append("\" oor:name=\"");
|
||||
sHeader.append(sPackage);
|
||||
sHeader.append("\">\n");
|
||||
}
|
||||
|
||||
return sHeader.toString();
|
||||
}
|
||||
|
||||
public static java.lang.String generateFooter()
|
||||
{
|
||||
return "</oor:component-data>\n";
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
#*************************************************************************
|
||||
#
|
||||
# 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: makefile.mk,v $
|
||||
#
|
||||
# $Revision: 1.9.98.2 $
|
||||
#
|
||||
# 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 = ..$/..$/..$/..
|
||||
TARGET = FCFGUtils
|
||||
PRJNAME = filter
|
||||
PACKAGE = com$/sun$/star$/filter$/config$/tools$/utils
|
||||
|
||||
# --- Settings -----------------------------------------------------
|
||||
|
||||
.INCLUDE: settings.mk
|
||||
|
||||
#----- compile .java files -----------------------------------------
|
||||
|
||||
JARFILES = \
|
||||
ridl.jar \
|
||||
unoil.jar \
|
||||
jurt.jar \
|
||||
juh.jar \
|
||||
java_uno.jar
|
||||
|
||||
JAVACLASSFILES = \
|
||||
$(CLASSDIR)$/$(PACKAGE)$/AnalyzeStartupLog.class \
|
||||
$(CLASSDIR)$/$(PACKAGE)$/ConfigHelper.class \
|
||||
$(CLASSDIR)$/$(PACKAGE)$/Logger.class \
|
||||
$(CLASSDIR)$/$(PACKAGE)$/FileHelper.class \
|
||||
$(CLASSDIR)$/$(PACKAGE)$/MalformedCommandLineException.class \
|
||||
$(CLASSDIR)$/$(PACKAGE)$/Cache.class \
|
||||
$(CLASSDIR)$/$(PACKAGE)$/XMLHelper.class
|
||||
|
||||
MAXLINELENGTH = 100000
|
||||
|
||||
# --- targets -----------------------------------------------------
|
||||
|
||||
.INCLUDE : target.mk
|
|
@ -1436,8 +1436,8 @@ ImplErrorDialog::ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& r
|
|||
|
||||
{
|
||||
// load images
|
||||
Image aWarnImg( BitmapEx( ResId( IMG_WARN, rResMgr ) ) );
|
||||
Image aErrImg( BitmapEx( ResId( IMG_ERR, rResMgr ) ) );
|
||||
Image aWarnImg = Image ( BitmapEx( ResId( IMG_WARN, rResMgr ) ) );
|
||||
Image aErrImg= Image ( BitmapEx( ResId( IMG_ERR, rResMgr ) ) );
|
||||
|
||||
for( std::set<vcl::PDFWriter::ErrorCode>::const_iterator it = rErrors.begin();
|
||||
it != rErrors.end(); ++it )
|
||||
|
|
|
@ -208,7 +208,7 @@ TabPage RID_PDF_TAB_GENER
|
|||
Pos = MAP_APPFONT ( 12 , 193 ) ;
|
||||
Size = MAP_APPFONT ( 158 , 10 ) ;
|
||||
TabStop = TRUE ;
|
||||
Text[ en-US ] = "~Export notes";
|
||||
Text[ en-US ] = "~Export comments";
|
||||
};
|
||||
CheckBox CB_EXPORTEMPTYPAGES
|
||||
{
|
||||
|
@ -503,7 +503,7 @@ TabPage RID_PDF_TAB_SECURITY
|
|||
TabStop = TRUE ;
|
||||
Disable = TRUE ;
|
||||
Pos = MAP_APPFONT ( 12, 5 ) ;
|
||||
Size = MAP_APPFONT ( 100 , 13 ) ;
|
||||
Size = MAP_APPFONT ( 120 , 13 ) ;
|
||||
Text[ en-US ] = "Set ~open password...";
|
||||
};
|
||||
|
||||
|
@ -538,7 +538,7 @@ TabPage RID_PDF_TAB_SECURITY
|
|||
TabStop = TRUE ;
|
||||
Disable = TRUE ;
|
||||
Pos = MAP_APPFONT ( 12, 45 ) ;
|
||||
Size = MAP_APPFONT ( 100 , 13 ) ;
|
||||
Size = MAP_APPFONT ( 120 , 13 ) ;
|
||||
Text[ en-US ] = "Set ~permission password...";
|
||||
};
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ Reference< XInterface > SAL_CALL PDFDialog_createInstance( const Reference< XMul
|
|||
// - PDFDialog -
|
||||
// -------------
|
||||
|
||||
PDFDialog::PDFDialog( const Reference< XMultiServiceFactory > &rxMSF ) :
|
||||
OGenericUnoDialog( rxMSF )
|
||||
PDFDialog::PDFDialog( const Reference< XMultiServiceFactory > &rxMSF )
|
||||
: PDFDialog_Base( rxMSF )
|
||||
{
|
||||
ByteString aResMgrName( "pdffilter" );
|
||||
|
||||
|
@ -114,37 +114,6 @@ PDFDialog::~PDFDialog()
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Any SAL_CALL PDFDialog::queryInterface( const Type& rType )
|
||||
throw (RuntimeException)
|
||||
{
|
||||
Any aReturn = OGenericUnoDialog::queryInterface( rType );
|
||||
|
||||
if( !aReturn.hasValue() )
|
||||
aReturn = ::cppu::queryInterface( rType,
|
||||
static_cast< XPropertyAccess* >( this ),
|
||||
static_cast< XExporter* >( this ) );
|
||||
|
||||
return aReturn;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL PDFDialog::acquire()
|
||||
throw ()
|
||||
{
|
||||
OWeakObject::acquire();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL PDFDialog::release()
|
||||
throw ()
|
||||
{
|
||||
OWeakObject::release();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Sequence< sal_Int8 > SAL_CALL PDFDialog::getImplementationId()
|
||||
throw(RuntimeException)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include "pdffilter.hxx"
|
||||
#include <svtools/genericunodialog.hxx>
|
||||
|
||||
#include <cppuhelper/implbase2.hxx>
|
||||
|
||||
// -------------
|
||||
// - PDFDialog -
|
||||
// -------------
|
||||
|
@ -41,10 +43,15 @@
|
|||
class Window;
|
||||
class ResMgr;
|
||||
|
||||
class PDFDialog : public ::svt::OGenericUnoDialog,
|
||||
public ::comphelper::OPropertyArrayUsageHelper< PDFDialog >,
|
||||
public XPropertyAccess,
|
||||
public XExporter
|
||||
typedef ::svt::OGenericUnoDialog PDFDialog_DialogBase;
|
||||
typedef ::cppu::ImplInheritanceHelper2 <
|
||||
PDFDialog_DialogBase,
|
||||
XPropertyAccess,
|
||||
XExporter
|
||||
> PDFDialog_Base;
|
||||
|
||||
class PDFDialog : public PDFDialog_Base,
|
||||
public ::comphelper::OPropertyArrayUsageHelper< PDFDialog >
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -54,12 +61,6 @@ private:
|
|||
Reference< XComponent > mxSrcDoc;
|
||||
|
||||
protected:
|
||||
|
||||
// XInterface
|
||||
virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException);
|
||||
virtual void SAL_CALL acquire() throw ();
|
||||
virtual void SAL_CALL release() throw ();
|
||||
|
||||
// OGenericUnoDialog
|
||||
virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException);
|
||||
virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
|
||||
|
|
|
@ -1059,7 +1059,6 @@ sal_Bool PDFExport::ImplWriteActions( PDFWriter& rWriter, PDFExtOutDevData* pPDF
|
|||
|
||||
GDIMetaFile aMtf;
|
||||
bool bTransparenciesRemoved = false;
|
||||
#if 0
|
||||
if( mbRemoveTransparencies )
|
||||
{
|
||||
bTransparenciesRemoved = rWriter.GetReferenceDevice()->
|
||||
|
@ -1067,7 +1066,6 @@ sal_Bool PDFExport::ImplWriteActions( PDFWriter& rWriter, PDFExtOutDevData* pPDF
|
|||
false, true, mbReduceImageResolution );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
aMtf = rInMtf;
|
||||
}
|
||||
|
|
|
@ -35,15 +35,15 @@
|
|||
#include <com/sun/star/frame/XConfigManager.hpp>
|
||||
#include <com/sun/star/io/XInputStream.hpp>
|
||||
#include <com/sun/star/io/XActiveDataSink.hpp>
|
||||
#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
#endif
|
||||
#include <com/sun/star/beans/NamedValue.hpp>
|
||||
#include <com/sun/star/container/XNamed.hpp>
|
||||
#include <com/sun/star/container/XChild.hpp>
|
||||
#include <com/sun/star/util/XChangesBatch.hpp>
|
||||
|
||||
|
||||
#include <comphelper/oslfile2streamwrap.hxx>
|
||||
#include <comphelper/storagehelper.hxx>
|
||||
#include <unotools/streamwrap.hxx>
|
||||
#include <tools/stream.hxx>
|
||||
#include <tools/urlobj.hxx>
|
||||
|
@ -62,6 +62,7 @@
|
|||
using namespace rtl;
|
||||
using namespace osl;
|
||||
using namespace comphelper;
|
||||
using namespace com::sun::star;
|
||||
using namespace com::sun::star::lang;
|
||||
using namespace com::sun::star::frame;
|
||||
using namespace com::sun::star::uno;
|
||||
|
@ -173,9 +174,15 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const XMLFilt
|
|||
|
||||
// create the package jar file
|
||||
|
||||
Sequence< Any > aArguments( 1 );
|
||||
Sequence< Any > aArguments( 2 );
|
||||
aArguments[ 0 ] <<= rPackageURL;
|
||||
|
||||
// let ZipPackage be used ( no manifest.xml is required )
|
||||
beans::NamedValue aArg;
|
||||
aArg.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) );
|
||||
aArg.Value <<= ZIP_STORAGE_FORMAT_STRING;
|
||||
aArguments[ 1 ] <<= aArg;
|
||||
|
||||
Reference< XHierarchicalNameAccess > xIfc(
|
||||
mxMSF->createInstanceWithArguments(
|
||||
rtl::OUString::createFromAscii(
|
||||
|
@ -270,9 +277,15 @@ void XMLFilterJarHelper::openPackage( const OUString& rPackageURL, XMLFilterVect
|
|||
{
|
||||
// create the package jar file
|
||||
|
||||
Sequence< Any > aArguments( 1 );
|
||||
Sequence< Any > aArguments( 2 );
|
||||
aArguments[ 0 ] <<= rPackageURL;
|
||||
|
||||
// let ZipPackage be used ( no manifest.xml is required )
|
||||
beans::NamedValue aArg;
|
||||
aArg.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) );
|
||||
aArg.Value <<= ZIP_STORAGE_FORMAT_STRING;
|
||||
aArguments[ 1 ] <<= aArg;
|
||||
|
||||
Reference< XHierarchicalNameAccess > xIfc(
|
||||
mxMSF->createInstanceWithArguments(
|
||||
rtl::OUString::createFromAscii(
|
||||
|
|
|
@ -34,11 +34,26 @@
|
|||
#include <rtl/cipher.h>
|
||||
#include <rtl/digest.h>
|
||||
|
||||
namespace oox { class AttributeList; }
|
||||
|
||||
namespace oox {
|
||||
namespace core {
|
||||
|
||||
// ============================================================================
|
||||
|
||||
class CodecHelper
|
||||
{
|
||||
public:
|
||||
/** Returns the password hash if it is in the required 16-bit limit. */
|
||||
static sal_uInt16 getPasswordHash( const AttributeList& rAttribs, sal_Int32 nElement );
|
||||
|
||||
private:
|
||||
CodecHelper();
|
||||
~CodecHelper();
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
/** Encodes and decodes data from/to protected MS Office documents.
|
||||
|
||||
Implements a simple XOR encoding/decoding algorithm used in MS Office
|
||||
|
@ -182,12 +197,12 @@ public:
|
|||
@param pnPassData
|
||||
Unicode character array containing the password. Must be zero
|
||||
terminated, which results in a maximum length of 15 characters.
|
||||
@param pnUnique
|
||||
Unique document identifier read from or written to the file.
|
||||
@param pnSalt
|
||||
Random salt data block read from or written to the file.
|
||||
*/
|
||||
void initKey(
|
||||
const sal_uInt16 pnPassData[ 16 ],
|
||||
const sal_uInt8 pnUnique[ 16 ] );
|
||||
const sal_uInt8 pnSalt[ 16 ] );
|
||||
|
||||
/** Verifies the validity of the password using the passed salt data.
|
||||
|
||||
|
@ -195,17 +210,17 @@ public:
|
|||
The codec must be initialized with the initKey() function before
|
||||
this function can be used.
|
||||
|
||||
@param pnSaltData
|
||||
Salt data block read from the file.
|
||||
@param pnSaltDigest
|
||||
Salt digest read from the file.
|
||||
@param pnVerifier
|
||||
Verifier block read from the file.
|
||||
@param pnVerifierHash
|
||||
Verifier hash read from the file.
|
||||
|
||||
@return
|
||||
True = test was successful.
|
||||
*/
|
||||
bool verifyKey(
|
||||
const sal_uInt8 pnSaltData[ 16 ],
|
||||
const sal_uInt8 pnSaltDigest[ 16 ] );
|
||||
const sal_uInt8 pnVerifier[ 16 ],
|
||||
const sal_uInt8 pnVerifierHash[ 16 ] );
|
||||
|
||||
/** Rekeys the codec using the specified counter.
|
||||
|
||||
|
|
|
@ -49,8 +49,9 @@ public:
|
|||
|
||||
private:
|
||||
virtual StorageRef implCreateStorage(
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const;
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream ) const;
|
||||
virtual StorageRef implCreateStorage(
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const;
|
||||
};
|
||||
|
||||
typedef ::rtl::Reference< BinaryFilterBase > BinaryFilterRef;
|
||||
|
|
|
@ -28,27 +28,41 @@
|
|||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef OOX_FASTTOKENHANDLER_HXX
|
||||
#define OOX_FASTTOKENHANDLER_HXX
|
||||
#ifndef OOX_CORE_FASTTOKENHANDLER_HXX
|
||||
#define OOX_CORE_FASTTOKENHANDLER_HXX
|
||||
|
||||
#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
|
||||
#include <cppuhelper/implbase1.hxx>
|
||||
|
||||
namespace oox {
|
||||
namespace oox { class TokenMap; }
|
||||
|
||||
namespace oox {
|
||||
namespace core {
|
||||
|
||||
// ============================================================================
|
||||
|
||||
/** Wrapper implementing the com.sun.star.xml.sax.XFastTokenHandler API interface
|
||||
that provides access to the tokens generated from the internal token name list.
|
||||
*/
|
||||
class FastTokenHandler : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastTokenHandler >
|
||||
{
|
||||
public:
|
||||
explicit FastTokenHandler();
|
||||
virtual ~FastTokenHandler();
|
||||
|
||||
virtual ::sal_Int32 SAL_CALL getToken( const ::rtl::OUString& Identifier ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::rtl::OUString SAL_CALL getIdentifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getUTF8Identifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::sal_Int32 SAL_CALL getTokenFromUTF8( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& Identifier ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Int32 SAL_CALL getToken( const ::rtl::OUString& rIdentifier ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::rtl::OUString SAL_CALL getIdentifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException);
|
||||
virtual sal_Int32 SAL_CALL getTokenFromUTF8( const ::com::sun::star::uno::Sequence< sal_Int8 >& Identifier ) throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
private:
|
||||
const TokenMap& mrTokenMap; /// Reference to global token map singleton.
|
||||
};
|
||||
|
||||
}
|
||||
// ============================================================================
|
||||
|
||||
} // namespace core
|
||||
} // namespace oox
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include <cppuhelper/implbase5.hxx>
|
||||
#include "oox/helper/binarystreambase.hxx"
|
||||
#include "oox/helper/storagebase.hxx"
|
||||
#include <oox/dllapi.h>
|
||||
#include "oox/dllapi.h"
|
||||
|
||||
namespace com { namespace sun { namespace star {
|
||||
namespace lang { class XMultiServiceFactory; }
|
||||
|
@ -58,6 +58,11 @@ namespace com { namespace sun { namespace star {
|
|||
namespace graphic { class XGraphic; }
|
||||
} } }
|
||||
|
||||
namespace comphelper {
|
||||
class IDocPasswordVerifier;
|
||||
class MediaDescriptor;
|
||||
}
|
||||
|
||||
namespace oox {
|
||||
class GraphicHelper;
|
||||
class ModelObjectHelper;
|
||||
|
@ -110,6 +115,9 @@ public:
|
|||
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
|
||||
getGlobalFactory() const;
|
||||
|
||||
/** Returns the media descriptor. */
|
||||
::comphelper::MediaDescriptor& getMediaDescriptor() const;
|
||||
|
||||
/** Returns the document model (always existing). */
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >&
|
||||
getModel() const;
|
||||
|
@ -190,8 +198,17 @@ public:
|
|||
sal_Int32 convertScreenPixelX( double fPixelX ) const;
|
||||
/** Converts the passed value from vertical screen pixels to 1/100 mm. */
|
||||
sal_Int32 convertScreenPixelY( double fPixelY ) const;
|
||||
|
||||
/** Returns a system color specified by the passed XML token identifier. */
|
||||
sal_Int32 getSystemColor( sal_Int32 nToken, sal_Int32 nDefaultRgb = -1 ) const;
|
||||
sal_Int32 getSystemColor( sal_Int32 nToken, sal_Int32 nDefaultRgb = API_RGB_TRANSPARENT ) const;
|
||||
/** Derived classes may implement to resolve a scheme color from the passed XML token identifier. */
|
||||
virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
|
||||
/** Derived classes may implement to resolve a palette index to an RGB color. */
|
||||
virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const;
|
||||
|
||||
/** Requests a password from the media descriptor or from the user. On
|
||||
success, the password will be inserted into the media descriptor. */
|
||||
::rtl::OUString requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const;
|
||||
|
||||
/** Imports the raw binary data from the specified stream.
|
||||
@return True, if the data could be imported from the stream. */
|
||||
|
@ -251,19 +268,29 @@ public:
|
|||
// com.sun.star.document.XFilter interface --------------------------------
|
||||
|
||||
virtual sal_Bool SAL_CALL filter(
|
||||
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rDescriptor )
|
||||
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq )
|
||||
throw( ::com::sun::star::uno::RuntimeException );
|
||||
|
||||
virtual void SAL_CALL cancel()
|
||||
throw( ::com::sun::star::uno::RuntimeException );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
|
||||
implGetInputStream( ::comphelper::MediaDescriptor& rMediaDesc ) const;
|
||||
virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >
|
||||
implGetOutputStream( ::comphelper::MediaDescriptor& rMediaDesc ) const;
|
||||
|
||||
private:
|
||||
void setMediaDescriptor(
|
||||
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq );
|
||||
|
||||
virtual ::rtl::OUString implGetImplementationName() const = 0;
|
||||
|
||||
virtual StorageRef implCreateStorage(
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const = 0;
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream ) const = 0;
|
||||
virtual StorageRef implCreateStorage(
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const = 0;
|
||||
|
||||
private:
|
||||
::std::auto_ptr< FilterBaseImpl > mxImpl;
|
||||
|
|
168
oox/inc/oox/core/filterdetect.hxx
Normal file
168
oox/inc/oox/core/filterdetect.hxx
Normal file
|
@ -0,0 +1,168 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* 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: filterdetect.hxx,v $
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* 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 OOX_CORE_FILTERDETECT_HXX
|
||||
#define OOX_CORE_FILTERDETECT_HXX
|
||||
|
||||
#include <vector>
|
||||
#include <com/sun/star/document/XExtendedFilterDetection.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
|
||||
#include <cppuhelper/implbase1.hxx>
|
||||
#include <cppuhelper/implbase2.hxx>
|
||||
#include "oox/dllapi.h"
|
||||
|
||||
namespace com { namespace sun { namespace star {
|
||||
namespace io { class XInputStream; }
|
||||
} } }
|
||||
|
||||
namespace comphelper { class MediaDescriptor; }
|
||||
namespace oox { class AttributeList; }
|
||||
|
||||
namespace oox {
|
||||
namespace core {
|
||||
|
||||
// ============================================================================
|
||||
|
||||
/** Document handler specifically designed for detecting OOXML file formats.
|
||||
|
||||
It takes a reference to the filter string object via its constructor, and
|
||||
puts the name of the detected filter to it, if it successfully finds one.
|
||||
*/
|
||||
class FilterDetectDocHandler : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastDocumentHandler >
|
||||
{
|
||||
public:
|
||||
explicit FilterDetectDocHandler( ::rtl::OUString& rFilter );
|
||||
virtual ~FilterDetectDocHandler();
|
||||
|
||||
// XFastDocumentHandler
|
||||
virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
|
||||
|
||||
// XFastContextHandler
|
||||
virtual void SAL_CALL startFastElement( sal_Int32 nElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL startUnknownElement( const ::rtl::OUString& Namespace, const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL endFastElement( sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL endUnknownElement( const ::rtl::OUString& Namespace, const ::rtl::OUString& Name ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual ::com::sun::star::uno::Reference< XFastContextHandler > SAL_CALL createUnknownChildContext( const ::rtl::OUString& Namespace, const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
|
||||
virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
|
||||
|
||||
private:
|
||||
void parseRelationship( const AttributeList& rAttribs );
|
||||
|
||||
::rtl::OUString getFilterNameFromContentType( const ::rtl::OUString& rContentType ) const;
|
||||
void parseContentTypesDefault( const AttributeList& rAttribs );
|
||||
void parseContentTypesOverride( const AttributeList& rAttribs );
|
||||
|
||||
private:
|
||||
typedef ::std::vector< sal_Int32 > ContextVector;
|
||||
|
||||
::rtl::OUString& mrFilterName;
|
||||
ContextVector maContextStack;
|
||||
::rtl::OUString maTargetPath;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
class OOX_DLLPUBLIC FilterDetect : public ::cppu::WeakImplHelper2< ::com::sun::star::document::XExtendedFilterDetection, ::com::sun::star::lang::XServiceInfo >
|
||||
{
|
||||
public:
|
||||
explicit FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory );
|
||||
virtual ~FilterDetect();
|
||||
|
||||
/** Tries to extract an unencrypted ZIP package from the passed media
|
||||
descriptor.
|
||||
|
||||
First, this function checks if the input stream provided by the media
|
||||
descriptor property 'InputStream' contains a ZIP package. If yes, this
|
||||
stream is returned.
|
||||
|
||||
Second, this function checks if the 'ComponentData' property exists and
|
||||
contains a sequence of com.sun.star.beans.NamedValue. If yes, a named
|
||||
value is searched with the name 'DecryptedPackage' and a value of type
|
||||
com.sun.star.io.XStream. If the input stream provided by this XStream
|
||||
contains a ZIP package, this input stream is returned.
|
||||
|
||||
Third, this function checks if the input stream of the media descriptor
|
||||
contains an OLE package. If yes, it checks the existence of the streams
|
||||
'EncryptionInfo' and 'EncyptedPackage' and tries to decrypt the package
|
||||
into a temporary file. This may include requesting a password from the
|
||||
media descriptor property 'Password' or from the user, using the
|
||||
interaction handler provided by the descriptor. On success, and if the
|
||||
decrypted package is a ZIP package, the XStream of the temporary file
|
||||
is stored in the property 'ComponentData' of the media descriptor and
|
||||
its input stream is returned.
|
||||
*/
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
|
||||
extractUnencryptedPackage( ::comphelper::MediaDescriptor& rMediaDesc ) const;
|
||||
|
||||
// com.sun.star.lang.XServiceInfo interface -------------------------------
|
||||
|
||||
virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
|
||||
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw( ::com::sun::star::uno::RuntimeException );
|
||||
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
|
||||
|
||||
// com.sun.star.document.XExtendedFilterDetection interface ---------------
|
||||
|
||||
/** Detects MS Office 2007 file types and supports package decryption.
|
||||
|
||||
The following file types are detected:
|
||||
- MS Word 2007 XML Document (*.docx, *.docm)
|
||||
- MS Word 2007 XML Template (*.dotx, *.dotm)
|
||||
- MS Excel 2007 XML Document (*.xlsx, *.xlsm)
|
||||
- MS Excel 2007 BIFF12 Document (*.xlsb)
|
||||
- MS Excel 2007 XML Template (*.xltx, *.xltm)
|
||||
- MS Powerpoint 2007 XML Document (*.pptx, *.pptm)
|
||||
- MS Powerpoint 2007 XML Template (*.potx, *.potm)
|
||||
|
||||
If the package is encrypted, the detection tries to decrypt it into a
|
||||
temporary file. The user may be asked for a password. The XStream
|
||||
interface of the temporary file will be stored in the 'ComponentData'
|
||||
property of the passed media descriptor.
|
||||
*/
|
||||
virtual ::rtl::OUString SAL_CALL detect(
|
||||
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq )
|
||||
throw( ::com::sun::star::uno::RuntimeException );
|
||||
|
||||
private:
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxFactory;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
} // namespace core
|
||||
} // namespace oox
|
||||
|
||||
#endif
|
||||
|
|
@ -87,9 +87,6 @@ public:
|
|||
virtual const ::oox::drawingml::Theme*
|
||||
getCurrentTheme() const = 0;
|
||||
|
||||
/** Has to be implemented by each filter to resolve scheme colors. */
|
||||
virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const = 0;
|
||||
|
||||
/** Has to be implemented by each filter to return the collection of VML shapes. */
|
||||
virtual ::oox::vml::Drawing* getVmlDrawing() = 0;
|
||||
|
||||
|
@ -204,10 +201,15 @@ public:
|
|||
*/
|
||||
XmlFilterBase& exportDocumentProperties( ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > xProperties );
|
||||
|
||||
protected:
|
||||
virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
|
||||
implGetInputStream( ::comphelper::MediaDescriptor& rMediaDesc ) const;
|
||||
|
||||
private:
|
||||
virtual StorageRef implCreateStorage(
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const;
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream ) const;
|
||||
virtual StorageRef implCreateStorage(
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const;
|
||||
|
||||
private:
|
||||
::std::auto_ptr< XmlFilterBaseImpl > mxImpl;
|
||||
|
|
|
@ -34,10 +34,11 @@
|
|||
#include <vector>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <sal/types.h>
|
||||
#include <rtl/instance.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
#include "oox/helper/helper.hxx"
|
||||
|
||||
namespace oox { namespace core {
|
||||
class XmlFilterBase;
|
||||
} }
|
||||
namespace oox { namespace core { class FilterBase; } }
|
||||
|
||||
namespace oox {
|
||||
namespace drawingml {
|
||||
|
@ -50,6 +51,11 @@ public:
|
|||
Color();
|
||||
~Color();
|
||||
|
||||
/** Returns the RGB value for the passed DrawingML color token, or nDefaultRgb on error. */
|
||||
static sal_Int32 getDmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb );
|
||||
/** Returns the RGB value for the passed VML color token, or nDefaultRgb on error. */
|
||||
static sal_Int32 getVmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb );
|
||||
|
||||
/** Sets the color to unused state. */
|
||||
void setUnused();
|
||||
/** Sets an RGB value (hexadecimal RRGGBB) from the a:srgbClr element. */
|
||||
|
@ -64,6 +70,8 @@ public:
|
|||
void setSchemeClr( sal_Int32 nToken );
|
||||
/** Sets a system color from the a:sysClr element. */
|
||||
void setSysClr( sal_Int32 nToken, sal_Int32 nLastRgb );
|
||||
/** Sets a palette color index. */
|
||||
void setPaletteClr( sal_Int32 nPaletteIdx );
|
||||
|
||||
/** Inserts the passed color transformation. */
|
||||
void addTransformation( sal_Int32 nElement, sal_Int32 nValue = -1 );
|
||||
|
@ -71,17 +79,21 @@ public:
|
|||
void addChartTintTransformation( double fTint );
|
||||
/** Inserts Excel specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). */
|
||||
void addExcelTintTransformation( double fTint );
|
||||
|
||||
/** Overwrites this color with the passed color, if it is used. */
|
||||
inline void assignIfUsed( const Color& rColor ) { if( rColor.isUsed() ) *this = rColor; }
|
||||
/** Removes all color transformations. */
|
||||
void clearTransformations();
|
||||
/** Removes transparence from the color. */
|
||||
void clearTransparence();
|
||||
|
||||
/** Overwrites this color with the passed color, if it is used. */
|
||||
inline void assignIfUsed( const Color& rColor ) { if( rColor.isUsed() ) *this = rColor; }
|
||||
|
||||
/** Returns true, if the color is initialized. */
|
||||
bool isUsed() const { return meMode != COLOR_UNUSED; }
|
||||
/** Returns true, if the color is a placeholder color in theme style lists. */
|
||||
bool isPlaceHolder() const { return meMode == COLOR_PH; }
|
||||
/** Returns the final RGB color value.
|
||||
@param nPhClr Actual color for the phClr placeholder color used in theme style lists. */
|
||||
sal_Int32 getColor( const ::oox::core::XmlFilterBase& rFilter, sal_Int32 nPhClr = -1 ) const;
|
||||
sal_Int32 getColor( const ::oox::core::FilterBase& rFilter, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
|
||||
|
||||
/** Returns true, if the color has a transparence set. */
|
||||
bool hasTransparence() const;
|
||||
|
@ -89,6 +101,9 @@ public:
|
|||
sal_Int16 getTransparence() const;
|
||||
|
||||
private:
|
||||
/** Internal helper for getColor(). */
|
||||
void setResolvedRgb( sal_Int32 nRgb ) const;
|
||||
|
||||
/** Converts the color components to RGB values. */
|
||||
void toRgb() const;
|
||||
/** Converts the color components to CRGB values (gamma corrected percentage). */
|
||||
|
@ -104,8 +119,9 @@ private:
|
|||
COLOR_CRGB, /// Relative RGB (r/g/b: 0...100000).
|
||||
COLOR_HSL, /// HSL (hue: 0...21600000, sat/lum: 0...100000).
|
||||
COLOR_SCHEME, /// Color from scheme.
|
||||
COLOR_PH, /// Placeholder color in theme style lists.
|
||||
COLOR_PALETTE, /// Color from application defined palette.
|
||||
COLOR_SYSTEM, /// Color from system palette.
|
||||
COLOR_PH, /// Placeholder color in theme style lists.
|
||||
COLOR_FINAL /// Finalized RGB color.
|
||||
};
|
||||
|
||||
|
@ -120,7 +136,7 @@ private:
|
|||
|
||||
mutable ColorMode meMode; /// Current color mode.
|
||||
mutable TransformVec maTransforms; /// Color transformations.
|
||||
mutable sal_Int32 mnC1; /// Red, red%, hue, scheme token, system token, or final RGB.
|
||||
mutable sal_Int32 mnC1; /// Red, red%, hue, scheme token, palette index, system token, or final RGB.
|
||||
mutable sal_Int32 mnC2; /// Green, green%, saturation, or system default RGB.
|
||||
mutable sal_Int32 mnC3; /// Blue, blue%, or luminance.
|
||||
sal_Int32 mnAlpha; /// Alpha value (color opacity).
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
virtual ~CustomShapeProperties();
|
||||
|
||||
void apply( const CustomShapePropertiesPtr& );
|
||||
void pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase,
|
||||
void pushToPropSet( const ::oox::core::FilterBase& rFilterBase,
|
||||
const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
|
||||
const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > & xShape) const;
|
||||
|
||||
|
|
|
@ -43,6 +43,14 @@ namespace drawingml {
|
|||
|
||||
// ============================================================================
|
||||
|
||||
const sal_Int32 PER_PERCENT = 1000;
|
||||
const sal_Int32 MAX_PERCENT = 100 * PER_PERCENT;
|
||||
|
||||
const sal_Int32 PER_DEGREE = 60000;
|
||||
const sal_Int32 MAX_DEGREE = 360 * PER_DEGREE;
|
||||
|
||||
// ============================================================================
|
||||
|
||||
struct LineProperties;
|
||||
typedef ::boost::shared_ptr< LineProperties > LinePropertiesPtr;
|
||||
|
||||
|
|
|
@ -159,18 +159,20 @@ struct FillProperties
|
|||
/** Writes the properties to the passed property map. */
|
||||
void pushToPropMap(
|
||||
PropertyMap& rPropMap,
|
||||
const FillPropertyIds& rPropIds,
|
||||
const ::oox::core::XmlFilterBase& rFilter,
|
||||
const ::oox::core::FilterBase& rFilter,
|
||||
ModelObjectHelper& rModelObjHelper,
|
||||
sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
|
||||
const FillPropertyIds& rPropIds = DEFAULT_IDS,
|
||||
sal_Int32 nShapeRotation = 0,
|
||||
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
|
||||
|
||||
/** Writes the properties to the passed property set. */
|
||||
void pushToPropSet(
|
||||
PropertySet& rPropSet,
|
||||
const FillPropertyIds& rPropIds,
|
||||
const ::oox::core::XmlFilterBase& rFilter,
|
||||
const ::oox::core::FilterBase& rFilter,
|
||||
ModelObjectHelper& rModelObjHelper,
|
||||
sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
|
||||
const FillPropertyIds& rPropIds = DEFAULT_IDS,
|
||||
sal_Int32 nShapeRotation = 0,
|
||||
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
@ -185,14 +187,14 @@ struct GraphicProperties
|
|||
/** Writes the properties to the passed property map. */
|
||||
void pushToPropMap(
|
||||
PropertyMap& rPropMap,
|
||||
const ::oox::core::XmlFilterBase& rFilter,
|
||||
sal_Int32 nPhClr ) const;
|
||||
const ::oox::core::FilterBase& rFilter,
|
||||
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
|
||||
|
||||
/** Writes the properties to the passed property set. */
|
||||
void pushToPropSet(
|
||||
PropertySet& rPropSet,
|
||||
const ::oox::core::XmlFilterBase& rFilter,
|
||||
sal_Int32 nPhClr ) const;
|
||||
const ::oox::core::FilterBase& rFilter,
|
||||
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
@ -86,11 +86,16 @@ struct LineArrowProperties
|
|||
|
||||
struct LineProperties
|
||||
{
|
||||
typedef ::std::pair< sal_Int32, sal_Int32 > DashStop;
|
||||
typedef ::std::vector< DashStop > DashStopVector;
|
||||
|
||||
LineArrowProperties maStartArrow; /// Start line arrow style.
|
||||
LineArrowProperties maEndArrow; /// End line arrow style.
|
||||
FillProperties maLineFill; /// Line fill (solid, gradient, ...).
|
||||
DashStopVector maCustomDash; /// User-defined line dash style.
|
||||
OptValue< sal_Int32 > moLineWidth; /// Line width (EMUs).
|
||||
OptValue< sal_Int32 > moPresetDash; /// Preset dash (OOXML token).
|
||||
OptValue< sal_Int32 > moLineCompound; /// Line compound type (OOXML token).
|
||||
OptValue< sal_Int32 > moLineCap; /// Line cap (OOXML token).
|
||||
OptValue< sal_Int32 > moLineJoint; /// Line joint type (OOXML token).
|
||||
|
||||
|
@ -102,18 +107,18 @@ struct LineProperties
|
|||
/** Writes the properties to the passed property map. */
|
||||
void pushToPropMap(
|
||||
PropertyMap& rPropMap,
|
||||
const LinePropertyIds& rPropIds,
|
||||
const ::oox::core::XmlFilterBase& rFilter,
|
||||
const ::oox::core::FilterBase& rFilter,
|
||||
ModelObjectHelper& rModelObjHelper,
|
||||
sal_Int32 nPhClr ) const;
|
||||
const LinePropertyIds& rPropIds = DEFAULT_IDS,
|
||||
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
|
||||
|
||||
/** Writes the properties to the passed property map. */
|
||||
void pushToPropSet(
|
||||
PropertySet& rPropSet,
|
||||
const LinePropertyIds& rPropIds,
|
||||
const ::oox::core::XmlFilterBase& rFilter,
|
||||
const ::oox::core::FilterBase& rFilter,
|
||||
ModelObjectHelper& rModelObjHelper,
|
||||
sal_Int32 nPhClr ) const;
|
||||
const LinePropertyIds& rPropIds = DEFAULT_IDS,
|
||||
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <rtl/ustrbuf.hxx>
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#include <com/sun/star/util/DateTime.hpp>
|
||||
#include <comphelper/mediadescriptor.hxx>
|
||||
#include "oox/helper/helper.hxx"
|
||||
#include "oox/helper/storagebase.hxx"
|
||||
#include "oox/helper/binaryinputstream.hxx"
|
||||
|
@ -57,6 +58,10 @@ namespace com { namespace sun { namespace star {
|
|||
namespace lang { class XMultiServiceFactory; }
|
||||
} } }
|
||||
|
||||
namespace comphelper {
|
||||
class IDocPasswordVerifier;
|
||||
}
|
||||
|
||||
namespace oox {
|
||||
class BinaryOutputStream;
|
||||
}
|
||||
|
@ -866,7 +871,8 @@ public:
|
|||
const ::rtl::OUString& rFileName,
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
|
||||
const StorageRef& rxRootStrg,
|
||||
const ::rtl::OUString& rSysFileName );
|
||||
const ::rtl::OUString& rSysFileName,
|
||||
::comphelper::MediaDescriptor& rMediaDesc );
|
||||
|
||||
virtual ~SharedConfigData();
|
||||
|
||||
|
@ -883,6 +889,9 @@ public:
|
|||
void eraseNameList( const ::rtl::OUString& rListName );
|
||||
NameListRef getNameList( const ::rtl::OUString& rListName ) const;
|
||||
|
||||
::rtl::OUString requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier );
|
||||
inline bool isPasswordCancelled() const { return mbPwCancelled; }
|
||||
|
||||
protected:
|
||||
virtual bool implIsValid() const;
|
||||
virtual void implProcessConfigItemStr(
|
||||
|
@ -905,11 +914,13 @@ private:
|
|||
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxFactory;
|
||||
StorageRef mxRootStrg;
|
||||
::rtl::OUString maSysFileName;
|
||||
::comphelper::MediaDescriptor& mrMediaDesc;
|
||||
ConfigFileSet maConfigFiles;
|
||||
ConfigDataMap maConfigData;
|
||||
NameListMap maNameLists;
|
||||
::rtl::OUString maConfigPath;
|
||||
bool mbLoaded;
|
||||
bool mbPwCancelled;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -947,7 +958,8 @@ public:
|
|||
const sal_Char* pcEnvVar,
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
|
||||
const StorageRef& rxRootStrg,
|
||||
const ::rtl::OUString& rSysFileName );
|
||||
const ::rtl::OUString& rSysFileName,
|
||||
::comphelper::MediaDescriptor& rMediaDesc );
|
||||
|
||||
virtual ~Config();
|
||||
|
||||
|
@ -978,6 +990,9 @@ public:
|
|||
template< typename Type >
|
||||
bool hasName( const NameListWrapper& rListWrp, Type nKey ) const;
|
||||
|
||||
::rtl::OUString requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier );
|
||||
bool isPasswordCancelled() const;
|
||||
|
||||
protected:
|
||||
inline explicit Config() {}
|
||||
void construct( const Config& rParent );
|
||||
|
@ -988,7 +1003,8 @@ protected:
|
|||
const sal_Char* pcEnvVar,
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
|
||||
const StorageRef& rxRootStrg,
|
||||
const ::rtl::OUString& rSysFileName );
|
||||
const ::rtl::OUString& rSysFileName,
|
||||
::comphelper::MediaDescriptor& rMediaDesc );
|
||||
|
||||
virtual bool implIsValid() const;
|
||||
virtual const ::rtl::OUString* implGetOption( const ::rtl::OUString& rKey ) const;
|
||||
|
@ -1822,11 +1838,6 @@ class RecordObjectBase : public InputObjectBase
|
|||
protected:
|
||||
inline explicit RecordObjectBase() {}
|
||||
|
||||
inline sal_Int64 getRecPos() const { return mnRecPos; }
|
||||
inline sal_Int64 getRecId() const { return mnRecId; }
|
||||
inline sal_Int64 getRecSize() const { return mnRecSize; }
|
||||
inline NameListRef getRecNames() const { return maRecNames.getNameList( cfg() ); }
|
||||
|
||||
using InputObjectBase::construct;
|
||||
void construct(
|
||||
const ObjectBase& rParent,
|
||||
|
@ -1842,6 +1853,14 @@ protected:
|
|||
const String& rRecNames,
|
||||
const String& rSimpleRecs = EMPTY_STRING );
|
||||
|
||||
inline sal_Int64 getRecPos() const { return mnRecPos; }
|
||||
inline sal_Int64 getRecId() const { return mnRecId; }
|
||||
inline sal_Int64 getRecSize() const { return mnRecSize; }
|
||||
inline NameListRef getRecNames() const { return maRecNames.getNameList( cfg() ); }
|
||||
|
||||
inline void setBinaryOnlyMode( bool bBinaryOnly ) { mbBinaryOnly = bBinaryOnly; }
|
||||
inline bool isBinaryOnlyMode() const { return mbBinaryOnly; }
|
||||
|
||||
virtual bool implIsValid() const;
|
||||
virtual void implDump();
|
||||
|
||||
|
@ -1865,6 +1884,7 @@ private:
|
|||
sal_Int64 mnRecId;
|
||||
sal_Int64 mnRecSize;
|
||||
bool mbShowRecPos;
|
||||
bool mbBinaryOnly;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
@ -1922,6 +1942,7 @@ public:
|
|||
virtual ~DumperBase();
|
||||
|
||||
bool isImportEnabled() const;
|
||||
bool isImportCancelled() const;
|
||||
|
||||
protected:
|
||||
inline explicit DumperBase() {}
|
||||
|
@ -1936,12 +1957,13 @@ protected:
|
|||
} // namespace dump
|
||||
} // namespace oox
|
||||
|
||||
#define OOX_DUMP_FILE( DumperClassName ) \
|
||||
do { \
|
||||
DumperClassName aDumper( *this ); \
|
||||
aDumper.dump(); \
|
||||
if( !aDumper.isImportEnabled() ) \
|
||||
return aDumper.isValid(); \
|
||||
#define OOX_DUMP_FILE( DumperClassName ) \
|
||||
do { \
|
||||
DumperClassName aDumper( *this ); \
|
||||
aDumper.dump(); \
|
||||
bool bCancelled = aDumper.isImportCancelled(); \
|
||||
if( !aDumper.isImportEnabled() || bCancelled ) \
|
||||
return aDumper.isValid() && !bCancelled; \
|
||||
} while( false )
|
||||
|
||||
#else // OOX_INCLUDE_DUMPER
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
template< typename FunctorType >
|
||||
inline void forEach( const FunctorType& rFunctor ) const
|
||||
{
|
||||
::std::for_each( this->begin(), this->end(), Functor< FunctorType >( rFunctor ) );
|
||||
::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) );
|
||||
}
|
||||
|
||||
/** Calls the passed member function of ObjType on every contained object. */
|
||||
|
@ -115,13 +115,30 @@ public:
|
|||
forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
|
||||
}
|
||||
|
||||
/** Searches for an element by using the passed functor that takes a
|
||||
constant reference of the object type (const ObjType&). */
|
||||
template< typename FunctorType >
|
||||
inline value_type findIf( const FunctorType& rFunctor ) const
|
||||
{
|
||||
typename container_type::const_iterator aIt = ::std::find_if( this->begin(), this->end(), FindFunctor< FunctorType >( rFunctor ) );
|
||||
return (aIt == this->end()) ? value_type() : *aIt;
|
||||
}
|
||||
|
||||
private:
|
||||
template< typename FunctorType >
|
||||
struct Functor
|
||||
struct ForEachFunctor
|
||||
{
|
||||
const FunctorType& mrFunctor;
|
||||
inline explicit Functor( const FunctorType& rFunctor ) : mrFunctor( rFunctor ) {}
|
||||
inline void operator()( const value_type& rValue ) const { mrFunctor( *rValue ); }
|
||||
inline explicit ForEachFunctor( const FunctorType& rFunctor ) : mrFunctor( rFunctor ) {}
|
||||
inline void operator()( const value_type& rxValue ) const { if( rxValue.get() ) mrFunctor( *rxValue ); }
|
||||
};
|
||||
|
||||
template< typename FunctorType >
|
||||
struct FindFunctor
|
||||
{
|
||||
const FunctorType& mrFunctor;
|
||||
inline explicit FindFunctor( const FunctorType& rFunctor ) : mrFunctor( rFunctor ) {}
|
||||
inline bool operator()( const value_type& rxValue ) const { return rxValue.get() && mrFunctor( *rxValue ); }
|
||||
};
|
||||
|
||||
inline const value_type* getRef( sal_Int32 nIndex ) const
|
||||
|
@ -170,7 +187,7 @@ public:
|
|||
template< typename FunctorType >
|
||||
inline void forEach( const FunctorType& rFunctor ) const
|
||||
{
|
||||
::std::for_each( this->begin(), this->end(), Functor< FunctorType >( rFunctor ) );
|
||||
::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) );
|
||||
}
|
||||
|
||||
/** Calls the passed member function of ObjType on every contained object. */
|
||||
|
@ -196,11 +213,11 @@ public:
|
|||
|
||||
private:
|
||||
template< typename FunctorType >
|
||||
struct Functor
|
||||
struct ForEachFunctor
|
||||
{
|
||||
const FunctorType& mrFunctor;
|
||||
inline explicit Functor( const FunctorType& rFunctor ) : mrFunctor( rFunctor ) {}
|
||||
inline void operator()( const value_type& rValue ) const { mrFunctor( *rValue.second ); }
|
||||
inline explicit ForEachFunctor( const FunctorType& rFunctor ) : mrFunctor( rFunctor ) {}
|
||||
inline void operator()( const value_type& rValue ) const { if( rValue.second.get() ) mrFunctor( *rValue.second ); }
|
||||
};
|
||||
|
||||
inline const mapped_type* getRef( key_type nKey ) const
|
||||
|
|
|
@ -104,7 +104,8 @@ inline ReturnType getLimitedValue( Type nValue, Type nMin, Type nMax )
|
|||
template< typename ReturnType, typename Type >
|
||||
inline ReturnType getIntervalValue( Type nValue, Type nBegin, Type nEnd )
|
||||
{
|
||||
BOOST_STATIC_ASSERT( ::std::numeric_limits< Type >::is_integer );
|
||||
// this BOOST_STATIC_ASSERT fails with suncc
|
||||
// BOOST_STATIC_ASSERT( ::std::numeric_limits< Type >::is_integer );
|
||||
Type nInterval = nEnd - nBegin;
|
||||
Type nCount = (nValue < nBegin) ? -((nBegin - nValue - 1) / nInterval + 1) : ((nValue - nBegin) / nInterval);
|
||||
return static_cast< ReturnType >( nValue - nCount * nInterval );
|
||||
|
|
|
@ -44,13 +44,7 @@ namespace com { namespace sun { namespace star { namespace beans {
|
|||
|
||||
namespace oox {
|
||||
|
||||
// ============================================================================
|
||||
|
||||
/** A vector that contains all predefined property names used in the filters. */
|
||||
struct PropertyNamesList : public ::std::vector< ::rtl::OUString >
|
||||
{
|
||||
explicit PropertyNamesList();
|
||||
};
|
||||
struct PropertyList;
|
||||
|
||||
// ============================================================================
|
||||
|
||||
|
@ -66,6 +60,9 @@ typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > PropertyMapBase;
|
|||
class PropertyMap : public PropertyMapBase
|
||||
{
|
||||
public:
|
||||
explicit PropertyMap();
|
||||
~PropertyMap();
|
||||
|
||||
/** Returns the name of the passed property identifier. */
|
||||
static const ::rtl::OUString& getPropertyName( sal_Int32 nPropId );
|
||||
|
||||
|
@ -94,6 +91,9 @@ public:
|
|||
/** Creates and fills a new instance supporting the XPropertySet interface. */
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
|
||||
makePropertySet() const;
|
||||
|
||||
private:
|
||||
const PropertyList* mpPropNames;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
@ -83,8 +83,6 @@ protected:
|
|||
/** Derived classes returns the UNO form of the current context. Called exactly once. */
|
||||
virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >
|
||||
createControlForm() const = 0;
|
||||
/** Derived classes may implement to resolve a palette index to an RGB color. */
|
||||
virtual sal_Int32 getPaletteColor( sal_uInt16 nPaletteIdx ) const;
|
||||
|
||||
private:
|
||||
const ::oox::core::FilterBase& mrFilter;
|
||||
|
|
|
@ -56,10 +56,9 @@ public:
|
|||
virtual bool importDocument() throw();
|
||||
virtual bool exportDocument() throw();
|
||||
|
||||
virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
|
||||
|
||||
virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
|
||||
|
||||
virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
|
||||
|
||||
virtual ::oox::vml::Drawing* getVmlDrawing();
|
||||
virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
|
||||
virtual ::oox::drawingml::chart::ChartConverter& getChartConverter();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*_***********************************************************************
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
|
@ -6,8 +6,8 @@
|
|||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* $RCSfile: MalformedCommandLineException.java,v $
|
||||
* $Revision: 1.4 $
|
||||
* $RCSfile: propertylist.hxx,v $
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
|
@ -26,21 +26,28 @@
|
|||
* <http://www.openoffice.org/license.html>
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
**********************************************************************_*/
|
||||
************************************************************************/
|
||||
|
||||
package com.sun.star.filter.config.tools.utils;
|
||||
#ifndef OOX_TOKEN_PROPERTYLIST_HXX
|
||||
#define OOX_TOKEN_PROPERTYLIST_HXX
|
||||
|
||||
#include <vector>
|
||||
#include <rtl/ustring.hxx>
|
||||
|
||||
//___________________________________________
|
||||
// types
|
||||
namespace oox {
|
||||
|
||||
/** indicates a malformed command line.
|
||||
*
|
||||
* E.g. it must be thrown if the command line contains one item more then once,
|
||||
* or use unsupported format.
|
||||
*/
|
||||
public class MalformedCommandLineException extends java.lang.Exception
|
||||
// ============================================================================
|
||||
|
||||
/** A vector that contains all predefined property names used in the filters. */
|
||||
struct PropertyList : public ::std::vector< ::rtl::OUString >
|
||||
{
|
||||
public MalformedCommandLineException() {}
|
||||
public MalformedCommandLineException(java.lang.String sMsg) { super(sMsg); }
|
||||
}
|
||||
explicit PropertyList();
|
||||
~PropertyList();
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
} // namespace oox
|
||||
|
||||
#endif
|
||||
|
84
oox/inc/oox/token/tokenmap.hxx
Normal file
84
oox/inc/oox/token/tokenmap.hxx
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* 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: fasttokenhandler.hxx,v $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* 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 OOX_TOKEN_TOKENMAP_HXX
|
||||
#define OOX_TOKEN_TOKENMAP_HXX
|
||||
|
||||
#include <vector>
|
||||
#include <rtl/instance.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
|
||||
namespace oox {
|
||||
|
||||
// ============================================================================
|
||||
|
||||
class TokenMap
|
||||
{
|
||||
public:
|
||||
explicit TokenMap();
|
||||
~TokenMap();
|
||||
|
||||
/** Returns the Unicode name of the passed token identifier. */
|
||||
::rtl::OUString getUnicodeTokenName( sal_Int32 nToken ) const;
|
||||
|
||||
/** Returns the token identifier for the passed Unicode token name. */
|
||||
sal_Int32 getTokenFromUnicode( const ::rtl::OUString& rUnicodeName ) const;
|
||||
|
||||
/** Returns the UTF8 name of the passed token identifier as byte sequence. */
|
||||
::com::sun::star::uno::Sequence< sal_Int8 >
|
||||
getUtf8TokenName( sal_Int32 nToken ) const;
|
||||
|
||||
/** Returns the token identifier for the passed UTF8 token name. */
|
||||
sal_Int32 getTokenFromUtf8(
|
||||
const ::com::sun::star::uno::Sequence< sal_Int8 >& rUtf8Name ) const;
|
||||
|
||||
private:
|
||||
struct TokenName
|
||||
{
|
||||
::rtl::OUString maUniName;
|
||||
::com::sun::star::uno::Sequence< sal_Int8 > maUtf8Name;
|
||||
};
|
||||
typedef ::std::vector< TokenName > TokenNameVector;
|
||||
|
||||
TokenNameVector maTokenNames;
|
||||
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
struct StaticTokenMap : public ::rtl::Static< TokenMap, StaticTokenMap > {};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
} // namespace oox
|
||||
|
||||
#endif
|
||||
|
|
@ -47,6 +47,7 @@ namespace oox { namespace ole { class AxControlHelper; } }
|
|||
namespace oox {
|
||||
namespace vml {
|
||||
|
||||
class ShapeBase;
|
||||
class ShapeContainer;
|
||||
struct ShapeClientData;
|
||||
|
||||
|
@ -133,6 +134,9 @@ public:
|
|||
/** Returns the registered info structure for a form control, if extant. */
|
||||
const ControlInfo* getControlInfo( const ::rtl::OUString& rShapeId ) const;
|
||||
|
||||
/** Derived classes may disable conversion of specific shapes. */
|
||||
virtual bool isShapeSupported( const ShapeBase& rShape ) const;
|
||||
|
||||
/** Derived classes may calculate the shape rectangle from a non-standard
|
||||
anchor information string. */
|
||||
virtual bool convertShapeClientAnchor(
|
||||
|
|
187
oox/inc/oox/vml/vmlformatting.hxx
Normal file
187
oox/inc/oox/vml/vmlformatting.hxx
Normal file
|
@ -0,0 +1,187 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* 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: vmlformatting.hxx,v $
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* 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 OOX_VML_VMLFORMATTING_HXX
|
||||
#define OOX_VML_VMLFORMATTING_HXX
|
||||
|
||||
#include "oox/helper/helper.hxx"
|
||||
|
||||
namespace oox { class PropertyMap; }
|
||||
namespace oox { namespace core { class FilterBase; } }
|
||||
|
||||
namespace oox {
|
||||
namespace vml {
|
||||
|
||||
// ============================================================================
|
||||
|
||||
typedef ::std::pair< sal_Int32, sal_Int32 > Int32Pair;
|
||||
typedef ::std::pair< double, double > DoublePair;
|
||||
|
||||
// ============================================================================
|
||||
|
||||
class ConversionHelper
|
||||
{
|
||||
public:
|
||||
/** Returns two values contained in rValue separated by cSep.
|
||||
*/
|
||||
static bool separatePair(
|
||||
::rtl::OUString& orValue1, ::rtl::OUString& orValue2,
|
||||
const ::rtl::OUString& rValue, sal_Unicode cSep );
|
||||
|
||||
/** Returns the boolean value from the passed string of a VML attribute.
|
||||
Supported values: 'f', 't', 'false', 'true'. False for anything else.
|
||||
*/
|
||||
static bool decodeBool( const ::rtl::OUString& rValue );
|
||||
|
||||
/** Converts the passed VML percentage measure string to a normalized
|
||||
floating-point value.
|
||||
|
||||
@param rValue The VML percentage value. This is a floating-point value
|
||||
with optional following '%' sign. If the '%' sign is missing, the
|
||||
floating point value will be returned unmodified. If the '%' sign
|
||||
is present, the value will be divided by 100.
|
||||
*/
|
||||
static double decodePercent(
|
||||
const ::rtl::OUString& rValue,
|
||||
double fDefValue );
|
||||
|
||||
/** Converts the passed VML measure string to EMU (English Metric Units).
|
||||
|
||||
@param rFilter The core filter object needed to perform pixel
|
||||
conversion according to the current output device.
|
||||
|
||||
@param rValue The VML measure value. This is a floating-point value
|
||||
with optional measure string following the value.
|
||||
|
||||
@param nRefValue Reference value needed for percentage measure.
|
||||
|
||||
@param bPixelX Set to true if the value is oriented horizontally (e.g.
|
||||
X coordinates, widths). Set to false if the value is oriented
|
||||
vertically (e.g. Y coordinates, heights). This is needed because
|
||||
output devices may specify different width and height for a pixel.
|
||||
|
||||
@param bDefaultAsPixel Set to true if omitted measure unit means
|
||||
pixel. Set to false if omitted measure unit means EMU.
|
||||
*/
|
||||
static sal_Int32 decodeMeasureToEmu(
|
||||
const ::oox::core::FilterBase& rFilter,
|
||||
const ::rtl::OUString& rValue,
|
||||
sal_Int32 nRefValue,
|
||||
bool bPixelX,
|
||||
bool bDefaultAsPixel );
|
||||
|
||||
/** Converts the passed VML measure string to 1/100 mm.
|
||||
|
||||
@param rFilter See above.
|
||||
@param rValue See above.
|
||||
@param nRefValue See above.
|
||||
@param bPixelX See above.
|
||||
@param bDefaultAsPixel See above.
|
||||
*/
|
||||
static sal_Int32 decodeMeasureToHmm(
|
||||
const ::oox::core::FilterBase& rFilter,
|
||||
const ::rtl::OUString& rValue,
|
||||
sal_Int32 nRefValue,
|
||||
bool bPixelX,
|
||||
bool bDefaultAsPixel );
|
||||
|
||||
private:
|
||||
ConversionHelper();
|
||||
~ConversionHelper();
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
/** The stroke arrow model structure contains all properties for an line end arrow. */
|
||||
struct StrokeArrowModel
|
||||
{
|
||||
OptValue< sal_Int32 > moArrowType;
|
||||
OptValue< sal_Int32 > moArrowWidth;
|
||||
OptValue< sal_Int32 > moArrowLength;
|
||||
|
||||
void assignUsed( const StrokeArrowModel& rSource );
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
/** The stroke model structure contains all shape border properties. */
|
||||
struct StrokeModel
|
||||
{
|
||||
OptValue< bool > moStroked; /// Shape border line on/off.
|
||||
StrokeArrowModel maStartArrow; /// Start line arrow style.
|
||||
StrokeArrowModel maEndArrow; /// End line arrow style.
|
||||
OptValue< ::rtl::OUString > moColor; /// Solid line color.
|
||||
OptValue< double > moOpacity; /// Solid line color opacity.
|
||||
OptValue< ::rtl::OUString > moWeight; /// Line width.
|
||||
OptValue< ::rtl::OUString > moDashStyle; /// Line dash (predefined or manually).
|
||||
OptValue< sal_Int32 > moLineStyle; /// Line style (single, double, ...).
|
||||
OptValue< sal_Int32 > moEndCap; /// Type of line end cap.
|
||||
OptValue< sal_Int32 > moJoinStyle; /// Type of line join.
|
||||
|
||||
void assignUsed( const StrokeModel& rSource );
|
||||
|
||||
/** Writes the properties to the passed property map. */
|
||||
void pushToPropMap(
|
||||
PropertyMap& rPropMap,
|
||||
const ::oox::core::FilterBase& rFilter ) const;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
/** The fill model structure contains all shape fill properties. */
|
||||
struct FillModel
|
||||
{
|
||||
OptValue< bool > moFilled; /// Shape fill on/off.
|
||||
OptValue< ::rtl::OUString > moColor; /// Solid fill color.
|
||||
OptValue< double > moOpacity; /// Solid fill color opacity.
|
||||
OptValue< ::rtl::OUString > moColor2; /// End color of gradient.
|
||||
OptValue< double > moOpacity2; /// End color opycity of gradient.
|
||||
OptValue< sal_Int32 > moType; /// Fill type.
|
||||
OptValue< sal_Int32 > moAngle; /// Gradient rotation angle.
|
||||
OptValue< double > moFocus; /// Linear gradient focus of second color.
|
||||
OptValue< DoublePair > moFocusPos; /// Rectanguar gradient focus position of second color.
|
||||
OptValue< DoublePair > moFocusSize; /// Rectanguar gradient focus size of second color.
|
||||
OptValue< bool > moRotate; /// True = rotate gradient/bitmap with shape.
|
||||
|
||||
void assignUsed( const FillModel& rSource );
|
||||
|
||||
/** Writes the properties to the passed property map. */
|
||||
void pushToPropMap(
|
||||
PropertyMap& rPropMap,
|
||||
const ::oox::core::FilterBase& rFilter ) const;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
} // namespace vml
|
||||
} // namespace oox
|
||||
|
||||
#endif
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
#include <com/sun/star/awt/Point.hpp>
|
||||
#include "oox/helper/helper.hxx"
|
||||
#include "oox/vml/vmlformatting.hxx"
|
||||
|
||||
namespace com { namespace sun { namespace star {
|
||||
namespace awt { struct Rectangle; }
|
||||
|
@ -56,12 +56,10 @@ struct ShapeTypeModel
|
|||
{
|
||||
::rtl::OUString maShapeId; /// Unique identifier of the shape.
|
||||
::rtl::OUString maName; /// Name of the shape, if present.
|
||||
OptValue< sal_Int32 > monShapeType; /// Builtin shape type identifier.
|
||||
OptValue< sal_Int32 > moShapeType; /// Builtin shape type identifier.
|
||||
|
||||
OptValue< sal_Int32 > monCoordLeft; /// Left position of coordinate system for children scaling.
|
||||
OptValue< sal_Int32 > monCoordTop; /// Top position of coordinate system for children scaling.
|
||||
OptValue< sal_Int32 > monCoordWidth; /// Width of coordinate system for children scaling.
|
||||
OptValue< sal_Int32 > monCoordHeight; /// Height of coordinate system for children scaling.
|
||||
OptValue< Int32Pair > moCoordPos; /// Top-left position of coordinate system for children scaling.
|
||||
OptValue< Int32Pair > moCoordSize; /// Size of coordinate system for children scaling.
|
||||
::rtl::OUString maPosition; /// Position type of the shape.
|
||||
::rtl::OUString maLeft; /// X position of the shape bounding box (number with unit).
|
||||
::rtl::OUString maTop; /// Y position of the shape bounding box (number with unit).
|
||||
|
@ -70,11 +68,8 @@ struct ShapeTypeModel
|
|||
::rtl::OUString maMarginLeft; /// X position of the shape bounding box to shape anchor (number with unit).
|
||||
::rtl::OUString maMarginTop; /// Y position of the shape bounding box to shape anchor (number with unit).
|
||||
|
||||
OptValue< bool > mobStroked; /// True or missing = solid border line.
|
||||
OptValue< ::rtl::OUString > moStrokeColor; /// Solid border color.
|
||||
|
||||
OptValue< bool > mobFilled; /// True or missing = path is filled.
|
||||
OptValue< ::rtl::OUString > moFillColor; /// Solid fill color.
|
||||
StrokeModel maStrokeModel; /// Border line formatting.
|
||||
FillModel maFillModel; /// Shape fill formatting.
|
||||
|
||||
OptValue< ::rtl::OUString > moGraphicPath; /// Path to a graphic for this shape.
|
||||
OptValue< ::rtl::OUString > moGraphicTitle; /// Title of the graphic.
|
||||
|
@ -131,7 +126,10 @@ struct ShapeClientData
|
|||
::rtl::OUString maLinkedCell; /// Link to value cell associated to the control.
|
||||
::rtl::OUString maSourceRange; /// Link to cell range used as data source for the control.
|
||||
sal_Int32 mnObjType; /// Type of the shape.
|
||||
sal_Int32 mnCol; /// Column index for spreadsheet cell note.
|
||||
sal_Int32 mnRow; /// Row index for spreadsheet cell note.
|
||||
bool mbPrintObject; /// True = print the object.
|
||||
bool mbVisible; /// True = cell note is visible.
|
||||
|
||||
explicit ShapeClientData();
|
||||
};
|
||||
|
@ -179,6 +177,11 @@ public:
|
|||
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
|
||||
const ShapeParentAnchor* pParentAnchor = 0 ) const;
|
||||
|
||||
/** Converts position and formatting into the passed existing XShape. */
|
||||
void convertFormatting(
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
|
||||
const ShapeParentAnchor* pParentAnchor = 0 ) const;
|
||||
|
||||
protected:
|
||||
explicit ShapeBase( const Drawing& rDrawing );
|
||||
|
||||
|
@ -188,6 +191,11 @@ protected:
|
|||
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
|
||||
const ::com::sun::star::awt::Rectangle& rShapeRect ) const = 0;
|
||||
|
||||
/** Calculates the final shape rectangle according to the passed anchor,
|
||||
if present, otherwise according to the own anchor settings. */
|
||||
::com::sun::star::awt::Rectangle calcShapeRectangle(
|
||||
const ShapeParentAnchor* pParentAnchor ) const;
|
||||
|
||||
/** Converts common shape properties such as formatting attributes. */
|
||||
void convertShapeProperties(
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape ) const;
|
||||
|
|
|
@ -73,6 +73,7 @@ public:
|
|||
|
||||
/** Returns true, if this contaikner does not contain any shapes. */
|
||||
inline bool empty() const { return maShapes.empty(); }
|
||||
|
||||
/** Returns the shape template with the passed identifier.
|
||||
@param bDeep True = searches in all group shapes too. */
|
||||
const ShapeType* getShapeTypeById( const ::rtl::OUString& rShapeId, bool bDeep ) const;
|
||||
|
@ -80,6 +81,15 @@ public:
|
|||
@param bDeep True = searches in all group shapes too. */
|
||||
const ShapeBase* getShapeById( const ::rtl::OUString& rShapeId, bool bDeep ) const;
|
||||
|
||||
/** Searches for a shape type by using the passed functor that takes a
|
||||
constant reference of a ShapeType object. */
|
||||
template< typename Functor >
|
||||
const ShapeType* findShapeType( const Functor& rFunctor ) const;
|
||||
/** Searches for a shape by using the passed functor that takes a constant
|
||||
reference of a ShapeBase object. */
|
||||
template< typename Functor >
|
||||
const ShapeBase* findShape( const Functor& rFunctor ) const;
|
||||
|
||||
/** Returns the first shape in the collection (Word only). */
|
||||
const ShapeBase* getFirstShape() const;
|
||||
|
||||
|
@ -111,6 +121,18 @@ ShapeT& ShapeContainer::createShape()
|
|||
return *xShape;
|
||||
}
|
||||
|
||||
template< typename Functor >
|
||||
const ShapeType* ShapeContainer::findShapeType( const Functor& rFunctor ) const
|
||||
{
|
||||
return maTypes.findIf( rFunctor ).get();
|
||||
}
|
||||
|
||||
template< typename Functor >
|
||||
const ShapeBase* ShapeContainer::findShape( const Functor& rFunctor ) const
|
||||
{
|
||||
return maShapes.findIf( rFunctor ).get();
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
} // namespace vml
|
||||
|
|
|
@ -70,7 +70,7 @@ class ShapeContextBase : public ::oox::core::ContextHandler2
|
|||
{
|
||||
public:
|
||||
static ::oox::core::ContextHandlerRef
|
||||
createContext(
|
||||
createShapeContext(
|
||||
::oox::core::ContextHandler2Helper& rParent,
|
||||
sal_Int32 nElement,
|
||||
const AttributeList& rAttribs,
|
||||
|
@ -94,10 +94,6 @@ public:
|
|||
onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
|
||||
|
||||
private:
|
||||
/** Processes the 'coordorigin' attribute. */
|
||||
void setCoordOrigin( const ::rtl::OUString& rCoordOrigin );
|
||||
/** Processes the 'coordsize' attribute. */
|
||||
void setCoordSize( const ::rtl::OUString& rCoordSize );
|
||||
/** Processes the 'style' attribute. */
|
||||
void setStyle( const ::rtl::OUString& rStyle );
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#define OOX_XLS_BIFFCODEC_HXX
|
||||
|
||||
#include <vector>
|
||||
#include <comphelper/docpasswordhelper.hxx>
|
||||
#include "oox/core/binarycodec.hxx"
|
||||
#include "oox/xls/workbookhelper.hxx"
|
||||
|
||||
|
@ -40,29 +41,27 @@ namespace xls {
|
|||
|
||||
// ============================================================================
|
||||
|
||||
const sal_Int32 CODEC_OK = 0;
|
||||
const sal_Int32 CODEC_ERROR_WRONG_PASS = 1;
|
||||
const sal_Int32 CODEC_ERROR_UNSUPP_CRYPT = 2;
|
||||
|
||||
const sal_Int64 BIFF_RCF_BLOCKSIZE = 1024;
|
||||
|
||||
// ============================================================================
|
||||
|
||||
/** Base class for BIFF stream decoders. */
|
||||
class BiffDecoderBase : public WorkbookHelper
|
||||
class BiffDecoderBase : public ::comphelper::IDocPasswordVerifier
|
||||
{
|
||||
public:
|
||||
explicit BiffDecoderBase( const WorkbookHelper& rHelper );
|
||||
explicit BiffDecoderBase();
|
||||
virtual ~BiffDecoderBase();
|
||||
|
||||
/** Derived classes return a clone of the decoder for usage in new streams. */
|
||||
inline BiffDecoderBase* clone() { return implClone(); }
|
||||
|
||||
/** Returns the current error code of the decoder. */
|
||||
inline sal_Int32 getErrorCode() const { return mnError; }
|
||||
/** Returns true, if the decoder has been constructed successfully.
|
||||
This means especially that construction happened with a valid password. */
|
||||
inline bool isValid() const { return mnError == CODEC_OK; }
|
||||
/** Implementation of the ::comphelper::IDocPasswordVerifier interface,
|
||||
calls the new virtual function implVerify(). */
|
||||
virtual ::comphelper::DocPasswordVerifierResult
|
||||
verifyPassword( const ::rtl::OUString& rPassword );
|
||||
|
||||
/** Returns true, if the decoder has been initialized correctly. */
|
||||
inline bool isValid() const { return mbValid; }
|
||||
|
||||
/** Decodes nBytes bytes and writes encrypted data into the buffer pnDestData. */
|
||||
void decode(
|
||||
|
@ -71,17 +70,14 @@ public:
|
|||
sal_Int64 nStreamPos,
|
||||
sal_uInt16 nBytes );
|
||||
|
||||
protected:
|
||||
/** Copy constructor for cloning. */
|
||||
BiffDecoderBase( const BiffDecoderBase& rDecoder );
|
||||
|
||||
/** Sets the decoder to a state showing whether the password was correct. */
|
||||
void setHasValidPassword( bool bValid );
|
||||
|
||||
private:
|
||||
/** Derived classes return a clone of the decoder for usage in new streams. */
|
||||
virtual BiffDecoderBase* implClone() = 0;
|
||||
|
||||
/** Derived classes implement password verification and initialization of
|
||||
the decoder. */
|
||||
virtual bool implVerify( const ::rtl::OUString& rPassword ) = 0;
|
||||
|
||||
/** Implementation of decryption of a memory block. */
|
||||
virtual void implDecode(
|
||||
sal_uInt8* pnDestData,
|
||||
|
@ -90,7 +86,7 @@ private:
|
|||
sal_uInt16 nBytes ) = 0;
|
||||
|
||||
private:
|
||||
sal_Int32 mnError; /// Decoder error code.
|
||||
bool mbValid; /// True = decoder is correctly initialized.
|
||||
};
|
||||
|
||||
typedef ::boost::shared_ptr< BiffDecoderBase > BiffDecoderRef;
|
||||
|
@ -101,31 +97,18 @@ typedef ::boost::shared_ptr< BiffDecoderBase > BiffDecoderRef;
|
|||
class BiffDecoder_XOR : public BiffDecoderBase
|
||||
{
|
||||
public:
|
||||
/** Constructs the decoder.
|
||||
|
||||
Checks if the passed key and hash specify workbook protection. Asks for
|
||||
a password otherwise.
|
||||
|
||||
@param nKey
|
||||
Password key from FILEPASS record to verify password.
|
||||
@param nHash
|
||||
Password hash value from FILEPASS record to verify password.
|
||||
*/
|
||||
explicit BiffDecoder_XOR(
|
||||
const WorkbookHelper& rHelper,
|
||||
sal_uInt16 nKey, sal_uInt16 nHash );
|
||||
explicit BiffDecoder_XOR( sal_uInt16 nKey, sal_uInt16 nHash );
|
||||
|
||||
private:
|
||||
/** Copy constructor for cloning. */
|
||||
BiffDecoder_XOR( const BiffDecoder_XOR& rDecoder );
|
||||
|
||||
/** Initializes the wrapped codec object. After that, internal status can
|
||||
be querried with isValid(). */
|
||||
void init( const ::rtl::OString& rPass );
|
||||
|
||||
/** Returns a clone of the decoder for usage in new streams. */
|
||||
virtual BiffDecoder_XOR* implClone();
|
||||
|
||||
/** Implements password verification and initialization of the decoder. */
|
||||
virtual bool implVerify( const ::rtl::OUString& rPassword );
|
||||
|
||||
/** Implementation of decryption of a memory block. */
|
||||
virtual void implDecode(
|
||||
sal_uInt8* pnDestData,
|
||||
|
@ -135,7 +118,7 @@ private:
|
|||
|
||||
private:
|
||||
::oox::core::BinaryCodec_XOR maCodec; /// Cipher algorithm implementation.
|
||||
::rtl::OString maPass;
|
||||
::std::vector< sal_uInt8 > maPassword;
|
||||
sal_uInt16 mnKey;
|
||||
sal_uInt16 mnHash;
|
||||
};
|
||||
|
@ -146,35 +129,21 @@ private:
|
|||
class BiffDecoder_RCF : public BiffDecoderBase
|
||||
{
|
||||
public:
|
||||
/** Constructs the decoder.
|
||||
|
||||
Checks if the passed salt data specifies workbook protection. Asks for
|
||||
a password otherwise.
|
||||
|
||||
@param pnDocId
|
||||
Unique document identifier from FILEPASS record.
|
||||
@param pnSaltData
|
||||
Salt data from FILEPASS record.
|
||||
@param pnSaltHash
|
||||
Salt hash value from FILEPASS record.
|
||||
*/
|
||||
explicit BiffDecoder_RCF(
|
||||
const WorkbookHelper& rHelper,
|
||||
sal_uInt8 pnDocId[ 16 ],
|
||||
sal_uInt8 pnSaltData[ 16 ],
|
||||
sal_uInt8 pnSaltHash[ 16 ] );
|
||||
sal_uInt8 pnSalt[ 16 ],
|
||||
sal_uInt8 pnVerifier[ 16 ],
|
||||
sal_uInt8 pnVerifierHash[ 16 ] );
|
||||
|
||||
private:
|
||||
/** Copy constructor for cloning. */
|
||||
BiffDecoder_RCF( const BiffDecoder_RCF& rDecoder );
|
||||
|
||||
/** Initializes the wrapped codec object. After that, internal status can
|
||||
be querried with isValid(). */
|
||||
void init( const ::rtl::OUString& rPass );
|
||||
|
||||
/** Returns a clone of the decoder for usage in new streams. */
|
||||
virtual BiffDecoder_RCF* implClone();
|
||||
|
||||
/** Implements password verification and initialization of the decoder. */
|
||||
virtual bool implVerify( const ::rtl::OUString& rPassword );
|
||||
|
||||
/** Implementation of decryption of a memory block. */
|
||||
virtual void implDecode(
|
||||
sal_uInt8* pnDestData,
|
||||
|
@ -184,10 +153,10 @@ private:
|
|||
|
||||
private:
|
||||
::oox::core::BinaryCodec_RCF maCodec; /// Cipher algorithm implementation.
|
||||
::rtl::OUString maPass;
|
||||
::std::vector< sal_uInt8 > maDocId;
|
||||
::std::vector< sal_uInt8 > maSaltData;
|
||||
::std::vector< sal_uInt8 > maSaltHash;
|
||||
::std::vector< sal_uInt16 > maPassword;
|
||||
::std::vector< sal_uInt8 > maSalt;
|
||||
::std::vector< sal_uInt8 > maVerifier;
|
||||
::std::vector< sal_uInt8 > maVerifierHash;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
@ -198,30 +167,16 @@ class BiffCodecHelper : public WorkbookHelper
|
|||
public:
|
||||
explicit BiffCodecHelper( const WorkbookHelper& rHelper );
|
||||
|
||||
/** Returns the fixed password for workbook protection. */
|
||||
static const ::rtl::OString& getBiff5WbProtPassword();
|
||||
/** Returns the fixed password for workbook protection. */
|
||||
static const ::rtl::OUString& getBiff8WbProtPassword();
|
||||
/** Implementation helper, reads the FILEPASS and returns a decoder object. */
|
||||
static BiffDecoderRef implReadFilePass( BiffInputStream& rStrm, BiffType eBiff );
|
||||
|
||||
/** Looks for a password provided via API, or queries it via GUI. */
|
||||
::rtl::OUString queryPassword();
|
||||
|
||||
/** Imports the FILEPASS record and sets a decoder at the stream. */
|
||||
/** Imports the FILEPASS record, asks for a password and sets a decoder at the stream. */
|
||||
bool importFilePass( BiffInputStream& rStrm );
|
||||
/** Clones the contained decoder object if existing and sets it at the passed stream. */
|
||||
void cloneDecoder( BiffInputStream& rStrm );
|
||||
|
||||
private:
|
||||
void importFilePass_XOR( BiffInputStream& rStrm );
|
||||
void importFilePass_RCF( BiffInputStream& rStrm );
|
||||
void importFilePass_Strong( BiffInputStream& rStrm );
|
||||
void importFilePass2( BiffInputStream& rStrm );
|
||||
void importFilePass8( BiffInputStream& rStrm );
|
||||
|
||||
private:
|
||||
BiffDecoderRef mxDecoder; /// The decoder for import filter.
|
||||
::rtl::OUString maPassword; /// Password for stream encoder/decoder.
|
||||
bool mbHasPassword; /// True = password already querried.
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
@ -120,6 +120,7 @@ const sal_Int32 OOBIN_ID_EXTROW = 0x016E;
|
|||
const sal_Int32 OOBIN_ID_EXTSHEETDATA = 0x016B;
|
||||
const sal_Int32 OOBIN_ID_EXTERNALNAMEFLAGS = 0x024A;
|
||||
const sal_Int32 OOBIN_ID_EXTSHEETNAMES = 0x0167;
|
||||
const sal_Int32 OOBIN_ID_FILESHARING = 0x0224;
|
||||
const sal_Int32 OOBIN_ID_FILEVERSION = 0x0080;
|
||||
const sal_Int32 OOBIN_ID_FILL = 0x002D;
|
||||
const sal_Int32 OOBIN_ID_FILLS = 0x025B;
|
||||
|
@ -369,6 +370,7 @@ const sal_uInt16 BIFF5_ID_EXTERNALNAME = 0x0023;
|
|||
const sal_uInt16 BIFF_ID_EXTERNSHEET = 0x0017;
|
||||
const sal_uInt16 BIFF_ID_EXTSST = 0x00FF;
|
||||
const sal_uInt16 BIFF_ID_FILEPASS = 0x002F;
|
||||
const sal_uInt16 BIFF_ID_FILESHARING = 0x005B;
|
||||
const sal_uInt16 BIFF2_ID_FONT = 0x0031;
|
||||
const sal_uInt16 BIFF3_ID_FONT = 0x0231;
|
||||
const sal_uInt16 BIFF5_ID_FONT = 0x0031;
|
||||
|
@ -388,6 +390,7 @@ const sal_uInt16 BIFF_ID_HYPERLINK = 0x01B8;
|
|||
const sal_uInt16 BIFF3_ID_IMGDATA = 0x007F;
|
||||
const sal_uInt16 BIFF8_ID_IMGDATA = 0x00E9;
|
||||
const sal_uInt16 BIFF2_ID_INTEGER = 0x0002;
|
||||
const sal_uInt16 BIFF_ID_INTERFACEHDR = 0x00E1;
|
||||
const sal_uInt16 BIFF_ID_ITERATION = 0x0011;
|
||||
const sal_uInt16 BIFF_ID_IXFE = 0x0044;
|
||||
const sal_uInt16 BIFF2_ID_LABEL = 0x0004;
|
||||
|
@ -467,6 +470,7 @@ const sal_uInt16 BIFF_ID_STANDARDWIDTH = 0x0099;
|
|||
const sal_uInt16 BIFF2_ID_STRING = 0x0007;
|
||||
const sal_uInt16 BIFF3_ID_STRING = 0x0207;
|
||||
const sal_uInt16 BIFF_ID_STYLE = 0x0293;
|
||||
const sal_uInt16 BIFF_ID_STYLEEXT = 0x0892;
|
||||
const sal_uInt16 BIFF_ID_SXEXT = 0x00DC;
|
||||
const sal_uInt16 BIFF_ID_TOPMARGIN = 0x0028;
|
||||
const sal_uInt16 BIFF_ID_TXO = 0x01B6;
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
const WorkbookHelper& rHelper,
|
||||
const ::rtl::OUString& rFragmentPath,
|
||||
ISegmentProgressBarRef xProgressBar,
|
||||
sal_Int32 nSheet );
|
||||
sal_Int16 nSheet );
|
||||
|
||||
protected:
|
||||
// oox.core.ContextHandler2Helper interface -------------------------------
|
||||
|
@ -76,7 +76,7 @@ public:
|
|||
explicit BiffChartsheetFragment(
|
||||
const BiffWorkbookFragmentBase& rParent,
|
||||
ISegmentProgressBarRef xProgressBar,
|
||||
sal_Int32 nSheet );
|
||||
sal_Int16 nSheet );
|
||||
|
||||
/** Imports the entire sheet fragment, returns true, if EOF record has been reached. */
|
||||
virtual bool importFragment();
|
||||
|
|
|
@ -86,17 +86,12 @@ struct DefinedNameModel
|
|||
class DefinedNameBase : public WorkbookHelper
|
||||
{
|
||||
public:
|
||||
explicit DefinedNameBase( const WorkbookHelper& rHelper, sal_Int32 nLocalSheet );
|
||||
|
||||
/** Returns true, if this defined name is global in the document. */
|
||||
inline bool isGlobalName() const { return maModel.mnSheet < 0; }
|
||||
explicit DefinedNameBase( const WorkbookHelper& rHelper );
|
||||
|
||||
/** Returns the original name as imported from or exported to the file. */
|
||||
inline const ::rtl::OUString& getModelName() const { return maModel.maName; }
|
||||
/** Returns the name as used in the Calc document. */
|
||||
inline const ::rtl::OUString& getCalcName() const { return maCalcName; }
|
||||
/** Returns the 0-based sheet index for local names, or -1 for global names. */
|
||||
inline sal_Int32 getSheetIndex() const { return maModel.mnSheet; }
|
||||
|
||||
/** Returns the original name as imported from or exported to the file. */
|
||||
const ::rtl::OUString& getUpcaseModelName() const;
|
||||
|
@ -105,21 +100,19 @@ public:
|
|||
|
||||
protected:
|
||||
/** Imports the OOX formula string, using the passed formula context. */
|
||||
void importOoxFormula( FormulaContext& rContext );
|
||||
void importOoxFormula( FormulaContext& rContext, sal_Int16 nBaseSheet );
|
||||
/** Imports the OOBIN formula, using the passed formula context. */
|
||||
void importOobFormula( FormulaContext& rContext, RecordInputStream& rStrm );
|
||||
void importOobFormula( FormulaContext& rContext, sal_Int16 nBaseSheet, RecordInputStream& rStrm );
|
||||
/** Imports the BIFF formula, using the passed formula context. */
|
||||
void importBiffFormula( FormulaContext& rContext, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 );
|
||||
void importBiffFormula( FormulaContext& rContext, sal_Int16 nBaseSheet, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 );
|
||||
|
||||
/** Tries to convert the passed token sequence to a SingleReference or ComplexReference. */
|
||||
void setReference( const ApiTokenSequence& rTokens );
|
||||
void extractReference( const ApiTokenSequence& rTokens );
|
||||
|
||||
protected:
|
||||
DefinedNameModel maModel; /// Model data for this defined name.
|
||||
mutable ::rtl::OUString maUpModelName; /// Model name converted to uppercase ASCII.
|
||||
::rtl::OUString maCalcName; /// Final name used in the Calc document.
|
||||
|
||||
private:
|
||||
::com::sun::star::uno::Any maRefAny; /// Single cell/range reference.
|
||||
};
|
||||
|
||||
|
@ -128,7 +121,7 @@ private:
|
|||
class DefinedName : public DefinedNameBase
|
||||
{
|
||||
public:
|
||||
explicit DefinedName( const WorkbookHelper& rHelper, sal_Int32 nLocalSheet );
|
||||
explicit DefinedName( const WorkbookHelper& rHelper );
|
||||
|
||||
/** Sets the attributes for this defined name from the passed attribute set. */
|
||||
void importDefinedName( const AttributeList& rAttribs );
|
||||
|
@ -137,7 +130,7 @@ public:
|
|||
/** Imports the defined name from a DEFINEDNAME record in the passed stream. */
|
||||
void importDefinedName( RecordInputStream& rStrm );
|
||||
/** Imports the defined name from a DEFINEDNAME record in the passed BIFF stream. */
|
||||
void importDefinedName( BiffInputStream& rStrm );
|
||||
void importDefinedName( BiffInputStream& rStrm, sal_Int16 nCalcSheet );
|
||||
|
||||
/** Creates a defined name in the Calc document. */
|
||||
void createNameObject();
|
||||
|
@ -148,9 +141,13 @@ public:
|
|||
inline bool isBuiltinName() const { return mcBuiltinId != OOX_DEFNAME_UNKNOWN; }
|
||||
/** Returns true, if this defined name is a macro function call. */
|
||||
inline bool isMacroFunction() const { return maModel.mbMacro && maModel.mbFunction; }
|
||||
/** Returns true, if this defined name is global in the document. */
|
||||
inline bool isGlobalName() const { return mnCalcSheet < 0; }
|
||||
|
||||
/** Returns the token index used in API token arrays (com.sun.star.sheet.FormulaToken). */
|
||||
inline sal_Int32 getTokenIndex() const { return mnTokenIndex; }
|
||||
/** Returns the 0-based sheet index for local names, or -1 for global names. */
|
||||
inline sal_Int16 getLocalCalcSheet() const { return mnCalcSheet; }
|
||||
/** Tries to resolve the defined name to an absolute cell range. */
|
||||
bool getAbsoluteRange( ::com::sun::star::table::CellRangeAddress& orRange ) const;
|
||||
|
||||
|
@ -167,6 +164,7 @@ private:
|
|||
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange >
|
||||
mxNamedRange; /// XNamedRange interface of the defined name.
|
||||
sal_Int32 mnTokenIndex; /// Name index used in API token array.
|
||||
sal_Int16 mnCalcSheet; /// Calc sheet index for sheet-local names.
|
||||
sal_Unicode mcBuiltinId; /// Identifier for built-in defined names.
|
||||
StreamDataSeqPtr mxFormula; /// Formula data for OOBIN import.
|
||||
BiffStreamPosPtr mxBiffStrm; /// Cached BIFF stream for formula import.
|
||||
|
@ -182,9 +180,9 @@ class DefinedNamesBuffer : public WorkbookHelper
|
|||
public:
|
||||
explicit DefinedNamesBuffer( const WorkbookHelper& rHelper );
|
||||
|
||||
/** Sets the current sheet index for files with local defined names, e.g.
|
||||
BIFF4 workspaces. All created names initially will contain this index. */
|
||||
void setLocalSheetIndex( sal_Int32 nLocalSheet );
|
||||
/** Sets the sheet index for local names (BIFF2-BIFF4 only). */
|
||||
void setLocalCalcSheet( sal_Int16 nCalcSheet );
|
||||
|
||||
/** Imports a defined name from the passed attribute set. */
|
||||
DefinedNameRef importDefinedName( const AttributeList& rAttribs );
|
||||
/** Imports a defined name from a DEFINEDNAME record in the passed stream. */
|
||||
|
@ -203,7 +201,7 @@ public:
|
|||
@param nSheet The sheet index for local names or -1 for global names.
|
||||
If no local name is found, tries to find a matching global name.
|
||||
@return Reference to the defined name or empty reference. */
|
||||
DefinedNameRef getByModelName( const ::rtl::OUString& rModelName, sal_Int32 nSheet = -1 ) const;
|
||||
DefinedNameRef getByModelName( const ::rtl::OUString& rModelName, sal_Int16 nCalcSheet = -1 ) const;
|
||||
|
||||
private:
|
||||
DefinedNameRef createDefinedName();
|
||||
|
@ -213,8 +211,8 @@ private:
|
|||
typedef RefMap< sal_Int32, DefinedName > DefNameMap;
|
||||
|
||||
DefNameVector maDefNames; /// List of all defined names in insertion order.
|
||||
DefNameMap maDefNameMap; /// Maps all defined names by API token index. */
|
||||
sal_Int32 mnLocalSheet; /// Current sheet index for import of BIFF sheet-local names.
|
||||
DefNameMap maDefNameMap; /// Maps all defined names by API token index.
|
||||
sal_Int16 mnCalcSheet; /// Current sheet index for BIFF2-BIFF4 names (always sheet-local).
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
@ -170,6 +170,12 @@ class VmlDrawing : public ::oox::vml::Drawing, public WorksheetHelper
|
|||
public:
|
||||
explicit VmlDrawing( const WorksheetHelper& rHelper );
|
||||
|
||||
/** Returns the drawing shape for a cell note at the specified position. */
|
||||
const ::oox::vml::ShapeBase* getNoteShape( const ::com::sun::star::table::CellAddress& rPos ) const;
|
||||
|
||||
/** Filters cell note shapes. */
|
||||
virtual bool isShapeSupported( const ::oox::vml::ShapeBase& rShape ) const;
|
||||
|
||||
/** Calculates the shape rectangle from a cell anchor string. */
|
||||
virtual bool convertShapeClientAnchor(
|
||||
::com::sun::star::awt::Rectangle& orShapeRect,
|
||||
|
|
|
@ -41,7 +41,23 @@ namespace xls {
|
|||
|
||||
class WorkbookHelper;
|
||||
|
||||
class ExcelFilter : public ::oox::core::XmlFilterBase
|
||||
class ExcelFilterBase
|
||||
{
|
||||
protected:
|
||||
explicit ExcelFilterBase();
|
||||
virtual ~ExcelFilterBase();
|
||||
|
||||
void setWorkbookHelper( WorkbookHelper& rHelper );
|
||||
WorkbookHelper& getWorkbookHelper() const;
|
||||
void clearWorkbookHelper();
|
||||
|
||||
private:
|
||||
WorkbookHelper* mpHelper; /// Nonowning pointer to helper base.
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
class ExcelFilter : public ::oox::core::XmlFilterBase, public ExcelFilterBase
|
||||
{
|
||||
public:
|
||||
explicit ExcelFilter(
|
||||
|
@ -51,23 +67,21 @@ public:
|
|||
virtual bool importDocument() throw();
|
||||
virtual bool exportDocument() throw();
|
||||
|
||||
virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
|
||||
virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
|
||||
virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
|
||||
virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const;
|
||||
|
||||
virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
|
||||
virtual ::oox::vml::Drawing* getVmlDrawing();
|
||||
virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles();
|
||||
virtual ::oox::drawingml::chart::ChartConverter& getChartConverter();
|
||||
|
||||
private:
|
||||
virtual ::rtl::OUString implGetImplementationName() const;
|
||||
|
||||
private:
|
||||
WorkbookHelper* mpHelper; /// Nonowning pointer to helper base.
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
class ExcelBiffFilter : public ::oox::core::BinaryFilterBase
|
||||
class ExcelBiffFilter : public ::oox::core::BinaryFilterBase, public ExcelFilterBase
|
||||
{
|
||||
public:
|
||||
explicit ExcelBiffFilter(
|
||||
|
@ -77,6 +91,8 @@ public:
|
|||
virtual bool importDocument() throw();
|
||||
virtual bool exportDocument() throw();
|
||||
|
||||
virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const;
|
||||
|
||||
private:
|
||||
virtual ::rtl::OUString implGetImplementationName() const;
|
||||
};
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
ParentType& rParent,
|
||||
ISegmentProgressBarRef xProgressBar,
|
||||
WorksheetType eSheetType,
|
||||
sal_Int32 nSheet );
|
||||
sal_Int16 nSheet );
|
||||
|
||||
template< typename ParentType >
|
||||
explicit OoxWorksheetContextBase( ParentType& rParent );
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
|
||||
template< typename ParentType >
|
||||
OoxWorksheetContextBase::OoxWorksheetContextBase( ParentType& rParent,
|
||||
ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
|
||||
ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
|
||||
::oox::core::ContextHandler2( rParent ),
|
||||
WorksheetHelperRoot( rParent, xProgressBar, eSheetType, nSheet )
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ public:
|
|||
const ::rtl::OUString& rFragmentPath,
|
||||
ISegmentProgressBarRef xProgressBar,
|
||||
WorksheetType eSheetType,
|
||||
sal_Int32 nSheet );
|
||||
sal_Int16 nSheet );
|
||||
|
||||
explicit OoxWorksheetFragmentBase(
|
||||
const WorksheetHelper& rHelper,
|
||||
|
@ -236,7 +236,7 @@ protected:
|
|||
const ParentType& rParent,
|
||||
ISegmentProgressBarRef xProgressBar,
|
||||
WorksheetType eSheetType,
|
||||
sal_Int32 nSheet );
|
||||
sal_Int16 nSheet );
|
||||
|
||||
template< typename ParentType >
|
||||
explicit BiffWorksheetContextBase( const ParentType& rParent );
|
||||
|
@ -246,7 +246,7 @@ protected:
|
|||
|
||||
template< typename ParentType >
|
||||
BiffWorksheetContextBase::BiffWorksheetContextBase( const ParentType& rParent,
|
||||
ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
|
||||
ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
|
||||
BiffContextHandler( rParent ),
|
||||
WorksheetHelperRoot( rParent, xProgressBar, eSheetType, nSheet )
|
||||
{
|
||||
|
@ -346,7 +346,7 @@ protected:
|
|||
const BiffWorkbookFragmentBase& rParent,
|
||||
ISegmentProgressBarRef xProgressBar,
|
||||
WorksheetType eSheetType,
|
||||
sal_Int32 nSheet );
|
||||
sal_Int16 nSheet );
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
@ -359,7 +359,7 @@ public:
|
|||
explicit BiffSkipWorksheetFragment(
|
||||
const BiffWorkbookFragmentBase& rParent,
|
||||
ISegmentProgressBarRef xProgressBar,
|
||||
sal_Int32 nSheet );
|
||||
sal_Int16 nSheet );
|
||||
|
||||
virtual bool importFragment();
|
||||
};
|
||||
|
|
|
@ -70,9 +70,7 @@ class ExternalLink;
|
|||
class ExternalName : public DefinedNameBase
|
||||
{
|
||||
public:
|
||||
explicit ExternalName(
|
||||
const ExternalLink& rParentLink,
|
||||
sal_Int32 nLocalSheet );
|
||||
explicit ExternalName( const ExternalLink& rParentLink );
|
||||
|
||||
/** Appends the passed value to the result set. */
|
||||
template< typename Type >
|
||||
|
@ -109,8 +107,10 @@ public:
|
|||
/** Returns true, if the name refers to an OLE object. */
|
||||
inline bool isOleObject() const { return maExtNameModel.mbOleObj; }
|
||||
|
||||
#if 0
|
||||
/** Returns the sheet cache index if this is a sheet-local external name. */
|
||||
sal_Int32 getSheetCacheIndex() const;
|
||||
#endif
|
||||
|
||||
/** Returns the DDE item info needed by the XML formula parser. */
|
||||
bool getDdeItemInfo(
|
||||
|
@ -123,6 +123,8 @@ public:
|
|||
::rtl::OUString& orDdeItem );
|
||||
|
||||
private:
|
||||
/** Tries to convert the passed token sequence to an ExternalReference. */
|
||||
void extractExternalReference( const ApiTokenSequence& rTokens );
|
||||
/** Sets the size of the result matrix. */
|
||||
void setResultSize( sal_Int32 nColumns, sal_Int32 nRows );
|
||||
|
||||
|
@ -265,14 +267,20 @@ public:
|
|||
|
||||
/** Returns the type of the external library if this is a library link. */
|
||||
FunctionLibraryType getFuncLibraryType() const;
|
||||
/** Returns the internal sheet index or external sheet cache index for the passed sheet. */
|
||||
sal_Int32 getSheetIndex( sal_Int32 nTabId = 0 ) const;
|
||||
/** Returns the internal sheet range or range of external sheet caches for the passed sheet range (BIFF only). */
|
||||
void getSheetRange( LinkSheetRange& orSheetRange, sal_Int32 nTabId1, sal_Int32 nTabId2 ) const;
|
||||
|
||||
/** Returns the internal Calc sheet index or for the passed sheet. */
|
||||
sal_Int16 getCalcSheetIndex( sal_Int32 nTabId = 0 ) const;
|
||||
|
||||
/** Returns the token index of the external document. */
|
||||
sal_Int32 getDocumentLinkIndex() const;
|
||||
/** Returns the external sheet cache index or for the passed sheet. */
|
||||
sal_Int32 getSheetCacheIndex( sal_Int32 nTabId = 0 ) const;
|
||||
/** Returns the sheet cache of the external sheet with the passed index. */
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >
|
||||
getExternalSheetCache( sal_Int32 nTabId );
|
||||
getSheetCache( sal_Int32 nTabId ) const;
|
||||
|
||||
/** Returns the internal sheet range or range of external sheet caches for the passed sheet range (BIFF only). */
|
||||
void getSheetRange( LinkSheetRange& orSheetRange, sal_Int32 nTabId1, sal_Int32 nTabId2 ) const;
|
||||
|
||||
/** Returns the external name with the passed zero-based index. */
|
||||
ExternalNameRef getNameByIndex( sal_Int32 nIndex ) const;
|
||||
|
@ -289,7 +297,8 @@ private:
|
|||
ExternalNameRef createExternalName();
|
||||
|
||||
private:
|
||||
typedef ::std::vector< sal_Int32 > IndexVector;
|
||||
typedef ::std::vector< sal_Int16 > Int16Vector;
|
||||
typedef ::std::vector< sal_Int32 > Int32Vector;
|
||||
typedef RefVector< ExternalName > ExternalNameVector;
|
||||
|
||||
ExternalLinkType meLinkType; /// Type of this link object.
|
||||
|
@ -299,7 +308,8 @@ private:
|
|||
::rtl::OUString maTargetUrl; /// Target link, DDE topic, OLE target.
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalDocLink >
|
||||
mxDocLink; /// Interface for an external document.
|
||||
IndexVector maIndexes; /// Internal sheet indexes or external sheet cache indexes.
|
||||
Int16Vector maCalcSheets; /// Internal sheet indexes.
|
||||
Int32Vector maSheetCaches; /// External sheet cache indexes.
|
||||
ExternalNameVector maExtNames; /// Defined names in external document.
|
||||
};
|
||||
|
||||
|
|
|
@ -58,8 +58,6 @@ const size_t BIFF_TOKARR_MAXLEN = 4096; /// Maximum size of
|
|||
// token class flags ----------------------------------------------------------
|
||||
|
||||
const sal_uInt8 BIFF_TOKCLASS_MASK = 0x60;
|
||||
const sal_uInt8 BIFF_TOKID_MASK = 0x1F;
|
||||
|
||||
const sal_uInt8 BIFF_TOKCLASS_NONE = 0x00; /// 00-1F: Base tokens.
|
||||
const sal_uInt8 BIFF_TOKCLASS_REF = 0x20; /// 20-3F: Reference class tokens.
|
||||
const sal_uInt8 BIFF_TOKCLASS_VAL = 0x40; /// 40-5F: Value class tokens.
|
||||
|
@ -69,6 +67,8 @@ const sal_uInt8 BIFF_TOKFLAG_INVALID = 0x80; /// This bit must be
|
|||
|
||||
// base token identifiers -----------------------------------------------------
|
||||
|
||||
const sal_uInt8 BIFF_TOKID_MASK = 0x1F;
|
||||
|
||||
const sal_uInt8 BIFF_TOKID_NONE = 0x00; /// Placeholder for invalid token id.
|
||||
const sal_uInt8 BIFF_TOKID_EXP = 0x01; /// Array or shared formula reference.
|
||||
const sal_uInt8 BIFF_TOKID_TBL = 0x02; /// Multiple operation reference.
|
||||
|
@ -361,6 +361,115 @@ struct ApiOpCodes
|
|||
sal_Int32 OPCODE_RANGE; /// Range operator.
|
||||
};
|
||||
|
||||
// Function parameter info ====================================================
|
||||
|
||||
/** Enumerates validity modes for a function parameter. */
|
||||
enum FuncParamValidity
|
||||
{
|
||||
FUNC_PARAM_NONE = 0, /// Default for an unspecified entry in a C-array.
|
||||
FUNC_PARAM_REGULAR, /// Parameter supported by Calc and Excel.
|
||||
FUNC_PARAM_CALCONLY, /// Parameter supported by Calc only.
|
||||
FUNC_PARAM_EXCELONLY /// Parameter supported by Excel only.
|
||||
};
|
||||
|
||||
/** Enumerates different types of token class conversion in function parameters. */
|
||||
enum FuncParamConversion
|
||||
{
|
||||
FUNC_PARAMCONV_ORG, /// Use original class of current token.
|
||||
FUNC_PARAMCONV_VAL, /// Convert tokens to VAL class.
|
||||
FUNC_PARAMCONV_ARR, /// Convert tokens to ARR class.
|
||||
FUNC_PARAMCONV_RPT, /// Repeat parent conversion in VALTYPE parameters.
|
||||
FUNC_PARAMCONV_RPX, /// Repeat parent conversion in REFTYPE parameters.
|
||||
FUNC_PARAMCONV_RPO /// Repeat parent conversion in operands of operators.
|
||||
};
|
||||
|
||||
/** Structure that contains all needed information for a parameter in a
|
||||
function.
|
||||
|
||||
The member meValid specifies which application supports the parameter. If
|
||||
set to CALCONLY, import filters have to insert a default value for this
|
||||
parameter, and export filters have to skip the parameter. If set to
|
||||
EXCELONLY, import filters have to skip the parameter, and export filters
|
||||
have to insert a default value for this parameter.
|
||||
|
||||
The member mbValType specifies whether the parameter requires tokens to be
|
||||
of value type (VAL or ARR class).
|
||||
|
||||
If set to false, the parameter is called to be REFTYPE. Tokens with REF
|
||||
default class can be inserted for the parameter (e.g. tAreaR tokens).
|
||||
|
||||
If set to true, the parameter is called to be VALTYPE. Tokens with REF
|
||||
class need to be converted to VAL tokens first (e.g. tAreaR will be
|
||||
converted to tAreaV), and further conversion is done according to this
|
||||
new token class.
|
||||
|
||||
The member meConv specifies how to convert the current token class of the
|
||||
token inserted for the parameter. If the token class is still REF this
|
||||
means that the token has default REF class and the parameter is REFTYPE
|
||||
(see member mbValType), the token will not be converted at all and remains
|
||||
in REF class. Otherwise, token class conversion is depending on the actual
|
||||
token class of the return value of the function containing this parameter.
|
||||
The function may return REF class (tFuncR, tFuncVarR, tFuncCER), or it may
|
||||
return VAL or ARR class (tFuncV, tFuncA, tFuncVarV, tFuncVarA, tFuncCEV,
|
||||
tFuncCEA). Even if the function is able to return REF class, it may return
|
||||
VAL or ARR class instead due to the VALTYPE data type of the parent
|
||||
function parameter that calls the own function. Example: The INDIRECT
|
||||
function returns REF class by default. But if called from a VALTYPE
|
||||
function parameter, e.g. in the formula =ABS(INDIRECT("A1")), it returns
|
||||
VAL or ARR class instead. Additionally, the repeating conversion types RPT
|
||||
and RPX rely on the conversion executed for the function token class.
|
||||
|
||||
1) ORG:
|
||||
Use the original class of the token (VAL or ARR), regardless of any
|
||||
conversion done for the function return class.
|
||||
|
||||
2) VAL:
|
||||
Convert ARR tokens to VAL class, regardless of any conversion done for
|
||||
the function return class.
|
||||
|
||||
3) ARR:
|
||||
Convert VAL tokens to ARR class, regardless of any conversion done for
|
||||
the function return class.
|
||||
|
||||
4) RPT:
|
||||
If the own function returns REF class (thus it is called from a REFTYPE
|
||||
parameter, see above), and the parent conversion type (for the function
|
||||
return class) was ORG, VAL, or ARR, ignore that conversion and always
|
||||
use VAL conversion for the own token instead. If the parent conversion
|
||||
type was RPT or RPX, repeat the conversion that would have been used if
|
||||
the function would return value type.
|
||||
If the own function returns value type (VAL or ARR class, see above),
|
||||
and the parent conversion type (for the function return class) was ORG,
|
||||
VAL, ARR, or RPT, repeat this conversion for the own token. If the
|
||||
parent conversion type was RPX, always use ORG conversion type for the
|
||||
own token instead.
|
||||
|
||||
5) RPX:
|
||||
This type of conversion only occurs in functions returning VAL class by
|
||||
default. If the own token is value type, and the VAL return class of
|
||||
the own function has been changed to ARR class (due to direct ARR
|
||||
conversion, or due to ARR conversion repeated by RPT or RPX), set the
|
||||
own token to ARR type. Otherwise use the original token type (VAL
|
||||
conversion from parent parameter will not be repeated at all). If
|
||||
nested functions have RPT or value-type RPX parameters, they will not
|
||||
repeat this conversion type, but will use ORG conversion instead (see
|
||||
description of RPT above).
|
||||
|
||||
6) RPO:
|
||||
This type of conversion is only used for the operands of all operators
|
||||
(unary and binary arithmetic operators, comparison operators, and range
|
||||
operators). It is not used for function parameters. On conversion, it
|
||||
will be replaced by the last conversion type that was not the RPO
|
||||
conversion. This leads to a slightly different behaviour than the RPT
|
||||
conversion for operands in conjunction with a parent RPX conversion.
|
||||
*/
|
||||
struct FunctionParamInfo
|
||||
{
|
||||
FuncParamValidity meValid; /// Parameter validity.
|
||||
FuncParamConversion meConv; /// Token class conversion type.
|
||||
bool mbValType; /// Data type (false = REFTYPE, true = VALTYPE).
|
||||
};
|
||||
|
||||
// function data ==============================================================
|
||||
|
||||
/** This enumeration contains constants for all known external libraries
|
||||
|
@ -373,23 +482,13 @@ enum FunctionLibraryType
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
const sal_uInt8 FUNCINFO_MAXPARAM = 30; /// Maximum parameter count.
|
||||
|
||||
const sal_uInt8 FUNCINFO_PARAM_EXCELONLY = 0x01; /// Flag for a parameter existing in Excel, but not in Calc.
|
||||
const sal_uInt8 FUNCINFO_PARAM_CALCONLY = 0x02; /// Flag for a parameter existing in Calc, but not in Excel.
|
||||
const sal_uInt8 FUNCINFO_PARAM_INVALID = 0x04; /// Flag for an invalid token class.
|
||||
|
||||
/** Represents information for a spreadsheet function.
|
||||
|
||||
The member mpnParamClass contains an array of BIFF token classes for each
|
||||
parameter of the function. The last existing (non-null) value in this array
|
||||
is used for all following parameters used in a function. Additionally to
|
||||
the three actual token classes, this array may contain the special values
|
||||
FUNCINFO_PARAM_CALCONLY, FUNCINFO_PARAM_EXCELONLY, and
|
||||
FUNCINFO_PARAM_INVALID. The former two specify parameters only existing in
|
||||
one of the applications. FUNCINFO_PARAM_INVALID is simply a terminator for
|
||||
the array to prevent repetition of the last token class or special value
|
||||
for additional parameters.
|
||||
The member mpParamInfos points to an array of type information structures
|
||||
for all parameters of the function. The last initialized structure
|
||||
describing a regular parameter (member meValid == EXC_PARAMVALID_ALWAYS) in
|
||||
this array is used repeatedly for all following parameters supported by a
|
||||
function.
|
||||
*/
|
||||
struct FunctionInfo
|
||||
{
|
||||
|
@ -404,7 +503,8 @@ struct FunctionInfo
|
|||
sal_uInt8 mnMinParamCount; /// Minimum number of parameters.
|
||||
sal_uInt8 mnMaxParamCount; /// Maximum number of parameters.
|
||||
sal_uInt8 mnRetClass; /// BIFF token class of the return value.
|
||||
const sal_uInt8* mpnParamClass; /// Expected BIFF token classes of parameters.
|
||||
const FunctionParamInfo* mpParamInfos; /// Information about all parameters.
|
||||
bool mbParamPairs; /// true = optional parameters are expected to appear in pairs.
|
||||
bool mbVolatile; /// True = volatile function.
|
||||
bool mbExternal; /// True = external function in Calc.
|
||||
bool mbMacroFunc; /// True = macro sheet function or command.
|
||||
|
@ -415,28 +515,28 @@ typedef RefVector< FunctionInfo > FunctionInfoVector;
|
|||
|
||||
// function info parameter class iterator =====================================
|
||||
|
||||
/** Iterator working on the mpnParamClass member of the FunctionInfo struct.
|
||||
/** Iterator working on the mpParamInfos member of the FunctionInfo struct.
|
||||
|
||||
This iterator can be used to iterate through the array containing the
|
||||
expected token classes of function parameters. This iterator repeats the
|
||||
last valid token class in the array - it stops automatically before the
|
||||
first empty array entry or before the end of the array, even for repeated
|
||||
calls to the increment operator.
|
||||
token class conversion information of function parameters. This iterator
|
||||
repeats the last valid structure in the array - it stops automatically
|
||||
before the first empty array entry or before the end of the array, even for
|
||||
repeated calls to the increment operator.
|
||||
*/
|
||||
class FuncInfoParamClassIterator
|
||||
class FunctionParamInfoIterator
|
||||
{
|
||||
public:
|
||||
explicit FuncInfoParamClassIterator( const FunctionInfo& rFuncInfo );
|
||||
explicit FunctionParamInfoIterator( const FunctionInfo& rFuncInfo );
|
||||
|
||||
FuncInfoParamClassIterator& operator++();
|
||||
|
||||
inline sal_uInt8 getParamClass() const { return *mpnParamClass; }
|
||||
inline sal_uInt8 isExcelOnlyParam() const { return getFlag( *mpnParamClass, FUNCINFO_PARAM_EXCELONLY ); }
|
||||
inline sal_uInt8 isCalcOnlyParam() const { return getFlag( *mpnParamClass, FUNCINFO_PARAM_CALCONLY ); }
|
||||
const FunctionParamInfo& getParamInfo() const;
|
||||
bool isCalcOnlyParam() const;
|
||||
bool isExcelOnlyParam() const;
|
||||
FunctionParamInfoIterator& operator++();
|
||||
|
||||
private:
|
||||
const sal_uInt8* mpnParamClass;
|
||||
const sal_uInt8* mpnParamClassEnd;
|
||||
const FunctionParamInfo* mpParamInfo;
|
||||
const FunctionParamInfo* mpParamInfoEnd;
|
||||
bool mbParamPairs;
|
||||
};
|
||||
|
||||
// base function provider =====================================================
|
||||
|
|
|
@ -71,6 +71,9 @@ public:
|
|||
/** Final processing after import of all strings. */
|
||||
void finalizeImport();
|
||||
|
||||
/** Returns the text data of this portion. */
|
||||
inline const ::rtl::OUString& getText() const { return maText; }
|
||||
|
||||
/** Converts the portion and appends it to the passed XText. */
|
||||
void convert(
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText,
|
||||
|
@ -254,6 +257,9 @@ public:
|
|||
/** Final processing after import of all strings. */
|
||||
void finalizeImport();
|
||||
|
||||
/** Returns the plain text concatenated from all string portions. */
|
||||
::rtl::OUString getPlainText() const;
|
||||
|
||||
/** Converts the string and writes it into the passed XText. */
|
||||
void convert(
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText,
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <com/sun/star/table/CellVertJustify.hpp>
|
||||
#include <com/sun/star/table/TableBorder.hpp>
|
||||
#include "oox/helper/containerhelper.hxx"
|
||||
#include "oox/drawingml/color.hxx"
|
||||
#include "oox/xls/numberformatsbuffer.hxx"
|
||||
|
||||
namespace com { namespace sun { namespace star {
|
||||
|
@ -46,8 +47,6 @@ namespace com { namespace sun { namespace star {
|
|||
|
||||
namespace oox { class PropertySet; }
|
||||
|
||||
#define OOX_XLS_USE_DEFAULT_STYLE 0
|
||||
|
||||
namespace oox {
|
||||
namespace xls {
|
||||
|
||||
|
@ -67,9 +66,6 @@ const sal_Int32 OOX_COLOR_FONTAUTO = 0x7FFF; /// Font auto color (sys
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
const sal_Int32 API_RGB_TRANSPARENT = -1; /// Transparent color for API calls.
|
||||
const sal_Int32 API_RGB_BLACK = 0; /// Black color for API calls.
|
||||
|
||||
const sal_Int16 API_LINE_NONE = 0;
|
||||
const sal_Int16 API_LINE_HAIR = 2;
|
||||
const sal_Int16 API_LINE_THIN = 35;
|
||||
|
@ -85,11 +81,9 @@ const sal_Int8 API_ESCAPEHEIGHT_DEFAULT = 58; /// Relative character h
|
|||
|
||||
// ============================================================================
|
||||
|
||||
class Color
|
||||
class Color : public ::oox::drawingml::Color
|
||||
{
|
||||
public:
|
||||
explicit Color();
|
||||
|
||||
/** Sets the color to automatic. */
|
||||
void setAuto();
|
||||
/** Sets the color to the passed RGB value. */
|
||||
|
@ -115,23 +109,7 @@ public:
|
|||
void importColorRgb( BiffInputStream& rStrm );
|
||||
|
||||
/** Returns true, if the color is set to automatic. */
|
||||
bool isAuto() const;
|
||||
/** Returns the RGB value of the color, or nAuto for automatic colors. */
|
||||
sal_Int32 getColor( const WorkbookHelper& rHelper, sal_Int32 nAuto = API_RGB_TRANSPARENT ) const;
|
||||
|
||||
private:
|
||||
enum ColorMode
|
||||
{
|
||||
COLOR_AUTO, /// Automatic color (dependent on context).
|
||||
COLOR_RGB, /// Hexadecimal RGB color.
|
||||
COLOR_THEME, /// Indexed theme color.
|
||||
COLOR_INDEXED, /// Indexed palette color.
|
||||
COLOR_FINAL /// Finalized RGB color (resolved theme, applied tint).
|
||||
};
|
||||
|
||||
mutable ColorMode meMode; /// Current color mode.
|
||||
mutable sal_Int32 mnValue; /// RGB value, palette index, scheme index.
|
||||
double mfTint; /// Color tint (darken/lighten).
|
||||
inline bool isAuto() const { return isPlaceHolder(); }
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -851,8 +829,6 @@ struct CellStyleModel
|
|||
inline bool isBuiltin() const { return mbBuiltin && (mnBuiltinId >= 0); }
|
||||
/** Returns true, if this style represents the default document cell style. */
|
||||
bool isDefaultStyle() const;
|
||||
/** Returns the style name used in the UI. */
|
||||
::rtl::OUString createStyleName() const;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
@ -868,18 +844,29 @@ public:
|
|||
void importCellStyle( RecordInputStream& rStrm );
|
||||
/** Imports style settings from a STYLE record. */
|
||||
void importStyle( BiffInputStream& rStrm );
|
||||
/** Sets the final style name to be used in the document. */
|
||||
inline void setFinalStyleName( const ::rtl::OUString& rStyleName ) { maFinalName = rStyleName; }
|
||||
|
||||
/** Returns true, if this style is a builtin style. */
|
||||
inline bool isBuiltin() const { return maModel.isBuiltin(); }
|
||||
/** Returns true, if this style represents the default document cell style. */
|
||||
inline bool isDefaultStyle() const { return maModel.isDefaultStyle(); }
|
||||
/** Returns the XF identifier for this cell style. */
|
||||
inline sal_Int32 getXfId() const { return maModel.mnXfId; }
|
||||
/** Calculates a readable style name according to the settings. */
|
||||
::rtl::OUString calcInitialStyleName() const;
|
||||
/** Returns the final style name used in the document. */
|
||||
inline const ::rtl::OUString& getFinalStyleName() const { return maFinalName; }
|
||||
|
||||
/** Creates the style sheet described by the style XF with the passed identifier. */
|
||||
const ::rtl::OUString& createCellStyle( sal_Int32 nXfId, bool bSkipDefaultBuiltin = false );
|
||||
/** Creates the style sheet in the document described by this cell style object. */
|
||||
void createCellStyle();
|
||||
/** Creates the cell style, if it is user-defined or modified built-in. */
|
||||
void finalizeImport();
|
||||
|
||||
private:
|
||||
CellStyleModel maModel;
|
||||
::rtl::OUString maCalcName; /// Final style name used in API.
|
||||
::rtl::OUString maFinalName; /// Final style name used in API.
|
||||
bool mbCreated; /// True = style sheet created.
|
||||
};
|
||||
|
||||
typedef ::boost::shared_ptr< CellStyle > CellStyleRef;
|
||||
|
@ -964,11 +951,8 @@ public:
|
|||
const ::rtl::OUString& createCellStyle( sal_Int32 nXfId ) const;
|
||||
/** Creates the style sheet described by the DXF with the passed identifier. */
|
||||
const ::rtl::OUString& createDxfStyle( sal_Int32 nDxfId ) const;
|
||||
#if OOX_XLS_USE_DEFAULT_STYLE
|
||||
#else
|
||||
/** Returns the default style sheet for unused cells. */
|
||||
const ::rtl::OUString& getDefaultStyleName() const;
|
||||
#endif
|
||||
|
||||
/** Writes the font attributes of the specified font data to the passed property map. */
|
||||
void writeFontToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFontId ) const;
|
||||
|
@ -992,12 +976,13 @@ private:
|
|||
void insertCellStyle( CellStyleRef xCellStyle );
|
||||
|
||||
private:
|
||||
typedef RefVector< Font > FontVec;
|
||||
typedef RefVector< Border > BorderVec;
|
||||
typedef RefVector< Fill > FillVec;
|
||||
typedef RefVector< Xf > XfVec;
|
||||
typedef RefVector< Dxf > DxfVec;
|
||||
typedef RefMap< sal_Int32, CellStyle > CellStyleMap;
|
||||
typedef RefVector< Font > FontVec;
|
||||
typedef RefVector< Border > BorderVec;
|
||||
typedef RefVector< Fill > FillVec;
|
||||
typedef RefVector< Xf > XfVec;
|
||||
typedef RefVector< Dxf > DxfVec;
|
||||
typedef RefMap< sal_Int32, CellStyle > CellStyleIdMap;
|
||||
typedef RefMap< ::rtl::OUString, CellStyle > CellStyleNameMap;
|
||||
|
||||
ColorPalette maPalette; /// Color palette.
|
||||
FontVec maFonts; /// List of font objects.
|
||||
|
@ -1007,7 +992,8 @@ private:
|
|||
XfVec maCellXfs; /// List of cell formats.
|
||||
XfVec maStyleXfs; /// List of cell styles.
|
||||
DxfVec maDxfs; /// List of differential cell styles.
|
||||
CellStyleMap maCellStyles; /// List of named cell styles.
|
||||
CellStyleIdMap maCellStylesById; /// List of named cell styles, mapped by XF identifier.
|
||||
CellStyleNameMap maCellStylesByName; /// List of named cell styles, mapped by name.
|
||||
::rtl::OUString maDefStyleName; /// API name of default cell style.
|
||||
sal_Int32 mnDefStyleXf; /// Style XF index of default cell style.
|
||||
};
|
||||
|
|
|
@ -49,8 +49,6 @@ public:
|
|||
|
||||
/** Returns the theme color with the specified token identifier. */
|
||||
sal_Int32 getColorByToken( sal_Int32 nToken ) const;
|
||||
/** Returns the theme color with the specified index. */
|
||||
sal_Int32 getColorByIndex( sal_Int32 nIndex ) const;
|
||||
|
||||
/** Returns the default font data for the current file type. */
|
||||
inline const FontModel& getDefaultFontModel() const { return *mxDefFontModel; }
|
||||
|
|
|
@ -92,6 +92,8 @@ struct SheetViewModel
|
|||
sal_Int32 getNormalZoom() const;
|
||||
/** Returns the zoom in pagebreak preview (returns default, if current value is 0). */
|
||||
sal_Int32 getPageBreakZoom() const;
|
||||
/** Returns the grid color as RGB value. */
|
||||
sal_Int32 getGridColor( const ::oox::core::FilterBase& rFilter ) const;
|
||||
|
||||
/** Returns the selection data, if available, otherwise 0. */
|
||||
const PaneSelectionModel* getPaneSelection( sal_Int32 nPaneId ) const;
|
||||
|
@ -186,23 +188,23 @@ public:
|
|||
void importWindow1( BiffInputStream& rStrm );
|
||||
|
||||
/** Stores converted view settings for a specific worksheet. */
|
||||
void setSheetViewSettings( sal_Int32 nSheet,
|
||||
void setSheetViewSettings( sal_Int16 nSheet,
|
||||
const SheetViewModelRef& rxSheetView,
|
||||
const ::com::sun::star::uno::Any& rProperties );
|
||||
|
||||
/** Converts all imported document view settings. */
|
||||
void finalizeImport();
|
||||
|
||||
/** Returns the index of the active sheet. */
|
||||
sal_Int32 getActiveSheetIndex() const;
|
||||
/** Returns the Calc index of the active sheet. */
|
||||
sal_Int16 getActiveCalcSheet() const;
|
||||
|
||||
private:
|
||||
WorkbookViewModel& createWorkbookView();
|
||||
|
||||
private:
|
||||
typedef RefVector< WorkbookViewModel > WorkbookViewModelVec;
|
||||
typedef RefMap< sal_Int32, SheetViewModel > SheetViewModelMap;
|
||||
typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > SheetPropertiesMap;
|
||||
typedef RefMap< sal_Int16, SheetViewModel > SheetViewModelMap;
|
||||
typedef ::std::map< sal_Int16, ::com::sun::star::uno::Any > SheetPropertiesMap;
|
||||
|
||||
WorkbookViewModelVec maBookViews; /// Workbook view models.
|
||||
SheetViewModelMap maSheetViews; /// Active view model for each sheet.
|
||||
|
|
|
@ -94,7 +94,7 @@ private:
|
|||
/** Imports a sheet fragment with passed type from current stream position. */
|
||||
bool importSheetFragment(
|
||||
ISegmentProgressBar& rProgressBar,
|
||||
BiffFragmentType eFragment, sal_Int32 nSheet );
|
||||
BiffFragmentType eFragment, sal_Int16 nCalcSheet );
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
@ -253,7 +253,7 @@ public:
|
|||
|
||||
/** Returns a reference to the specified spreadsheet in the document model. */
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >
|
||||
getSheetFromDoc( sal_Int32 nSheet ) const;
|
||||
getSheetFromDoc( sal_Int16 nSheet ) const;
|
||||
/** Returns a reference to the specified spreadsheet in the document model. */
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >
|
||||
getSheetFromDoc( const ::rtl::OUString& rSheet ) const;
|
||||
|
@ -281,12 +281,11 @@ public:
|
|||
createNamedRangeObject(
|
||||
::rtl::OUString& orName,
|
||||
sal_Int32 nNameFlags = 0 ) const;
|
||||
/** Creates a com.sun.star.style.Style object and returns its final name. */
|
||||
/** Creates and returns a com.sun.star.style.Style object for cells or pages. */
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >
|
||||
createStyleObject(
|
||||
::rtl::OUString& orStyleName,
|
||||
bool bPageStyle,
|
||||
bool bRenameOldExisting = false ) const;
|
||||
bool bPageStyle ) const;
|
||||
|
||||
// buffers ----------------------------------------------------------------
|
||||
|
||||
|
@ -361,7 +360,7 @@ public:
|
|||
/** Enables workbook file mode, used for BIFF4 workspace files. */
|
||||
void setIsWorkbookFile();
|
||||
/** Recreates global buffers that are used per sheet in specific BIFF versions. */
|
||||
void createBuffersPerSheet();
|
||||
void createBuffersPerSheet( sal_Int16 nSheet );
|
||||
|
||||
/** Returns the codec helper that stores the encoder/decoder object. */
|
||||
BiffCodecHelper& getCodecHelper() const;
|
||||
|
|
|
@ -40,6 +40,18 @@ namespace xls {
|
|||
|
||||
// ============================================================================
|
||||
|
||||
/** Settings for workbook write protection. */
|
||||
struct FileSharingModel
|
||||
{
|
||||
::rtl::OUString maUserName; /// User who added the write protection password.
|
||||
sal_uInt16 mnPasswordHash; /// Hash value of the write protection password.
|
||||
bool mbRecommendReadOnly; /// True = recommend read-only mode on opening.
|
||||
|
||||
explicit FileSharingModel();
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
/** Global workbook settings. */
|
||||
struct WorkbookSettingsModel
|
||||
{
|
||||
|
@ -84,11 +96,15 @@ class WorkbookSettings : public WorkbookHelper
|
|||
public:
|
||||
explicit WorkbookSettings( const WorkbookHelper& rHelper );
|
||||
|
||||
/** Imports the fileSharing element containing write protection settings. */
|
||||
void importFileSharing( const AttributeList& rAttribs );
|
||||
/** Imports the workbookPr element containing global workbook settings. */
|
||||
void importWorkbookPr( const AttributeList& rAttribs );
|
||||
/** Imports the calcPr element containing workbook calculation settings. */
|
||||
void importCalcPr( const AttributeList& rAttribs );
|
||||
|
||||
/** Imports the FILESHARING record containing write protection settings. */
|
||||
void importFileSharing( RecordInputStream& rStrm );
|
||||
/** Imports the WORKBOOKPR record containing global workbook settings. */
|
||||
void importWorkbookPr( RecordInputStream& rStrm );
|
||||
/** Imports the CALCPR record containing workbook calculation settings. */
|
||||
|
@ -96,6 +112,8 @@ public:
|
|||
|
||||
/** Sets the save external linked values flag, e.g. from the WSBOOL record. */
|
||||
void setSaveExtLinkValues( bool bSaveExtLinks );
|
||||
/** Imports the FILESHARING record. */
|
||||
void importFileSharing( BiffInputStream& rStrm );
|
||||
/** Imports the BOOKBOOL record. */
|
||||
void importBookBool( BiffInputStream& rStrm );
|
||||
/** Imports the CALCCOUNT record. */
|
||||
|
@ -136,6 +154,7 @@ private:
|
|||
void setDateMode( bool bDateMode1904 );
|
||||
|
||||
private:
|
||||
FileSharingModel maFileSharing;
|
||||
WorkbookSettingsModel maBookSettings;
|
||||
CalcSettingsModel maCalcSettings;
|
||||
};
|
||||
|
|
|
@ -31,9 +31,8 @@
|
|||
#ifndef OOX_XLS_WORKSHEETBUFFER_HXX
|
||||
#define OOX_XLS_WORKSHEETBUFFER_HXX
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include "oox/helper/containerhelper.hxx"
|
||||
#include "oox/xls/workbookhelper.hxx"
|
||||
|
||||
namespace com { namespace sun { namespace star {
|
||||
|
@ -50,7 +49,6 @@ struct SheetInfoModel
|
|||
{
|
||||
::rtl::OUString maRelId; /// Relation identifier for the sheet substream.
|
||||
::rtl::OUString maName; /// Original name of the sheet.
|
||||
::rtl::OUString maFinalName; /// Final (converted) name of the sheet.
|
||||
sal_Int32 mnSheetId; /// Sheet identifier.
|
||||
sal_Int32 mnState; /// Visibility state.
|
||||
|
||||
|
@ -70,6 +68,9 @@ class WorksheetBuffer : public WorkbookHelper
|
|||
public:
|
||||
explicit WorksheetBuffer( const WorkbookHelper& rHelper );
|
||||
|
||||
/** Returns the base file name without path and file extension. */
|
||||
static ::rtl::OUString getBaseFileName( const ::rtl::OUString& rUrl );
|
||||
|
||||
/** Initializes the buffer for single sheet files (BIFF2-BIFF4). */
|
||||
void initializeSingleSheet();
|
||||
|
||||
|
@ -79,34 +80,49 @@ public:
|
|||
void importSheet( RecordInputStream& rStrm );
|
||||
/** Imports the SHEET record from the passed BIFF stream. */
|
||||
void importSheet( BiffInputStream& rStrm );
|
||||
|
||||
/** Inserts a new empty sheet into the document. Looks for an unused name.
|
||||
@return Internal index of the new sheet. */
|
||||
@return Index of the new sheet in the Calc document. */
|
||||
sal_Int16 insertEmptySheet( const ::rtl::OUString& rPreferredName, bool bVisible );
|
||||
|
||||
/** Returns the number of original sheets contained in the workbook. */
|
||||
sal_Int32 getSheetCount() const;
|
||||
/** Returns the OOX relation identifier of the specified sheet. */
|
||||
::rtl::OUString getSheetRelId( sal_Int32 nSheet ) const;
|
||||
/** Returns the finalized name of the specified sheet. */
|
||||
::rtl::OUString getCalcSheetName( sal_Int32 nSheet ) const;
|
||||
/** Returns the finalized name of the sheet with the passed original name. */
|
||||
::rtl::OUString getCalcSheetName( const ::rtl::OUString& rModelName ) const;
|
||||
/** Returns the index of the sheet with the passed original name. */
|
||||
sal_Int32 getCalcSheetIndex( const ::rtl::OUString& rModelName ) const;
|
||||
sal_Int32 getWorksheetCount() const;
|
||||
/** Returns the OOX relation identifier of the specified worksheet. */
|
||||
::rtl::OUString getWorksheetRelId( sal_Int32 nWorksheet ) const;
|
||||
|
||||
/** Returns the Calc index of the specified worksheet. */
|
||||
sal_Int16 getCalcSheetIndex( sal_Int32 nWorksheet ) const;
|
||||
/** Returns the finalized name of the specified worksheet. */
|
||||
::rtl::OUString getCalcSheetName( sal_Int32 nWorksheet ) const;
|
||||
|
||||
/** Returns the Calc index of the sheet with the passed original worksheet name. */
|
||||
sal_Int16 getCalcSheetIndex( const ::rtl::OUString& rWorksheetName ) const;
|
||||
/** Returns the finalized name of the sheet with the passed worksheet name. */
|
||||
::rtl::OUString getCalcSheetName( const ::rtl::OUString& rWorksheetName ) const;
|
||||
|
||||
private:
|
||||
struct SheetInfo : public SheetInfoModel
|
||||
{
|
||||
::rtl::OUString maCalcName;
|
||||
::rtl::OUString maCalcQuotedName;
|
||||
sal_Int16 mnCalcSheet;
|
||||
|
||||
explicit SheetInfo( const SheetInfoModel& rModel, sal_Int16 nCalcSheet, const ::rtl::OUString& rCalcName );
|
||||
};
|
||||
|
||||
typedef ::std::pair< sal_Int16, ::rtl::OUString > IndexNamePair;
|
||||
|
||||
const SheetInfoModel* getSheetInfo( sal_Int32 nSheet ) const;
|
||||
|
||||
IndexNamePair insertSheet( const ::rtl::OUString& rPreferredName, sal_Int16 nSheet, bool bVisible );
|
||||
/** Creates a new sheet in the Calc document. Does not insert anything in the own lists. */
|
||||
IndexNamePair createSheet( const ::rtl::OUString& rPreferredName, sal_Int32 nSheetPos, bool bVisible );
|
||||
/** Creates a new sheet in the Calc document and inserts the related SheetInfo. */
|
||||
void insertSheet( const SheetInfoModel& rModel );
|
||||
|
||||
private:
|
||||
typedef ::std::vector< SheetInfoModel > SheetInfoModelVec;
|
||||
typedef RefVector< SheetInfo > SheetInfoVector;
|
||||
SheetInfoVector maSheetInfos;
|
||||
|
||||
SheetInfoModelVec maSheetInfos;
|
||||
struct SheetNameCompare { bool operator()( const ::rtl::OUString& rName1, const ::rtl::OUString& rName2 ) const; };
|
||||
typedef RefMap< ::rtl::OUString, SheetInfo, SheetNameCompare > SheetInfoMap;
|
||||
SheetInfoMap maSheetInfosByName;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
const ::rtl::OUString& rFragmentPath,
|
||||
ISegmentProgressBarRef xProgressBar,
|
||||
WorksheetType eSheetType,
|
||||
sal_Int32 nSheet );
|
||||
sal_Int16 nSheet );
|
||||
|
||||
protected:
|
||||
// oox.core.ContextHandler2Helper interface -------------------------------
|
||||
|
@ -147,7 +147,7 @@ public:
|
|||
const BiffWorkbookFragmentBase& rParent,
|
||||
ISegmentProgressBarRef xProgressBar,
|
||||
WorksheetType eSheetType,
|
||||
sal_Int32 nSheet );
|
||||
sal_Int16 nSheet );
|
||||
virtual ~BiffWorksheetFragment();
|
||||
|
||||
/** Imports the entire worksheet fragment, returns true, if EOF record has been reached. */
|
||||
|
|
|
@ -175,8 +175,9 @@ struct PageBreakModel
|
|||
/** Stores data about a hyperlink range. */
|
||||
struct HyperlinkModel : public ::oox::ole::StdHlinkInfo
|
||||
{
|
||||
::com::sun::star::table::CellRangeAddress maRange;
|
||||
::rtl::OUString maTooltip;
|
||||
::com::sun::star::table::CellRangeAddress
|
||||
maRange; /// The cell area containing the hyperlink.
|
||||
::rtl::OUString maTooltip; /// Additional tooltip text.
|
||||
|
||||
explicit HyperlinkModel();
|
||||
};
|
||||
|
@ -442,7 +443,7 @@ protected:
|
|||
const WorkbookHelper& rHelper,
|
||||
ISegmentProgressBarRef xProgressBar,
|
||||
WorksheetType eSheetType,
|
||||
sal_Int32 nSheet );
|
||||
sal_Int16 nSheet );
|
||||
|
||||
/** Constructs from another sheet helper, does not create a data object. */
|
||||
explicit WorksheetHelperRoot(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
oox oox : vos cppu cppuhelper comphelper sal offapi sax basegfx tools vcl BOOST:boost NULL
|
||||
oox oox : vos cppu cppuhelper comphelper sal offapi sax basegfx tools vcl BOOST:boost OPENSSL:openssl NULL
|
||||
oox oox usr1 - all oox_mkout NULL
|
||||
oox oox\prj get - all oox_prj NULL
|
||||
oox oox\source\token nmake - all oox_token NULL
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
mkdir: %_DEST%\inc%_EXT%\oox
|
||||
mkdir: %_DEST%\inc%_EXT%\oox\core
|
||||
mkdir: %_DEST%\inc%_EXT%\oox\helper
|
||||
mkdir: %_DEST%\inc%_EXT%\oox\vml
|
||||
mkdir: %_DEST%\inc%_EXT%\oox\core
|
||||
mkdir: %_DEST%\inc%_EXT%\oox\drawingml
|
||||
mkdir: %_DEST%\inc%_EXT%\oox\drawingml\chart
|
||||
mkdir: %_DEST%\inc%_EXT%\oox\drawingml\table
|
||||
mkdir: %_DEST%\inc%_EXT%\oox\vml
|
||||
|
||||
..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map
|
||||
..\%__SRC%\lib\ixo.lib %_DEST%\lib%_EXT%\ixo.lib
|
||||
|
@ -13,23 +13,24 @@ mkdir: %_DEST%\inc%_EXT%\oox\drawingml\table
|
|||
..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
|
||||
..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so
|
||||
..\%__SRC%\lib\i*.lib %_DEST%\lib%_EXT%\i*.lib
|
||||
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
|
||||
|
||||
..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h
|
||||
..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token.txt
|
||||
..\inc\oox\core\filterbase.hxx %_DEST%\inc%_EXT%\oox\core\filterbase.hxx
|
||||
..\inc\oox\core\relations.hxx %_DEST%\inc%_EXT%\oox\core\relations.hxx
|
||||
..\%__SRC%\inc\tokens.hxx %_DEST%\inc%_EXT%\oox\core\tokens.hxx
|
||||
..\inc\oox\core\xmlfilterbase.hxx %_DEST%\inc%_EXT%\oox\core\xmlfilterbase.hxx
|
||||
|
||||
..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token.txt
|
||||
..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h
|
||||
..\inc\oox\helper\binarystreambase.hxx %_DEST%\inc%_EXT%\oox\helper\binarystreambase.hxx
|
||||
..\inc\oox\helper\helper.hxx %_DEST%\inc%_EXT%\oox\helper\helper.hxx
|
||||
..\inc\oox\helper\storagebase.hxx %_DEST%\inc%_EXT%\oox\helper\storagebase.hxx
|
||||
..\inc\oox\helper\zipstorage.hxx %_DEST%\inc%_EXT%\oox\helper\zipstorage.hxx
|
||||
..\inc\oox\vml\drawing.hxx %_DEST%\inc%_EXT%\oox\vml\drawing.hxx
|
||||
..\inc\oox\core\filterbase.hxx %_DEST%\inc%_EXT%\oox\core\filterbase.hxx
|
||||
..\inc\oox\core\filterdetect.hxx %_DEST%\inc%_EXT%\oox\core\filterdetect.hxx
|
||||
..\inc\oox\core\relations.hxx %_DEST%\inc%_EXT%\oox\core\relations.hxx
|
||||
..\inc\oox\core\xmlfilterbase.hxx %_DEST%\inc%_EXT%\oox\core\xmlfilterbase.hxx
|
||||
..\inc\oox\drawingml\chart\chartconverter.hxx %_DEST%\inc%_EXT%\oox\drawingml\chart\chartconverter.hxx
|
||||
..\inc\oox\drawingml\table\tablestylelist.hxx %_DEST%\inc%_EXT%\oox\drawingml\table\tablestylelist.hxx
|
||||
..\inc\oox\vml\shape.hxx %_DEST%\inc%_EXT%\oox\vml\shape.hxx
|
||||
|
||||
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
|
||||
..\inc\oox\vml\vmldrawing.hxx %_DEST%\inc%_EXT%\oox\vml\vmldrawing.hxx
|
||||
..\inc\oox\vml\vmlshape.hxx %_DEST%\inc%_EXT%\oox\vml\vmlshape.hxx
|
||||
|
||||
dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi"
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "oox/core/binarycodec.hxx"
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
#include <osl/diagnose.h>
|
||||
#include "oox/helper/attributelist.hxx"
|
||||
|
||||
namespace oox {
|
||||
namespace core {
|
||||
|
@ -113,6 +113,15 @@ sal_uInt16 lclGetHash( const sal_uInt8* pnPassData, sal_Int32 nBufferSize )
|
|||
|
||||
// ============================================================================
|
||||
|
||||
/*static*/ sal_uInt16 CodecHelper::getPasswordHash( const AttributeList& rAttribs, sal_Int32 nElement )
|
||||
{
|
||||
sal_Int32 nPasswordHash = rAttribs.getIntegerHex( nElement, 0 );
|
||||
OSL_ENSURE( (0 <= nPasswordHash) && (nPasswordHash <= SAL_MAX_UINT16), "CodecHelper::getPasswordHash - invalid password hash" );
|
||||
return static_cast< sal_uInt16 >( ((0 <= nPasswordHash) && (nPasswordHash <= SAL_MAX_UINT16)) ? nPasswordHash : 0 );
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
BinaryCodec_XOR::BinaryCodec_XOR( CodecType eCodecType ) :
|
||||
meCodecType( eCodecType ),
|
||||
mnOffset( 0 ),
|
||||
|
@ -249,7 +258,7 @@ BinaryCodec_RCF::~BinaryCodec_RCF()
|
|||
rtl_cipher_destroy( mhCipher );
|
||||
}
|
||||
|
||||
void BinaryCodec_RCF::initKey( const sal_uInt16 pnPassData[ 16 ], const sal_uInt8 pnUnique[ 16 ] )
|
||||
void BinaryCodec_RCF::initKey( const sal_uInt16 pnPassData[ 16 ], const sal_uInt8 pnSalt[ 16 ] )
|
||||
{
|
||||
// create little-endian key data array from password data
|
||||
sal_uInt8 pnKeyData[ 64 ];
|
||||
|
@ -271,11 +280,11 @@ void BinaryCodec_RCF::initKey( const sal_uInt16 pnPassData[ 16 ], const sal_uInt
|
|||
(void)rtl_digest_updateMD5( mhDigest, pnKeyData, sizeof( pnKeyData ) );
|
||||
(void)rtl_digest_rawMD5( mhDigest, pnKeyData, RTL_DIGEST_LENGTH_MD5 );
|
||||
|
||||
// update digest with key data and passed unique data
|
||||
// update digest with key data and passed salt data
|
||||
for( size_t nIndex = 0; nIndex < 16; ++nIndex )
|
||||
{
|
||||
rtl_digest_updateMD5( mhDigest, pnKeyData, 5 );
|
||||
rtl_digest_updateMD5( mhDigest, pnUnique, 16 );
|
||||
rtl_digest_updateMD5( mhDigest, pnSalt, 16 );
|
||||
}
|
||||
|
||||
// update digest with padding
|
||||
|
@ -292,7 +301,7 @@ void BinaryCodec_RCF::initKey( const sal_uInt16 pnPassData[ 16 ], const sal_uInt
|
|||
(void)memset( pnKeyData, 0, sizeof( pnKeyData ) );
|
||||
}
|
||||
|
||||
bool BinaryCodec_RCF::verifyKey( const sal_uInt8 pnSaltData[ 16 ], const sal_uInt8 pnSaltDigest[ 16 ] )
|
||||
bool BinaryCodec_RCF::verifyKey( const sal_uInt8 pnVerifier[ 16 ], const sal_uInt8 pnVerifierHash[ 16 ] )
|
||||
{
|
||||
if( !startBlock( 0 ) )
|
||||
return false;
|
||||
|
@ -301,7 +310,7 @@ bool BinaryCodec_RCF::verifyKey( const sal_uInt8 pnSaltData[ 16 ], const sal_uIn
|
|||
sal_uInt8 pnBuffer[ 64 ];
|
||||
|
||||
// decode salt data into buffer
|
||||
rtl_cipher_decode( mhCipher, pnSaltData, 16, pnBuffer, sizeof( pnBuffer ) );
|
||||
rtl_cipher_decode( mhCipher, pnVerifier, 16, pnBuffer, sizeof( pnBuffer ) );
|
||||
|
||||
pnBuffer[ 16 ] = 0x80;
|
||||
(void)memset( pnBuffer + 17, 0, sizeof( pnBuffer ) - 17 );
|
||||
|
@ -312,7 +321,7 @@ bool BinaryCodec_RCF::verifyKey( const sal_uInt8 pnSaltData[ 16 ], const sal_uIn
|
|||
rtl_digest_rawMD5( mhDigest, pnDigest, sizeof( pnDigest ) );
|
||||
|
||||
// decode original salt digest into buffer
|
||||
rtl_cipher_decode( mhCipher, pnSaltDigest, 16, pnBuffer, sizeof( pnBuffer ) );
|
||||
rtl_cipher_decode( mhCipher, pnVerifierHash, 16, pnBuffer, sizeof( pnBuffer ) );
|
||||
|
||||
// compare buffer with computed digest
|
||||
bool bResult = memcmp( pnBuffer, pnDigest, sizeof( pnDigest ) ) == 0;
|
||||
|
|
|
@ -51,15 +51,16 @@ BinaryFilterBase::~BinaryFilterBase()
|
|||
{
|
||||
}
|
||||
|
||||
StorageRef BinaryFilterBase::implCreateStorage(
|
||||
Reference< XInputStream >& rxInStream, Reference< XStream >& rxOutStream ) const
|
||||
// private --------------------------------------------------------------------
|
||||
|
||||
StorageRef BinaryFilterBase::implCreateStorage( const Reference< XInputStream >& rxInStream ) const
|
||||
{
|
||||
StorageRef xStorage;
|
||||
if( rxInStream.is() )
|
||||
xStorage.reset( new OleStorage( getGlobalFactory(), rxInStream, true ) );
|
||||
else if( rxOutStream.is() )
|
||||
xStorage.reset( new OleStorage( getGlobalFactory(), rxOutStream, true ) );
|
||||
return xStorage;
|
||||
return StorageRef( new OleStorage( getGlobalFactory(), rxInStream, true ) );
|
||||
}
|
||||
|
||||
StorageRef BinaryFilterBase::implCreateStorage( const Reference< XStream >& rxOutStream ) const
|
||||
{
|
||||
return StorageRef( new OleStorage( getGlobalFactory(), rxOutStream, true ) );
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
|
95
oox/source/core/fasttokenhandler.cxx
Normal file
95
oox/source/core/fasttokenhandler.cxx
Normal file
|
@ -0,0 +1,95 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* 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: tokenmap.cxx,v $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include "oox/core/fasttokenhandler.hxx"
|
||||
#include <osl/mutex.hxx>
|
||||
#include "oox/token/tokenmap.hxx"
|
||||
|
||||
using ::rtl::OUString;
|
||||
using ::osl::Mutex;
|
||||
using ::osl::MutexGuard;
|
||||
using ::com::sun::star::uno::Sequence;
|
||||
using ::com::sun::star::uno::RuntimeException;
|
||||
|
||||
namespace oox {
|
||||
namespace core {
|
||||
|
||||
// ============================================================================
|
||||
|
||||
namespace {
|
||||
|
||||
Mutex& lclGetTokenMutex()
|
||||
{
|
||||
static Mutex aMutex;
|
||||
return aMutex;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// ============================================================================
|
||||
|
||||
FastTokenHandler::FastTokenHandler() :
|
||||
mrTokenMap( StaticTokenMap::get() )
|
||||
{
|
||||
}
|
||||
|
||||
FastTokenHandler::~FastTokenHandler()
|
||||
{
|
||||
}
|
||||
|
||||
sal_Int32 FastTokenHandler::getToken( const OUString& rIdentifier ) throw( RuntimeException )
|
||||
{
|
||||
MutexGuard aGuard( lclGetTokenMutex() );
|
||||
return mrTokenMap.getTokenFromUnicode( rIdentifier );
|
||||
}
|
||||
|
||||
OUString FastTokenHandler::getIdentifier( sal_Int32 nToken ) throw( RuntimeException )
|
||||
{
|
||||
MutexGuard aGuard( lclGetTokenMutex() );
|
||||
return mrTokenMap.getUnicodeTokenName( nToken );
|
||||
}
|
||||
|
||||
Sequence< sal_Int8 > FastTokenHandler::getUTF8Identifier( sal_Int32 nToken ) throw( RuntimeException )
|
||||
{
|
||||
MutexGuard aGuard( lclGetTokenMutex() );
|
||||
return mrTokenMap.getUtf8TokenName( nToken );
|
||||
}
|
||||
|
||||
sal_Int32 FastTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& rIdentifier ) throw( RuntimeException )
|
||||
{
|
||||
MutexGuard aGuard( lclGetTokenMutex() );
|
||||
return mrTokenMap.getTokenFromUtf8( rIdentifier );
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
} // namespace core
|
||||
} // namespace oox
|
||||
|
|
@ -38,6 +38,7 @@
|
|||
#include <osl/mutex.hxx>
|
||||
#include <rtl/instance.hxx>
|
||||
#include <rtl/uri.hxx>
|
||||
#include <comphelper/docpasswordhelper.hxx>
|
||||
#include <comphelper/mediadescriptor.hxx>
|
||||
#include "tokens.hxx"
|
||||
#include "oox/helper/binaryinputstream.hxx"
|
||||
|
@ -58,7 +59,6 @@ using ::com::sun::star::uno::UNO_SET_THROW;
|
|||
using ::com::sun::star::lang::IllegalArgumentException;
|
||||
using ::com::sun::star::lang::XMultiServiceFactory;
|
||||
using ::com::sun::star::lang::XComponent;
|
||||
using ::com::sun::star::beans::NamedValue;
|
||||
using ::com::sun::star::beans::PropertyValue;
|
||||
using ::com::sun::star::awt::DeviceInfo;
|
||||
using ::com::sun::star::awt::XDevice;
|
||||
|
@ -72,6 +72,7 @@ using ::com::sun::star::task::XStatusIndicator;
|
|||
using ::com::sun::star::task::XInteractionHandler;
|
||||
using ::com::sun::star::graphic::XGraphic;
|
||||
using ::comphelper::MediaDescriptor;
|
||||
using ::comphelper::SequenceAsHashMap;
|
||||
using ::oox::ole::OleObjectHelper;
|
||||
|
||||
namespace oox {
|
||||
|
@ -88,7 +89,7 @@ public:
|
|||
explicit DocumentOpenedGuard( const OUString& rUrl );
|
||||
~DocumentOpenedGuard();
|
||||
|
||||
inline bool isValid() const { return maUrl.getLength() > 0; }
|
||||
inline bool isValid() const { return mbValid; }
|
||||
|
||||
private:
|
||||
DocumentOpenedGuard( const DocumentOpenedGuard& );
|
||||
|
@ -99,15 +100,15 @@ private:
|
|||
|
||||
UrlSet& mrUrls;
|
||||
OUString maUrl;
|
||||
bool mbValid;
|
||||
};
|
||||
|
||||
DocumentOpenedGuard::DocumentOpenedGuard( const OUString& rUrl ) :
|
||||
mrUrls( UrlPool::get() )
|
||||
{
|
||||
::osl::MutexGuard aGuard( *this );
|
||||
OSL_ENSURE( (rUrl.getLength() == 0) || (mrUrls.count( rUrl ) == 0),
|
||||
"DocumentOpenedGuard::DocumentOpenedGuard - filter called recursively for this document" );
|
||||
if( (rUrl.getLength() > 0) && (mrUrls.count( rUrl ) == 0) )
|
||||
mbValid = (rUrl.getLength() == 0) || (mrUrls.count( rUrl ) == 0);
|
||||
if( mbValid && (rUrl.getLength() > 0) )
|
||||
{
|
||||
mrUrls.insert( rUrl );
|
||||
maUrl = rUrl;
|
||||
|
@ -117,7 +118,7 @@ DocumentOpenedGuard::DocumentOpenedGuard( const OUString& rUrl ) :
|
|||
DocumentOpenedGuard::~DocumentOpenedGuard()
|
||||
{
|
||||
::osl::MutexGuard aGuard( *this );
|
||||
if( isValid() )
|
||||
if( maUrl.getLength() > 0 )
|
||||
mrUrls.erase( maUrl );
|
||||
}
|
||||
|
||||
|
@ -125,6 +126,16 @@ DocumentOpenedGuard::~DocumentOpenedGuard()
|
|||
|
||||
// ============================================================================
|
||||
|
||||
/** Specifies whether this filter is an import or export filter. */
|
||||
enum FilterDirection
|
||||
{
|
||||
FILTERDIRECTION_UNKNOWN,
|
||||
FILTERDIRECTION_IMPORT,
|
||||
FILTERDIRECTION_EXPORT
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
struct FilterBaseImpl
|
||||
{
|
||||
typedef ::boost::shared_ptr< GraphicHelper > GraphicHelperRef;
|
||||
|
@ -132,9 +143,10 @@ struct FilterBaseImpl
|
|||
typedef ::boost::shared_ptr< OleObjectHelper > OleObjHelperRef;
|
||||
typedef ::std::map< OUString, Reference< XGraphic > > EmbeddedGraphicMap;
|
||||
typedef ::std::map< sal_Int32, sal_Int32 > SystemPalette;
|
||||
typedef ::std::map< OUString, Any > ArgumentMap;
|
||||
|
||||
MediaDescriptor maDescriptor;
|
||||
FilterDirection meDirection;
|
||||
SequenceAsHashMap maArguments;
|
||||
MediaDescriptor maMediaDesc;
|
||||
DeviceInfo maDeviceInfo;
|
||||
OUString maFileUrl;
|
||||
StorageRef mxStorage;
|
||||
|
@ -145,7 +157,6 @@ struct FilterBaseImpl
|
|||
EmbeddedGraphicMap maEmbeddedGraphics; /// Maps all imported embedded graphics by their path.
|
||||
SystemPalette maSystemPalette; /// Maps system colors (XML tokens) to RGB color values.
|
||||
|
||||
ArgumentMap maArguments;
|
||||
Reference< XMultiServiceFactory > mxGlobalFactory;
|
||||
Reference< XModel > mxModel;
|
||||
Reference< XMultiServiceFactory > mxModelFactory;
|
||||
|
@ -157,14 +168,16 @@ struct FilterBaseImpl
|
|||
explicit FilterBaseImpl( const Reference< XMultiServiceFactory >& rxGlobalFactory );
|
||||
|
||||
void setDocumentModel( const Reference< XComponent >& rxComponent );
|
||||
void setMediaDescriptor( const Sequence< PropertyValue >& rDescriptor );
|
||||
|
||||
bool hasDocumentModel() const;
|
||||
|
||||
void initializeFilter();
|
||||
void finalizeFilter();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
FilterBaseImpl::FilterBaseImpl( const Reference< XMultiServiceFactory >& rxGlobalFactory ) :
|
||||
meDirection( FILTERDIRECTION_UNKNOWN ),
|
||||
mxGlobalFactory( rxGlobalFactory )
|
||||
{
|
||||
OSL_ENSURE( mxGlobalFactory.is(), "FilterBaseImpl::FilterBaseImpl - missing service factory" );
|
||||
|
@ -223,25 +236,41 @@ void FilterBaseImpl::setDocumentModel( const Reference< XComponent >& rxComponen
|
|||
mxModelFactory.set( rxComponent, UNO_QUERY );
|
||||
}
|
||||
|
||||
void FilterBaseImpl::setMediaDescriptor( const Sequence< PropertyValue >& rDescriptor )
|
||||
{
|
||||
maDescriptor = rDescriptor;
|
||||
|
||||
maFileUrl = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), maFileUrl );
|
||||
mxInStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_INPUTSTREAM(), mxInStream );
|
||||
mxOutStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_STREAMFOROUTPUT(), mxOutStream );
|
||||
mxStatusIndicator = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_STATUSINDICATOR(), mxStatusIndicator );
|
||||
mxInteractionHandler = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER(), mxInteractionHandler );
|
||||
|
||||
if( mxInStream.is() )
|
||||
maDescriptor.addInputStream();
|
||||
}
|
||||
|
||||
bool FilterBaseImpl::hasDocumentModel() const
|
||||
{
|
||||
return mxGlobalFactory.is() && mxModel.is() && mxModelFactory.is();
|
||||
}
|
||||
|
||||
void FilterBaseImpl::initializeFilter()
|
||||
{
|
||||
try
|
||||
{
|
||||
// lock the model controllers
|
||||
mxModel->lockControllers();
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void FilterBaseImpl::finalizeFilter()
|
||||
{
|
||||
try
|
||||
{
|
||||
// clear the 'ComponentData' property in the descriptor
|
||||
MediaDescriptor::iterator aIt = maMediaDesc.find( MediaDescriptor::PROP_COMPONENTDATA() );
|
||||
if( aIt != maMediaDesc.end() )
|
||||
aIt->second.clear();
|
||||
// write the descriptor back to the document model (adds the password)
|
||||
mxModel->attachResource( maFileUrl, maMediaDesc.getAsConstPropertyValueList() );
|
||||
// unlock the model controllers
|
||||
mxModel->unlockControllers();
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
FilterBase::FilterBase( const Reference< XMultiServiceFactory >& rxGlobalFactory ) :
|
||||
|
@ -255,19 +284,19 @@ FilterBase::~FilterBase()
|
|||
|
||||
bool FilterBase::isImportFilter() const
|
||||
{
|
||||
return mxImpl->mxInStream.is();
|
||||
return mxImpl->meDirection == FILTERDIRECTION_IMPORT;
|
||||
}
|
||||
|
||||
bool FilterBase::isExportFilter() const
|
||||
{
|
||||
return mxImpl->mxOutStream.is();
|
||||
return mxImpl->meDirection == FILTERDIRECTION_EXPORT;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Any FilterBase::getArgument( const OUString& rArgName ) const
|
||||
{
|
||||
FilterBaseImpl::ArgumentMap::const_iterator aIt = mxImpl->maArguments.find( rArgName );
|
||||
SequenceAsHashMap::const_iterator aIt = mxImpl->maArguments.find( rArgName );
|
||||
return (aIt == mxImpl->maArguments.end()) ? Any() : aIt->second;
|
||||
}
|
||||
|
||||
|
@ -276,6 +305,11 @@ const Reference< XMultiServiceFactory >& FilterBase::getGlobalFactory() const
|
|||
return mxImpl->mxGlobalFactory;
|
||||
}
|
||||
|
||||
MediaDescriptor& FilterBase::getMediaDescriptor() const
|
||||
{
|
||||
return mxImpl->maMediaDesc;
|
||||
}
|
||||
|
||||
const Reference< XModel >& FilterBase::getModel() const
|
||||
{
|
||||
return mxImpl->mxModel;
|
||||
|
@ -437,7 +471,27 @@ sal_Int32 FilterBase::getSystemColor( sal_Int32 nToken, sal_Int32 nDefaultRgb )
|
|||
{
|
||||
FilterBaseImpl::SystemPalette::const_iterator aIt = mxImpl->maSystemPalette.find( nToken );
|
||||
OSL_ENSURE( aIt != mxImpl->maSystemPalette.end(), "FilterBase::getSystemColor - invalid token identifier" );
|
||||
return (aIt == mxImpl->maSystemPalette.end()) ? ((nDefaultRgb < 0) ? API_RGB_WHITE : nDefaultRgb) : aIt->second;
|
||||
return (aIt == mxImpl->maSystemPalette.end()) ? nDefaultRgb : aIt->second;
|
||||
}
|
||||
|
||||
sal_Int32 FilterBase::getSchemeColor( sal_Int32 /*nToken*/ ) const
|
||||
{
|
||||
OSL_ENSURE( false, "FilterBase::getSchemeColor - scheme colors not implemented" );
|
||||
return API_RGB_TRANSPARENT;
|
||||
}
|
||||
|
||||
sal_Int32 FilterBase::getPaletteColor( sal_Int32 /*nPaletteIdx*/ ) const
|
||||
{
|
||||
OSL_ENSURE( false, "FilterBase::getPaletteColor - palette colors not implemented" );
|
||||
return API_RGB_TRANSPARENT;
|
||||
}
|
||||
|
||||
OUString FilterBase::requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const
|
||||
{
|
||||
::std::vector< OUString > aDefaultPasswords;
|
||||
aDefaultPasswords.push_back( CREATE_OUSTRING( "VelvetSweatshop" ) );
|
||||
return ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
|
||||
rVerifier, mxImpl->maMediaDesc, ::comphelper::DocPasswordRequestType_MS, &aDefaultPasswords );
|
||||
}
|
||||
|
||||
bool FilterBase::importBinaryData( StreamDataSequence& orDataSeq, const OUString& rStreamName )
|
||||
|
@ -508,17 +562,12 @@ Sequence< OUString > SAL_CALL FilterBase::getSupportedServiceNames() throw( Runt
|
|||
|
||||
void SAL_CALL FilterBase::initialize( const Sequence< Any >& rArgs ) throw( Exception, RuntimeException )
|
||||
{
|
||||
if( rArgs.getLength() >= 2 )
|
||||
if( rArgs.getLength() >= 2 ) try
|
||||
{
|
||||
mxImpl->maArguments << rArgs[ 1 ];
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
Sequence< NamedValue > aArgSeq;
|
||||
if( (rArgs[ 1 ] >>= aArgSeq) && aArgSeq.hasElements() )
|
||||
{
|
||||
const NamedValue* pArg = aArgSeq.getConstArray();
|
||||
const NamedValue* pEnd = pArg + aArgSeq.getLength();
|
||||
for( ; pArg < pEnd; ++pArg )
|
||||
if( pArg->Name.getLength() > 0 )
|
||||
mxImpl->maArguments[ pArg->Name ] = pArg->Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -529,6 +578,7 @@ void SAL_CALL FilterBase::setTargetDocument( const Reference< XComponent >& rxDo
|
|||
mxImpl->setDocumentModel( rxDocument );
|
||||
if( !mxImpl->hasDocumentModel() )
|
||||
throw IllegalArgumentException();
|
||||
mxImpl->meDirection = FILTERDIRECTION_IMPORT;
|
||||
}
|
||||
|
||||
// com.sun.star.document.XExporter interface ----------------------------------
|
||||
|
@ -538,29 +588,41 @@ void SAL_CALL FilterBase::setSourceDocument( const Reference< XComponent >& rxDo
|
|||
mxImpl->setDocumentModel( rxDocument );
|
||||
if( !mxImpl->hasDocumentModel() )
|
||||
throw IllegalArgumentException();
|
||||
mxImpl->meDirection = FILTERDIRECTION_EXPORT;
|
||||
}
|
||||
|
||||
// com.sun.star.document.XFilter interface ------------------------------------
|
||||
|
||||
sal_Bool SAL_CALL FilterBase::filter( const Sequence< PropertyValue >& rDescriptor ) throw( RuntimeException )
|
||||
sal_Bool SAL_CALL FilterBase::filter( const Sequence< PropertyValue >& rMediaDescSeq ) throw( RuntimeException )
|
||||
{
|
||||
sal_Bool bRet = sal_False;
|
||||
if( mxImpl->hasDocumentModel() )
|
||||
if( mxImpl->hasDocumentModel() && (mxImpl->meDirection != FILTERDIRECTION_UNKNOWN) )
|
||||
{
|
||||
mxImpl->setMediaDescriptor( rDescriptor );
|
||||
setMediaDescriptor( rMediaDescSeq );
|
||||
DocumentOpenedGuard aOpenedGuard( mxImpl->maFileUrl );
|
||||
if( aOpenedGuard.isValid() )
|
||||
{
|
||||
mxImpl->mxStorage = implCreateStorage( mxImpl->mxInStream, mxImpl->mxOutStream );
|
||||
if( mxImpl->mxStorage.get() )
|
||||
mxImpl->initializeFilter();
|
||||
switch( mxImpl->meDirection )
|
||||
{
|
||||
mxImpl->mxModel->lockControllers();
|
||||
if( mxImpl->mxInStream.is() )
|
||||
bRet = importDocument();
|
||||
else if( mxImpl->mxOutStream.is() )
|
||||
bRet = exportDocument();
|
||||
mxImpl->mxModel->unlockControllers();
|
||||
case FILTERDIRECTION_UNKNOWN:
|
||||
break;
|
||||
case FILTERDIRECTION_IMPORT:
|
||||
if( mxImpl->mxInStream.is() )
|
||||
{
|
||||
mxImpl->mxStorage = implCreateStorage( mxImpl->mxInStream );
|
||||
bRet = mxImpl->mxStorage.get() && importDocument();
|
||||
}
|
||||
break;
|
||||
case FILTERDIRECTION_EXPORT:
|
||||
if( mxImpl->mxOutStream.is() )
|
||||
{
|
||||
mxImpl->mxStorage = implCreateStorage( mxImpl->mxOutStream );
|
||||
bRet = mxImpl->mxStorage.get() && exportDocument();
|
||||
}
|
||||
break;
|
||||
}
|
||||
mxImpl->finalizeFilter();
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
|
@ -570,6 +632,46 @@ void SAL_CALL FilterBase::cancel() throw( RuntimeException )
|
|||
{
|
||||
}
|
||||
|
||||
// protected ------------------------------------------------------------------
|
||||
|
||||
Reference< XInputStream > FilterBase::implGetInputStream( MediaDescriptor& rMediaDesc ) const
|
||||
{
|
||||
return rMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INPUTSTREAM(), Reference< XInputStream >() );
|
||||
}
|
||||
|
||||
Reference< XStream > FilterBase::implGetOutputStream( MediaDescriptor& rMediaDesc ) const
|
||||
{
|
||||
return rMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_STREAMFOROUTPUT(), Reference< XStream >() );
|
||||
}
|
||||
|
||||
// private --------------------------------------------------------------------
|
||||
|
||||
void FilterBase::setMediaDescriptor( const Sequence< PropertyValue >& rMediaDescSeq )
|
||||
{
|
||||
mxImpl->maMediaDesc = rMediaDescSeq;
|
||||
|
||||
switch( mxImpl->meDirection )
|
||||
{
|
||||
case FILTERDIRECTION_UNKNOWN:
|
||||
OSL_ENSURE( false, "FilterBase::setMediaDescriptor - invalid filter direction" );
|
||||
break;
|
||||
case FILTERDIRECTION_IMPORT:
|
||||
mxImpl->maMediaDesc.addInputStream();
|
||||
mxImpl->mxInStream = implGetInputStream( mxImpl->maMediaDesc );
|
||||
OSL_ENSURE( mxImpl->mxInStream.is(), "FilterBase::setMediaDescriptor - missing input stream" );
|
||||
break;
|
||||
case FILTERDIRECTION_EXPORT:
|
||||
mxImpl->mxOutStream = implGetOutputStream( mxImpl->maMediaDesc );
|
||||
OSL_ENSURE( mxImpl->mxOutStream.is(), "FilterBase::setMediaDescriptor - missing output stream" );
|
||||
break;
|
||||
}
|
||||
|
||||
mxImpl->maFileUrl = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), OUString() );
|
||||
mxImpl->mxStatusIndicator = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_STATUSINDICATOR(), Reference< XStatusIndicator >() );
|
||||
mxImpl->mxInteractionHandler = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER(), Reference< XInteractionHandler >() );
|
||||
}
|
||||
|
||||
|
||||
// ============================================================================
|
||||
|
||||
} // namespace core
|
||||
|
|
|
@ -28,89 +28,52 @@
|
|||
*
|
||||
************************************************************************/
|
||||
|
||||
#include <com/sun/star/document/XExtendedFilterDetection.hpp>
|
||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/embed/XHierarchicalStorageAccess.hpp>
|
||||
|
||||
#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
|
||||
#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
|
||||
#include "oox/core/filterdetect.hxx"
|
||||
#include <com/sun/star/io/XStream.hpp>
|
||||
#include <com/sun/star/xml/sax/XFastParser.hpp>
|
||||
|
||||
#include <rtl/digest.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <comphelper/docpasswordhelper.hxx>
|
||||
#include <comphelper/mediadescriptor.hxx>
|
||||
#include <cppuhelper/implbase1.hxx>
|
||||
#include <cppuhelper/implbase2.hxx>
|
||||
|
||||
#include "oox/helper/attributelist.hxx"
|
||||
#include "oox/helper/binaryinputstream.hxx"
|
||||
#include "oox/helper/binaryoutputstream.hxx"
|
||||
#include "oox/helper/olestorage.hxx"
|
||||
#include "oox/helper/zipstorage.hxx"
|
||||
#include "oox/core/fasttokenhandler.hxx"
|
||||
#include "oox/core/namespaces.hxx"
|
||||
#include "tokens.hxx"
|
||||
|
||||
#include <vector>
|
||||
|
||||
using ::rtl::OUString;
|
||||
using ::rtl::OString;
|
||||
using ::com::sun::star::uno::Exception;
|
||||
using ::com::sun::star::uno::Reference;
|
||||
using ::com::sun::star::uno::RuntimeException;
|
||||
using ::com::sun::star::uno::Sequence;
|
||||
using ::com::sun::star::uno::UNO_QUERY;
|
||||
using ::com::sun::star::uno::UNO_QUERY_THROW;
|
||||
using ::com::sun::star::uno::UNO_SET_THROW;
|
||||
using ::com::sun::star::uno::XInterface;
|
||||
using ::com::sun::star::lang::XMultiServiceFactory;
|
||||
using ::com::sun::star::beans::NamedValue;
|
||||
using ::com::sun::star::beans::PropertyValue;
|
||||
using ::com::sun::star::io::XInputStream;
|
||||
using ::com::sun::star::io::XOutputStream;
|
||||
using ::com::sun::star::io::XStream;
|
||||
using ::com::sun::star::xml::sax::InputSource;
|
||||
using ::com::sun::star::xml::sax::SAXException;
|
||||
using ::com::sun::star::xml::sax::XFastAttributeList;
|
||||
using ::com::sun::star::xml::sax::XFastContextHandler;
|
||||
using ::com::sun::star::xml::sax::XFastParser;
|
||||
using ::com::sun::star::xml::sax::XLocator;
|
||||
using ::comphelper::MediaDescriptor;
|
||||
using namespace ::com::sun::star::document;
|
||||
using namespace ::com::sun::star::lang;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::beans;
|
||||
using namespace ::com::sun::star::io;
|
||||
using namespace ::com::sun::star::embed;
|
||||
using namespace ::com::sun::star::xml::sax;
|
||||
using ::comphelper::SequenceAsHashMap;
|
||||
|
||||
namespace oox {
|
||||
namespace core {
|
||||
|
||||
// ============================================================================
|
||||
|
||||
/** Document handler specifically designed for detecting OOXML file formats.
|
||||
|
||||
It takes a reference to the filter string object via its constructor, and
|
||||
puts the name of the detected filter to it if it successfully finds one.
|
||||
*/
|
||||
class FilterDetectDocHandler : public ::cppu::WeakImplHelper1< XFastDocumentHandler >
|
||||
{
|
||||
public:
|
||||
explicit FilterDetectDocHandler( OUString& rFilter );
|
||||
virtual ~FilterDetectDocHandler();
|
||||
|
||||
// XFastDocumentHandler
|
||||
virtual void SAL_CALL startDocument() throw (SAXException, RuntimeException);
|
||||
virtual void SAL_CALL endDocument() throw (SAXException, RuntimeException);
|
||||
virtual void SAL_CALL setDocumentLocator( const Reference< XLocator >& xLocator ) throw (SAXException, RuntimeException);
|
||||
|
||||
// XFastContextHandler
|
||||
virtual void SAL_CALL startFastElement( sal_Int32 nElement, const Reference< XFastAttributeList >& Attribs ) throw (SAXException, RuntimeException);
|
||||
virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const Reference< XFastAttributeList >& Attribs ) throw (SAXException, RuntimeException);
|
||||
virtual void SAL_CALL endFastElement( sal_Int32 Element ) throw (SAXException, RuntimeException);
|
||||
virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) throw (SAXException, RuntimeException);
|
||||
virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 Element, const Reference< XFastAttributeList >& Attribs ) throw (SAXException, RuntimeException);
|
||||
virtual Reference< XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const Reference< XFastAttributeList >& Attribs ) throw (SAXException, RuntimeException);
|
||||
virtual void SAL_CALL characters( const OUString& aChars ) throw (SAXException, RuntimeException);
|
||||
virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (SAXException, RuntimeException);
|
||||
virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (SAXException, RuntimeException);
|
||||
|
||||
private:
|
||||
void parseRelationship( const AttributeList& rAttribs );
|
||||
|
||||
OUString getFilterNameFromContentType( const OUString& rContentType ) const;
|
||||
void parseContentTypesDefault( const AttributeList& rAttribs );
|
||||
void parseContentTypesOverride( const AttributeList& rAttribs );
|
||||
|
||||
private:
|
||||
typedef ::std::vector< sal_Int32 > ContextVector;
|
||||
|
||||
OUString& mrFilter;
|
||||
ContextVector maContextStack;
|
||||
OUString maTargetPath;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
FilterDetectDocHandler::FilterDetectDocHandler( OUString& rFilter ) :
|
||||
mrFilter( rFilter )
|
||||
FilterDetectDocHandler::FilterDetectDocHandler( OUString& rFilterName ) :
|
||||
mrFilterName( rFilterName )
|
||||
{
|
||||
maContextStack.reserve( 2 );
|
||||
}
|
||||
|
@ -134,8 +97,6 @@ void SAL_CALL FilterDetectDocHandler::setDocumentLocator( const Reference<XLocat
|
|||
{
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
void SAL_CALL FilterDetectDocHandler::startFastElement(
|
||||
sal_Int32 nElement, const Reference< XFastAttributeList >& rAttribs )
|
||||
throw (SAXException,RuntimeException)
|
||||
|
@ -213,8 +174,6 @@ void SAL_CALL FilterDetectDocHandler::processingInstruction(
|
|||
{
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
void FilterDetectDocHandler::parseRelationship( const AttributeList& rAttribs )
|
||||
{
|
||||
OUString aType = rAttribs.getString( XML_Type, OUString() );
|
||||
|
@ -224,6 +183,14 @@ void FilterDetectDocHandler::parseRelationship( const AttributeList& rAttribs )
|
|||
|
||||
OUString FilterDetectDocHandler::getFilterNameFromContentType( const OUString& rContentType ) const
|
||||
{
|
||||
if( rContentType.equalsAscii( "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" ) ||
|
||||
rContentType.equalsAscii( "application/vnd.ms-word.document.macroEnabled.main+xml" ) )
|
||||
return CREATE_OUSTRING( "writer_MS_Word_2007" );
|
||||
|
||||
if( rContentType.equalsAscii( "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml" ) ||
|
||||
rContentType.equalsAscii( "application/vnd.ms-word.template.macroEnabledTemplate.main+xml" ) )
|
||||
return CREATE_OUSTRING( "writer_MS_Word_2007_Template" );
|
||||
|
||||
if( rContentType.equalsAscii( "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" ) ||
|
||||
rContentType.equalsAscii( "application/vnd.ms-excel.sheet.macroEnabled.main+xml" ) )
|
||||
return CREATE_OUSTRING( "MS Excel 2007 XML" );
|
||||
|
@ -249,44 +216,24 @@ OUString FilterDetectDocHandler::getFilterNameFromContentType( const OUString& r
|
|||
void FilterDetectDocHandler::parseContentTypesDefault( const AttributeList& rAttribs )
|
||||
{
|
||||
// only if no overridden part name found
|
||||
if( mrFilter.getLength() == 0 )
|
||||
if( mrFilterName.getLength() == 0 )
|
||||
{
|
||||
// check if target path ends with extension
|
||||
OUString aExtension = rAttribs.getString( XML_Extension, OUString() );
|
||||
sal_Int32 nExtPos = maTargetPath.getLength() - aExtension.getLength();
|
||||
if( (nExtPos > 0) && (maTargetPath[ nExtPos - 1 ] == '.') && maTargetPath.match( aExtension, nExtPos ) )
|
||||
mrFilter = getFilterNameFromContentType( rAttribs.getString( XML_ContentType, OUString() ) );
|
||||
mrFilterName = getFilterNameFromContentType( rAttribs.getString( XML_ContentType, OUString() ) );
|
||||
}
|
||||
}
|
||||
|
||||
void FilterDetectDocHandler::parseContentTypesOverride( const AttributeList& rAttribs )
|
||||
{
|
||||
if( rAttribs.getString( XML_PartName, OUString() ).equals( maTargetPath ) )
|
||||
mrFilter = getFilterNameFromContentType( rAttribs.getString( XML_ContentType, OUString() ) );
|
||||
mrFilterName = getFilterNameFromContentType( rAttribs.getString( XML_ContentType, OUString() ) );
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
class FilterDetect : public ::cppu::WeakImplHelper2< XExtendedFilterDetection, XServiceInfo >
|
||||
{
|
||||
public:
|
||||
explicit FilterDetect( const Reference< XMultiServiceFactory >& xFactory );
|
||||
virtual ~FilterDetect();
|
||||
|
||||
// XServiceInfo
|
||||
virtual OUString SAL_CALL getImplementationName() throw( RuntimeException );
|
||||
virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw( RuntimeException );
|
||||
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( RuntimeException );
|
||||
|
||||
// XExtendedFilterDetect
|
||||
virtual OUString SAL_CALL detect( Sequence< PropertyValue >& lDescriptor ) throw( RuntimeException );
|
||||
|
||||
private:
|
||||
Reference< XMultiServiceFactory > mxFactory;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/* Helper for XServiceInfo */
|
||||
Sequence< OUString > FilterDetect_getSupportedServiceNames()
|
||||
{
|
||||
|
@ -307,8 +254,10 @@ Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< X
|
|||
return Reference< XInterface >( *new FilterDetect( xServiceManager ) );
|
||||
}
|
||||
|
||||
FilterDetect::FilterDetect( const Reference< XMultiServiceFactory >& xFactory ) :
|
||||
mxFactory( xFactory )
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
FilterDetect::FilterDetect( const Reference< XMultiServiceFactory >& rxFactory ) :
|
||||
mxFactory( rxFactory )
|
||||
{
|
||||
OSL_ENSURE( mxFactory.is(), "FilterDetect::FilterDetect - no service factory" );
|
||||
}
|
||||
|
@ -317,45 +266,319 @@ FilterDetect::~FilterDetect()
|
|||
{
|
||||
}
|
||||
|
||||
// com.sun.star.document.XExtendedFilterDetect interface ----------------------
|
||||
/* =========================================================================== */
|
||||
/* Kudos to Caolan McNamara who provided the core decryption implementations. */
|
||||
/* =========================================================================== */
|
||||
|
||||
OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& lDescriptor ) throw( RuntimeException )
|
||||
namespace {
|
||||
|
||||
const sal_uInt32 ENCRYPTINFO_CRYPTOAPI = 0x00000004;
|
||||
const sal_uInt32 ENCRYPTINFO_DOCPROPS = 0x00000008;
|
||||
const sal_uInt32 ENCRYPTINFO_EXTERNAL = 0x00000010;
|
||||
const sal_uInt32 ENCRYPTINFO_AES = 0x00000020;
|
||||
|
||||
const sal_uInt32 ENCRYPT_ALGO_AES128 = 0x0000660E;
|
||||
const sal_uInt32 ENCRYPT_ALGO_AES192 = 0x0000660F;
|
||||
const sal_uInt32 ENCRYPT_ALGO_AES256 = 0x00006610;
|
||||
const sal_uInt32 ENCRYPT_ALGO_RC4 = 0x00006801;
|
||||
|
||||
const sal_uInt32 ENCRYPT_HASH_SHA1 = 0x00008004;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool lclIsZipPackage( const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm )
|
||||
{
|
||||
OUString aFilter;
|
||||
ZipStorage aZipStorage( rxFactory, rxInStrm );
|
||||
return aZipStorage.isStorage();
|
||||
}
|
||||
|
||||
if( mxFactory.is() ) try
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
struct PackageEncryptionInfo
|
||||
{
|
||||
sal_uInt8 mpnSalt[ 16 ];
|
||||
sal_uInt8 mpnEncrVerifier[ 16 ];
|
||||
sal_uInt8 mpnEncrVerifierHash[ 32 ];
|
||||
sal_uInt32 mnFlags;
|
||||
sal_uInt32 mnAlgorithmId;
|
||||
sal_uInt32 mnAlgorithmIdHash;
|
||||
sal_uInt32 mnKeySize;
|
||||
sal_uInt32 mnSaltSize;
|
||||
sal_uInt32 mnVerifierHashSize;
|
||||
};
|
||||
|
||||
bool lclReadEncryptionInfo( PackageEncryptionInfo& rEncrInfo, BinaryInputStream& rStrm )
|
||||
{
|
||||
rStrm.skip( 4 );
|
||||
rStrm >> rEncrInfo.mnFlags;
|
||||
if( getFlag( rEncrInfo.mnFlags, ENCRYPTINFO_EXTERNAL ) )
|
||||
return false;
|
||||
|
||||
sal_uInt32 nHeaderSize, nRepeatedFlags;
|
||||
rStrm >> nHeaderSize >> nRepeatedFlags;
|
||||
if( (nHeaderSize < 20) || (nRepeatedFlags != rEncrInfo.mnFlags) )
|
||||
return false;
|
||||
|
||||
rStrm.skip( 4 );
|
||||
rStrm >> rEncrInfo.mnAlgorithmId >> rEncrInfo.mnAlgorithmIdHash >> rEncrInfo.mnKeySize;
|
||||
rStrm.skip( nHeaderSize - 20 );
|
||||
rStrm >> rEncrInfo.mnSaltSize;
|
||||
if( rEncrInfo.mnSaltSize != 16 )
|
||||
return false;
|
||||
|
||||
rStrm.readMemory( rEncrInfo.mpnSalt, 16 );
|
||||
rStrm.readMemory( rEncrInfo.mpnEncrVerifier, 16 );
|
||||
rStrm >> rEncrInfo.mnVerifierHashSize;
|
||||
rStrm.readMemory( rEncrInfo.mpnEncrVerifierHash, 32 );
|
||||
return !rStrm.isEof();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void lclDeriveKey( const sal_uInt8* pnHash, sal_uInt32 nHashLen, sal_uInt8* pnKeyDerived, sal_uInt32 nRequiredKeyLen )
|
||||
{
|
||||
sal_uInt8 pnBuffer[ 64 ];
|
||||
memset( pnBuffer, 0x36, sizeof( pnBuffer ) );
|
||||
for( sal_uInt32 i = 0; i < nHashLen; ++i )
|
||||
pnBuffer[ i ] ^= pnHash[ i ];
|
||||
|
||||
rtlDigest aDigest = rtl_digest_create( rtl_Digest_AlgorithmSHA1 );
|
||||
rtlDigestError aError = rtl_digest_update( aDigest, pnBuffer, sizeof( pnBuffer ) );
|
||||
sal_uInt8 pnX1[ RTL_DIGEST_LENGTH_SHA1 ];
|
||||
aError = rtl_digest_get( aDigest, pnX1, RTL_DIGEST_LENGTH_SHA1 );
|
||||
rtl_digest_destroy( aDigest );
|
||||
|
||||
memset( pnBuffer, 0x5C, sizeof( pnBuffer ) );
|
||||
for( sal_uInt32 i = 0; i < nHashLen; ++i )
|
||||
pnBuffer[ i ] ^= pnHash[ i ];
|
||||
|
||||
aDigest = rtl_digest_create( rtl_Digest_AlgorithmSHA1 );
|
||||
aError = rtl_digest_update( aDigest, pnBuffer, sizeof( pnBuffer ) );
|
||||
sal_uInt8 pnX2[ RTL_DIGEST_LENGTH_SHA1 ];
|
||||
aError = rtl_digest_get( aDigest, pnX2, RTL_DIGEST_LENGTH_SHA1 );
|
||||
rtl_digest_destroy( aDigest );
|
||||
|
||||
if( nRequiredKeyLen > RTL_DIGEST_LENGTH_SHA1 )
|
||||
{
|
||||
Reference< XFastParser > xParser( mxFactory->createInstance(
|
||||
CREATE_OUSTRING( "com.sun.star.xml.sax.FastParser" ) ), UNO_QUERY_THROW );
|
||||
|
||||
xParser->setFastDocumentHandler( new FilterDetectDocHandler( aFilter ) );
|
||||
xParser->setTokenHandler( new FastTokenHandler );
|
||||
|
||||
xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships" ), NMSP_PACKAGE_RELATIONSHIPS );
|
||||
xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships" ), NMSP_RELATIONSHIPS );
|
||||
xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/content-types" ), NMSP_CONTENT_TYPES );
|
||||
|
||||
MediaDescriptor aDescriptor( lDescriptor );
|
||||
aDescriptor.addInputStream();
|
||||
Reference< XInputStream > xInputStream( aDescriptor[ MediaDescriptor::PROP_INPUTSTREAM() ], UNO_QUERY_THROW );
|
||||
StorageRef xStorage( new ZipStorage( mxFactory, xInputStream ) );
|
||||
|
||||
// Parse _rels/.rels to get the target path.
|
||||
InputSource aParserInput;
|
||||
aParserInput.sSystemId = CREATE_OUSTRING( "_rels/.rels" );
|
||||
aParserInput.aInputStream = xStorage->openInputStream( aParserInput.sSystemId );
|
||||
xParser->parseStream( aParserInput );
|
||||
|
||||
// Parse [Content_Types].xml to determine the content type of the part at the target path.
|
||||
aParserInput.sSystemId = CREATE_OUSTRING( "[Content_Types].xml" );
|
||||
aParserInput.aInputStream = xStorage->openInputStream( aParserInput.sSystemId );
|
||||
xParser->parseStream( aParserInput );
|
||||
memcpy( pnKeyDerived + RTL_DIGEST_LENGTH_SHA1, pnX2, nRequiredKeyLen - RTL_DIGEST_LENGTH_SHA1 );
|
||||
nRequiredKeyLen = RTL_DIGEST_LENGTH_SHA1;
|
||||
}
|
||||
catch ( const Exception& )
|
||||
memcpy( pnKeyDerived, pnX1, nRequiredKeyLen );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool lclGenerateEncryptionKey( const PackageEncryptionInfo& rEncrInfo, const OUString& rPassword, sal_uInt8* pnKey, sal_uInt32 nRequiredKeyLen )
|
||||
{
|
||||
size_t nBufferSize = rEncrInfo.mnSaltSize + 2 * rPassword.getLength();
|
||||
sal_uInt8* pnBuffer = new sal_uInt8[ nBufferSize ];
|
||||
memcpy( pnBuffer, rEncrInfo.mpnSalt, rEncrInfo.mnSaltSize );
|
||||
|
||||
sal_uInt8* pnPasswordLoc = pnBuffer + rEncrInfo.mnSaltSize;
|
||||
const sal_Unicode* pStr = rPassword.getStr();
|
||||
for( sal_Int32 i = 0, nLen = rPassword.getLength(); i < nLen; ++i, ++pStr, pnPasswordLoc += 2 )
|
||||
ByteOrderConverter::writeLittleEndian( pnPasswordLoc, static_cast< sal_uInt16 >( *pStr ) );
|
||||
|
||||
rtlDigest aDigest = rtl_digest_create( rtl_Digest_AlgorithmSHA1 );
|
||||
rtlDigestError aError = rtl_digest_update( aDigest, pnBuffer, nBufferSize );
|
||||
delete[] pnBuffer;
|
||||
|
||||
size_t nHashSize = RTL_DIGEST_LENGTH_SHA1 + 4;
|
||||
sal_uInt8* pnHash = new sal_uInt8[ nHashSize ];
|
||||
aError = rtl_digest_get( aDigest, pnHash + 4, RTL_DIGEST_LENGTH_SHA1 );
|
||||
rtl_digest_destroy( aDigest );
|
||||
|
||||
for( sal_uInt32 i = 0; i < 50000; ++i )
|
||||
{
|
||||
ByteOrderConverter::writeLittleEndian( pnHash, i );
|
||||
aDigest = rtl_digest_create( rtl_Digest_AlgorithmSHA1 );
|
||||
aError = rtl_digest_update( aDigest, pnHash, nHashSize );
|
||||
aError = rtl_digest_get( aDigest, pnHash + 4, RTL_DIGEST_LENGTH_SHA1 );
|
||||
rtl_digest_destroy( aDigest );
|
||||
}
|
||||
|
||||
return aFilter;
|
||||
memmove( pnHash, pnHash + 4, RTL_DIGEST_LENGTH_SHA1 );
|
||||
memset( pnHash + RTL_DIGEST_LENGTH_SHA1, 0, 4 );
|
||||
aDigest = rtl_digest_create( rtl_Digest_AlgorithmSHA1 );
|
||||
aError = rtl_digest_update( aDigest, pnHash, nHashSize );
|
||||
aError = rtl_digest_get( aDigest, pnHash, RTL_DIGEST_LENGTH_SHA1 );
|
||||
rtl_digest_destroy( aDigest );
|
||||
|
||||
lclDeriveKey( pnHash, RTL_DIGEST_LENGTH_SHA1, pnKey, nRequiredKeyLen );
|
||||
delete[] pnHash;
|
||||
|
||||
// check password
|
||||
EVP_CIPHER_CTX aes_ctx;
|
||||
EVP_CIPHER_CTX_init( &aes_ctx );
|
||||
EVP_DecryptInit_ex( &aes_ctx, EVP_aes_128_ecb(), 0, pnKey, 0 );
|
||||
EVP_CIPHER_CTX_set_padding( &aes_ctx, 0 );
|
||||
int nOutLen = 0;
|
||||
sal_uInt8 pnVerifier[ 16 ] = { 0 };
|
||||
/*int*/ EVP_DecryptUpdate( &aes_ctx, pnVerifier, &nOutLen, rEncrInfo.mpnEncrVerifier, sizeof( rEncrInfo.mpnEncrVerifier ) );
|
||||
EVP_CIPHER_CTX_cleanup( &aes_ctx );
|
||||
|
||||
EVP_CIPHER_CTX_init( &aes_ctx );
|
||||
EVP_DecryptInit_ex( &aes_ctx, EVP_aes_128_ecb(), 0, pnKey, 0 );
|
||||
EVP_CIPHER_CTX_set_padding( &aes_ctx, 0 );
|
||||
sal_uInt8 pnVerifierHash[ 32 ] = { 0 };
|
||||
/*int*/ EVP_DecryptUpdate( &aes_ctx, pnVerifierHash, &nOutLen, rEncrInfo.mpnEncrVerifierHash, sizeof( rEncrInfo.mpnEncrVerifierHash ) );
|
||||
EVP_CIPHER_CTX_cleanup( &aes_ctx );
|
||||
|
||||
aDigest = rtl_digest_create( rtl_Digest_AlgorithmSHA1 );
|
||||
aError = rtl_digest_update( aDigest, pnVerifier, sizeof( pnVerifier ) );
|
||||
sal_uInt8 pnSha1Hash[ RTL_DIGEST_LENGTH_SHA1 ];
|
||||
aError = rtl_digest_get( aDigest, pnSha1Hash, RTL_DIGEST_LENGTH_SHA1 );
|
||||
rtl_digest_destroy( aDigest );
|
||||
|
||||
return memcmp( pnSha1Hash, pnVerifierHash, RTL_DIGEST_LENGTH_SHA1 ) == 0;
|
||||
}
|
||||
|
||||
// the password verifier ------------------------------------------------------
|
||||
|
||||
class PasswordVerifier : public ::comphelper::IDocPasswordVerifier
|
||||
{
|
||||
public:
|
||||
explicit PasswordVerifier( const PackageEncryptionInfo& rEncryptInfo );
|
||||
|
||||
virtual ::comphelper::DocPasswordVerifierResult
|
||||
verifyPassword( const OUString& rPassword );
|
||||
|
||||
inline const sal_uInt8* getKey() const { return &maKey.front(); }
|
||||
|
||||
private:
|
||||
const PackageEncryptionInfo& mrEncryptInfo;
|
||||
::std::vector< sal_uInt8 > maKey;
|
||||
};
|
||||
|
||||
PasswordVerifier::PasswordVerifier( const PackageEncryptionInfo& rEncryptInfo ) :
|
||||
mrEncryptInfo( rEncryptInfo ),
|
||||
maKey( static_cast< size_t >( rEncryptInfo.mnKeySize / 8 ), 0 )
|
||||
{
|
||||
}
|
||||
|
||||
::comphelper::DocPasswordVerifierResult PasswordVerifier::verifyPassword( const OUString& rPassword )
|
||||
{
|
||||
// verifies the password and writes the related decryption key into maKey
|
||||
return lclGenerateEncryptionKey( mrEncryptInfo, rPassword, &maKey.front(), maKey.size() ) ?
|
||||
::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescriptor& rMediaDesc ) const
|
||||
{
|
||||
if( mxFactory.is() )
|
||||
{
|
||||
// try the plain input stream
|
||||
Reference< XInputStream > xInStrm( rMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ], UNO_QUERY );
|
||||
if( !xInStrm.is() || lclIsZipPackage( mxFactory, xInStrm ) )
|
||||
return xInStrm;
|
||||
|
||||
// check if a temporary file is passed in the 'ComponentData' property
|
||||
Sequence< NamedValue > aCompData = rMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_COMPONENTDATA(), Sequence< NamedValue >() );
|
||||
SequenceAsHashMap aCompDataMap( aCompData );
|
||||
Reference< XStream > xDecrypted = aCompDataMap.getUnpackedValueOrDefault( CREATE_OUSTRING( "DecryptedPackage" ), Reference< XStream >() );
|
||||
if( xDecrypted.is() )
|
||||
{
|
||||
Reference< XInputStream > xDecrInStrm = xDecrypted->getInputStream();
|
||||
if( lclIsZipPackage( mxFactory, xDecrInStrm ) )
|
||||
return xDecrInStrm;
|
||||
}
|
||||
|
||||
// try to decrypt an encrypted OLE package
|
||||
OleStorage aOleStorage( mxFactory, xInStrm, false );
|
||||
if( aOleStorage.isStorage() ) try
|
||||
{
|
||||
// open the required input streams in the encrypted package
|
||||
Reference< XInputStream > xEncryptionInfo( aOleStorage.openInputStream( CREATE_OUSTRING( "EncryptionInfo" ) ), UNO_SET_THROW );
|
||||
Reference< XInputStream > xEncryptedPackage( aOleStorage.openInputStream( CREATE_OUSTRING( "EncryptedPackage" ) ), UNO_SET_THROW );
|
||||
|
||||
// read the encryption info stream
|
||||
PackageEncryptionInfo aEncryptInfo;
|
||||
BinaryXInputStream aInfoStrm( xEncryptionInfo, true );
|
||||
bool bValidInfo = lclReadEncryptionInfo( aEncryptInfo, aInfoStrm );
|
||||
|
||||
// check flags and agorithm IDs, requiered are AES128 and SHA-1
|
||||
bool bImplemented = bValidInfo &&
|
||||
getFlag( aEncryptInfo.mnFlags, ENCRYPTINFO_CRYPTOAPI ) &&
|
||||
getFlag( aEncryptInfo.mnFlags, ENCRYPTINFO_AES ) &&
|
||||
// algorithm ID 0 defaults to AES128 too, if ENCRYPTINFO_AES flag is set
|
||||
((aEncryptInfo.mnAlgorithmId == 0) || (aEncryptInfo.mnAlgorithmId == ENCRYPT_ALGO_AES128)) &&
|
||||
// hash algorithm ID 0 defaults to SHA-1 too
|
||||
((aEncryptInfo.mnAlgorithmIdHash == 0) || (aEncryptInfo.mnAlgorithmIdHash == ENCRYPT_HASH_SHA1)) &&
|
||||
(aEncryptInfo.mnVerifierHashSize == 20);
|
||||
|
||||
if( bImplemented )
|
||||
{
|
||||
/* "VelvetSweatshop" is the built-in default encryption
|
||||
password used by MS Excel for the "workbook protection"
|
||||
feature with password. Try this first before prompting the
|
||||
user for a password. */
|
||||
::std::vector< OUString > aDefaultPasswords;
|
||||
aDefaultPasswords.push_back( CREATE_OUSTRING( "VelvetSweatshop" ) );
|
||||
|
||||
/* Use the comphelper password helper to request a password.
|
||||
This helper returns either with the correct password
|
||||
(according to the verifier), or with an empty string if
|
||||
user has cancelled the password input dialog. */
|
||||
PasswordVerifier aVerifier( aEncryptInfo );
|
||||
OUString aPassword = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
|
||||
aVerifier, rMediaDesc, ::comphelper::DocPasswordRequestType_MS, &aDefaultPasswords );
|
||||
|
||||
if( aPassword.getLength() == 0 )
|
||||
{
|
||||
rMediaDesc[ MediaDescriptor::PROP_ABORTED() ] <<= true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// create temporary file for unencrypted package
|
||||
Reference< XStream > xTempFile( mxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW );
|
||||
Reference< XOutputStream > xDecryptedPackage( xTempFile->getOutputStream(), UNO_SET_THROW );
|
||||
BinaryXOutputStream aDecryptedPackage( xDecryptedPackage, true );
|
||||
BinaryXInputStream aEncryptedPackage( xEncryptedPackage, true );
|
||||
|
||||
EVP_CIPHER_CTX aes_ctx;
|
||||
EVP_CIPHER_CTX_init( &aes_ctx );
|
||||
EVP_DecryptInit_ex( &aes_ctx, EVP_aes_128_ecb(), 0, aVerifier.getKey(), 0 );
|
||||
EVP_CIPHER_CTX_set_padding( &aes_ctx, 0 );
|
||||
|
||||
sal_uInt8 pnInBuffer[ 1024 ];
|
||||
sal_uInt8 pnOutBuffer[ 1024 ];
|
||||
sal_Int32 nInLen;
|
||||
int nOutLen;
|
||||
aEncryptedPackage.skip( 8 ); // decrypted size
|
||||
while( (nInLen = aEncryptedPackage.readMemory( pnInBuffer, sizeof( pnInBuffer ) )) > 0 )
|
||||
{
|
||||
EVP_DecryptUpdate( &aes_ctx, pnOutBuffer, &nOutLen, pnInBuffer, nInLen );
|
||||
aDecryptedPackage.writeMemory( pnOutBuffer, nOutLen );
|
||||
}
|
||||
EVP_DecryptFinal_ex( &aes_ctx, pnOutBuffer, &nOutLen );
|
||||
aDecryptedPackage.writeMemory( pnOutBuffer, nOutLen );
|
||||
|
||||
EVP_CIPHER_CTX_cleanup( &aes_ctx );
|
||||
xDecryptedPackage->flush();
|
||||
aDecryptedPackage.seekToStart();
|
||||
|
||||
// store temp file in media descriptor to keep it alive
|
||||
Sequence< NamedValue > aPropSeq( 1 );
|
||||
aPropSeq[ 0 ].Name = CREATE_OUSTRING( "DecryptedPackage" );
|
||||
aPropSeq[ 0 ].Value <<= xTempFile;
|
||||
rMediaDesc[ MediaDescriptor::PROP_COMPONENTDATA() ] <<= aPropSeq;
|
||||
|
||||
Reference< XInputStream > xDecrInStrm = xTempFile->getInputStream();
|
||||
if( lclIsZipPackage( mxFactory, xDecrInStrm ) )
|
||||
return xDecrInStrm;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return Reference< XInputStream >();
|
||||
}
|
||||
|
||||
// com.sun.star.lang.XServiceInfo interface -----------------------------------
|
||||
|
@ -378,6 +601,62 @@ Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames() throw( Ru
|
|||
return FilterDetect_getSupportedServiceNames();
|
||||
}
|
||||
|
||||
// com.sun.star.document.XExtendedFilterDetection interface -------------------
|
||||
|
||||
OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq ) throw( RuntimeException )
|
||||
{
|
||||
OUString aFilterName;
|
||||
MediaDescriptor aMediaDesc( rMediaDescSeq );
|
||||
|
||||
/* Check that the user has not choosen to abort detection, e.g. by hitting
|
||||
'Cancel' in the password input dialog. This may happen because this
|
||||
filter detection is used by different filters. */
|
||||
bool bAborted = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_ABORTED(), false );
|
||||
if( !bAborted && mxFactory.is() ) try
|
||||
{
|
||||
aMediaDesc.addInputStream();
|
||||
|
||||
/* Get the unencrypted input stream. This may include creation of a
|
||||
temporary file that contains the decrypted package. This temporary
|
||||
file will be stored in the 'ComponentData' property of the media
|
||||
descriptor. */
|
||||
Reference< XInputStream > xInStrm( extractUnencryptedPackage( aMediaDesc ), UNO_SET_THROW );
|
||||
|
||||
// try to detect the file type, must be a ZIP package
|
||||
ZipStorage aZipStorage( mxFactory, xInStrm );
|
||||
if( aZipStorage.isStorage() )
|
||||
{
|
||||
Reference< XFastParser > xParser( mxFactory->createInstance(
|
||||
CREATE_OUSTRING( "com.sun.star.xml.sax.FastParser" ) ), UNO_QUERY_THROW );
|
||||
|
||||
xParser->setFastDocumentHandler( new FilterDetectDocHandler( aFilterName ) );
|
||||
xParser->setTokenHandler( new FastTokenHandler );
|
||||
|
||||
xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships" ), NMSP_PACKAGE_RELATIONSHIPS );
|
||||
xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships" ), NMSP_RELATIONSHIPS );
|
||||
xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/content-types" ), NMSP_CONTENT_TYPES );
|
||||
|
||||
// Parse _rels/.rels to get the target path.
|
||||
InputSource aParserInput;
|
||||
aParserInput.sSystemId = CREATE_OUSTRING( "_rels/.rels" );
|
||||
aParserInput.aInputStream = aZipStorage.openInputStream( aParserInput.sSystemId );
|
||||
xParser->parseStream( aParserInput );
|
||||
|
||||
// Parse [Content_Types].xml to determine the content type of the part at the target path.
|
||||
aParserInput.sSystemId = CREATE_OUSTRING( "[Content_Types].xml" );
|
||||
aParserInput.aInputStream = aZipStorage.openInputStream( aParserInput.sSystemId );
|
||||
xParser->parseStream( aParserInput );
|
||||
}
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
}
|
||||
|
||||
// write back changed media descriptor members
|
||||
aMediaDesc >> rMediaDescSeq;
|
||||
return aFilterName;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
} // namespace core
|
||||
|
|
|
@ -42,6 +42,10 @@ ENABLE_EXCEPTIONS=TRUE
|
|||
.INCLUDE : settings.mk
|
||||
.INCLUDE: $(PRJ)$/util$/makefile.pmk
|
||||
|
||||
.IF "$(SYSTEM_OPENSSL)" == "YES"
|
||||
CFLAGS+= $(OPENSSL_CFLAGS)
|
||||
.ENDIF
|
||||
|
||||
# --- Files --------------------------------------------------------
|
||||
|
||||
SLOFILES = \
|
||||
|
@ -50,6 +54,7 @@ SLOFILES = \
|
|||
$(SLO)$/contexthandler.obj \
|
||||
$(SLO)$/contexthandler2.obj \
|
||||
$(SLO)$/facreg.obj \
|
||||
$(SLO)$/fasttokenhandler.obj \
|
||||
$(SLO)$/filterbase.obj \
|
||||
$(SLO)$/filterdetect.obj \
|
||||
$(SLO)$/fragmenthandler.obj \
|
||||
|
|
|
@ -28,29 +28,32 @@
|
|||
*
|
||||
************************************************************************/
|
||||
|
||||
#include "properties.hxx"
|
||||
#include "oox/core/xmlfilterbase.hxx"
|
||||
#include "oox/core/fasttokenhandler.hxx"
|
||||
#include "oox/core/fragmenthandler.hxx"
|
||||
#include "oox/core/namespaces.hxx"
|
||||
#include "oox/core/recordparser.hxx"
|
||||
#include "oox/core/relationshandler.hxx"
|
||||
#include "oox/helper/containerhelper.hxx"
|
||||
#include "oox/helper/propertyset.hxx"
|
||||
#include "oox/helper/zipstorage.hxx"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include <rtl/strbuf.hxx>
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#include <com/sun/star/container/XNameContainer.hpp>
|
||||
#include <com/sun/star/embed/XRelationshipAccess.hpp>
|
||||
#include <com/sun/star/xml/sax/InputSource.hpp>
|
||||
#include <com/sun/star/xml/sax/XFastParser.hpp>
|
||||
#include <com/sun/star/document/XDocumentProperties.hpp>
|
||||
#include <comphelper/mediadescriptor.hxx>
|
||||
#include <sax/fshelper.hxx>
|
||||
|
||||
#include "properties.hxx"
|
||||
#include "tokens.hxx"
|
||||
#include "oox/helper/containerhelper.hxx"
|
||||
#include "oox/helper/propertyset.hxx"
|
||||
#include "oox/helper/zipstorage.hxx"
|
||||
#include "oox/core/fasttokenhandler.hxx"
|
||||
#include "oox/core/filterdetect.hxx"
|
||||
#include "oox/core/fragmenthandler.hxx"
|
||||
#include "oox/core/namespaces.hxx"
|
||||
#include "oox/core/recordparser.hxx"
|
||||
#include "oox/core/relationshandler.hxx"
|
||||
|
||||
using ::rtl::OStringBuffer;
|
||||
using ::rtl::OUString;
|
||||
using ::rtl::OUStringBuffer;
|
||||
using ::com::sun::star::beans::StringPair;
|
||||
|
@ -76,6 +79,7 @@ using ::com::sun::star::xml::sax::InputSource;
|
|||
using ::com::sun::star::xml::sax::SAXException;
|
||||
using ::com::sun::star::document::XDocumentProperties;
|
||||
using ::com::sun::star::util::DateTime;
|
||||
using ::comphelper::MediaDescriptor;
|
||||
using ::sax_fastparser::FastSerializerHelper;
|
||||
using ::sax_fastparser::FSHelperPtr;
|
||||
|
||||
|
@ -207,8 +211,17 @@ bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& r
|
|||
InputSource aSource;
|
||||
aSource.aInputStream = xInStrm;
|
||||
aSource.sSystemId = aFragmentPath;
|
||||
xParser->parseStream( aSource );
|
||||
return true;
|
||||
// own try/catch block for showing parser failure assertion with fragment path
|
||||
try
|
||||
{
|
||||
xParser->parseStream( aSource );
|
||||
return true;
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
OSL_ENSURE( false, OStringBuffer( "XmlFilterBase::importFragment - XML parser failed in fragment '" ).
|
||||
append( OUStringToOString( aFragmentPath, RTL_TEXTENCODING_ASCII_US ) ).append( '\'' ).getStr() );
|
||||
}
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
|
@ -479,16 +492,27 @@ XmlFilterBase& XmlFilterBase::exportDocumentProperties( Reference< XDocumentProp
|
|||
return *this;
|
||||
}
|
||||
|
||||
StorageRef XmlFilterBase::implCreateStorage(
|
||||
Reference< XInputStream >& rxInStream, Reference< XStream >& rxOutStream ) const
|
||||
{
|
||||
StorageRef xStorage;
|
||||
if( rxInStream.is() )
|
||||
xStorage.reset( new ZipStorage( getGlobalFactory(), rxInStream ) );
|
||||
else if( rxOutStream.is() )
|
||||
xStorage.reset( new ZipStorage( getGlobalFactory(), rxOutStream ) );
|
||||
// protected ------------------------------------------------------------------
|
||||
|
||||
return xStorage;
|
||||
Reference< XInputStream > XmlFilterBase::implGetInputStream( MediaDescriptor& rMediaDesc ) const
|
||||
{
|
||||
/* Get the input stream directly from the media descriptor, or decrypt the
|
||||
package again. The latter is needed e.g. when the document is reloaded.
|
||||
All this is implemented in the detector service. */
|
||||
FilterDetect aDetector( getGlobalFactory() );
|
||||
return aDetector.extractUnencryptedPackage( rMediaDesc );
|
||||
}
|
||||
|
||||
// private --------------------------------------------------------------------
|
||||
|
||||
StorageRef XmlFilterBase::implCreateStorage( const Reference< XInputStream >& rxInStream ) const
|
||||
{
|
||||
return StorageRef( new ZipStorage( getGlobalFactory(), rxInStream ) );
|
||||
}
|
||||
|
||||
StorageRef XmlFilterBase::implCreateStorage( const Reference< XStream >& rxOutStream ) const
|
||||
{
|
||||
return StorageRef( new ZipStorage( getGlobalFactory(), rxOutStream ) );
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
@ -892,7 +892,7 @@ void LineFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Sh
|
|||
aLineProps.assignUsed( *mxAutoLine );
|
||||
if( rxShapeProp.is() )
|
||||
aLineProps.assignUsed( rxShapeProp->getLineProperties() );
|
||||
aLineProps.pushToPropSet( rPropSet, mrLinePropIds, mrData.mrFilter, mrData.maModelObjHelper, getPhColor( nSeriesIdx ) );
|
||||
aLineProps.pushToPropSet( rPropSet, mrData.mrFilter, mrData.maModelObjHelper, mrLinePropIds, getPhColor( nSeriesIdx ) );
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
@ -920,7 +920,7 @@ void FillFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Sh
|
|||
aFillProps.assignUsed( rxShapeProp->getFillProperties() );
|
||||
if( pPicOptions )
|
||||
lclConvertPictureOptions( aFillProps, *pPicOptions );
|
||||
aFillProps.pushToPropSet( rPropSet, mrFillPropIds, mrData.mrFilter, mrData.maModelObjHelper, 0, getPhColor( nSeriesIdx ) );
|
||||
aFillProps.pushToPropSet( rPropSet, mrData.mrFilter, mrData.maModelObjHelper, mrFillPropIds, 0, getPhColor( nSeriesIdx ) );
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "oox/drawingml/clrschemecontext.hxx"
|
||||
#include "oox/core/namespaces.hxx"
|
||||
#include "oox/core/xmlfilterbase.hxx"
|
||||
#include "tokens.hxx"
|
||||
|
||||
using namespace ::oox::core;
|
||||
|
|
|
@ -29,11 +29,15 @@
|
|||
************************************************************************/
|
||||
|
||||
#include "oox/drawingml/color.hxx"
|
||||
#include "oox/core/namespaces.hxx"
|
||||
#include "oox/core/xmlfilterbase.hxx"
|
||||
#include "tokens.hxx"
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
#include "tokens.hxx"
|
||||
#include "oox/helper/containerhelper.hxx"
|
||||
#include "oox/core/namespaces.hxx"
|
||||
#include "oox/core/filterbase.hxx"
|
||||
#include "oox/drawingml/drawingmltypes.hxx"
|
||||
|
||||
using ::rtl::OUString;
|
||||
|
||||
namespace oox {
|
||||
namespace drawingml {
|
||||
|
@ -42,163 +46,126 @@ namespace drawingml {
|
|||
|
||||
namespace {
|
||||
|
||||
const sal_Int32 PER_PERCENT = 1000;
|
||||
const sal_Int32 MAX_PERCENT = 100 * PER_PERCENT;
|
||||
/** Global storage for predefined color values used in OOXML file formats. */
|
||||
struct PresetColorsPool
|
||||
{
|
||||
typedef ::std::vector< sal_Int32 > ColorVector;
|
||||
|
||||
const sal_Int32 PER_DEGREE = 60000;
|
||||
const sal_Int32 MAX_DEGREE = 360 * PER_DEGREE;
|
||||
ColorVector maDmlColors; /// Predefined colors in DrawingML, indexed by XML token.
|
||||
ColorVector maVmlColors; /// Predefined colors in VML, indexed by XML token.
|
||||
|
||||
explicit PresetColorsPool();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
PresetColorsPool::PresetColorsPool() :
|
||||
maDmlColors( static_cast< size_t >( XML_TOKEN_COUNT ), API_RGB_TRANSPARENT ),
|
||||
maVmlColors( static_cast< size_t >( XML_TOKEN_COUNT ), API_RGB_TRANSPARENT )
|
||||
{
|
||||
// predefined colors in DrawingML (map XML token identifiers to RGB values)
|
||||
static const sal_Int32 spnDmlColors[] =
|
||||
{
|
||||
XML_aliceBlue, 0xF0F8FF, XML_antiqueWhite, 0xFAEBD7,
|
||||
XML_aqua, 0x00FFFF, XML_aquamarine, 0x7FFFD4,
|
||||
XML_azure, 0xF0FFFF, XML_beige, 0xF5F5DC,
|
||||
XML_bisque, 0xFFE4C4, XML_black, 0x000000,
|
||||
XML_blanchedAlmond, 0xFFEBCD, XML_blue, 0x0000FF,
|
||||
XML_blueViolet, 0x8A2BE2, XML_brown, 0xA52A2A,
|
||||
XML_burlyWood, 0xDEB887, XML_cadetBlue, 0x5F9EA0,
|
||||
XML_chartreuse, 0x7FFF00, XML_chocolate, 0xD2691E,
|
||||
XML_coral, 0xFF7F50, XML_cornflowerBlue, 0x6495ED,
|
||||
XML_cornsilk, 0xFFF8DC, XML_crimson, 0xDC143C,
|
||||
XML_cyan, 0x00FFFF, XML_deepPink, 0xFF1493,
|
||||
XML_deepSkyBlue, 0x00BFFF, XML_dimGray, 0x696969,
|
||||
XML_dkBlue, 0x00008B, XML_dkCyan, 0x008B8B,
|
||||
XML_dkGoldenrod, 0xB8860B, XML_dkGray, 0xA9A9A9,
|
||||
XML_dkGreen, 0x006400, XML_dkKhaki, 0xBDB76B,
|
||||
XML_dkMagenta, 0x8B008B, XML_dkOliveGreen, 0x556B2F,
|
||||
XML_dkOrange, 0xFF8C00, XML_dkOrchid, 0x9932CC,
|
||||
XML_dkRed, 0x8B0000, XML_dkSalmon, 0xE9967A,
|
||||
XML_dkSeaGreen, 0x8FBC8B, XML_dkSlateBlue, 0x483D8B,
|
||||
XML_dkSlateGray, 0x2F4F4F, XML_dkTurquoise, 0x00CED1,
|
||||
XML_dkViolet, 0x9400D3, XML_dodgerBlue, 0x1E90FF,
|
||||
XML_firebrick, 0xB22222, XML_floralWhite, 0xFFFAF0,
|
||||
XML_forestGreen, 0x228B22, XML_fuchsia, 0xFF00FF,
|
||||
XML_gainsboro, 0xDCDCDC, XML_ghostWhite, 0xF8F8FF,
|
||||
XML_gold, 0xFFD700, XML_goldenrod, 0xDAA520,
|
||||
XML_gray, 0x808080, XML_green, 0x008000,
|
||||
XML_greenYellow, 0xADFF2F, XML_honeydew, 0xF0FFF0,
|
||||
XML_hotPink, 0xFF69B4, XML_indianRed, 0xCD5C5C,
|
||||
XML_indigo, 0x4B0082, XML_ivory, 0xFFFFF0,
|
||||
XML_khaki, 0xF0E68C, XML_lavender, 0xE6E6FA,
|
||||
XML_lavenderBlush, 0xFFF0F5, XML_lawnGreen, 0x7CFC00,
|
||||
XML_lemonChiffon, 0xFFFACD, XML_lime, 0x00FF00,
|
||||
XML_limeGreen, 0x32CD32, XML_linen, 0xFAF0E6,
|
||||
XML_ltBlue, 0xADD8E6, XML_ltCoral, 0xF08080,
|
||||
XML_ltCyan, 0xE0FFFF, XML_ltGoldenrodYellow, 0xFAFA78,
|
||||
XML_ltGray, 0xD3D3D3, XML_ltGreen, 0x90EE90,
|
||||
XML_ltPink, 0xFFB6C1, XML_ltSalmon, 0xFFA07A,
|
||||
XML_ltSeaGreen, 0x20B2AA, XML_ltSkyBlue, 0x87CEFA,
|
||||
XML_ltSlateGray, 0x778899, XML_ltSteelBlue, 0xB0C4DE,
|
||||
XML_ltYellow, 0xFFFFE0, XML_magenta, 0xFF00FF,
|
||||
XML_maroon, 0x800000, XML_medAquamarine, 0x66CDAA,
|
||||
XML_medBlue, 0x0000CD, XML_medOrchid, 0xBA55D3,
|
||||
XML_medPurple, 0x9370DB, XML_medSeaGreen, 0x3CB371,
|
||||
XML_medSlateBlue, 0x7B68EE, XML_medSpringGreen, 0x00FA9A,
|
||||
XML_medTurquoise, 0x48D1CC, XML_medVioletRed, 0xC71585,
|
||||
XML_midnightBlue, 0x191970, XML_mintCream, 0xF5FFFA,
|
||||
XML_mistyRose, 0xFFE4E1, XML_moccasin, 0xFFE4B5,
|
||||
XML_navajoWhite, 0xFFDEAD, XML_navy, 0x000080,
|
||||
XML_oldLace, 0xFDF5E6, XML_olive, 0x808000,
|
||||
XML_oliveDrab, 0x6B8E23, XML_orange, 0xFFA500,
|
||||
XML_orangeRed, 0xFF4500, XML_orchid, 0xDA70D6,
|
||||
XML_paleGoldenrod, 0xEEE8AA, XML_paleGreen, 0x98FB98,
|
||||
XML_paleTurquoise, 0xAFEEEE, XML_paleVioletRed, 0xDB7093,
|
||||
XML_papayaWhip, 0xFFEFD5, XML_peachPuff, 0xFFDAB9,
|
||||
XML_peru, 0xCD853F, XML_pink, 0xFFC0CB,
|
||||
XML_plum, 0xDDA0DD, XML_powderBlue, 0xB0E0E6,
|
||||
XML_purple, 0x800080, XML_red, 0xFF0000,
|
||||
XML_rosyBrown, 0xBC8F8F, XML_royalBlue, 0x4169E1,
|
||||
XML_saddleBrown, 0x8B4513, XML_salmon, 0xFA8072,
|
||||
XML_sandyBrown, 0xF4A460, XML_seaGreen, 0x2E8B57,
|
||||
XML_seaShell, 0xFFF5EE, XML_sienna, 0xA0522D,
|
||||
XML_silver, 0xC0C0C0, XML_skyBlue, 0x87CEEB,
|
||||
XML_slateBlue, 0x6A5ACD, XML_slateGray, 0x708090,
|
||||
XML_snow, 0xFFFAFA, XML_springGreen, 0x00FF7F,
|
||||
XML_steelBlue, 0x4682B4, XML_tan, 0xD2B48C,
|
||||
XML_teal, 0x008080, XML_thistle, 0xD8BFD8,
|
||||
XML_tomato, 0xFF6347, XML_turquoise, 0x40E0D0,
|
||||
XML_violet, 0xEE82EE, XML_wheat, 0xF5DEB3,
|
||||
XML_white, 0xFFFFFF, XML_whiteSmoke, 0xF5F5F5,
|
||||
XML_yellow, 0xFFFF00, XML_yellowGreen, 0x9ACD32
|
||||
};
|
||||
for( const sal_Int32* pnEntry = spnDmlColors; pnEntry < STATIC_ARRAY_END( spnDmlColors ); pnEntry += 2 )
|
||||
maDmlColors[ static_cast< size_t >( pnEntry[ 0 ] ) ] = pnEntry[ 1 ];
|
||||
|
||||
// predefined colors in VML (map XML token identifiers to RGB values)
|
||||
static const sal_Int32 spnVmlColors[] =
|
||||
{
|
||||
XML_aqua, 0x00FFFF, XML_black, 0x000000,
|
||||
XML_blue, 0x0000FF, XML_fuchsia, 0xFF00FF,
|
||||
XML_gray, 0x808080, XML_green, 0x008000,
|
||||
XML_lime, 0x00FF00, XML_maroon, 0x800000,
|
||||
XML_navy, 0x000080, XML_olive, 0x808000,
|
||||
XML_purple, 0x800080, XML_red, 0xFF0000,
|
||||
XML_silver, 0xC0C0C0, XML_teal, 0x008080,
|
||||
XML_white, 0xFFFFFF, XML_yellow, 0xFFFF00
|
||||
};
|
||||
for( const sal_Int32* pnEntry = spnVmlColors; pnEntry < STATIC_ARRAY_END( spnVmlColors ); pnEntry += 2 )
|
||||
maVmlColors[ static_cast< size_t >( pnEntry[ 0 ] ) ] = pnEntry[ 1 ];
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
struct StaticPresetColorsPool : public ::rtl::Static< PresetColorsPool, StaticPresetColorsPool > {};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
const double DEC_GAMMA = 2.3;
|
||||
const double INC_GAMMA = 1.0 / DEC_GAMMA;
|
||||
|
||||
sal_Int32 lclGetPresetColor( sal_Int32 nToken )
|
||||
{
|
||||
switch( nToken )
|
||||
{
|
||||
case XML_aliceBlue: return 0xF0F8FF;
|
||||
case XML_antiqueWhite: return 0xFAEBD7;
|
||||
case XML_aqua: return 0x00FFFF;
|
||||
case XML_aquamarine: return 0x7FFFD4;
|
||||
case XML_azure: return 0xF0FFFF;
|
||||
case XML_beige: return 0xF5F5DC;
|
||||
case XML_bisque: return 0xFFE4C4;
|
||||
case XML_black: return 0x000000;
|
||||
case XML_blanchedAlmond: return 0xFFEBCD;
|
||||
case XML_blue: return 0x0000FF;
|
||||
case XML_blueViolet: return 0x8A2BE2;
|
||||
case XML_brown: return 0xA52A2A;
|
||||
case XML_burlyWood: return 0xDEB887;
|
||||
case XML_cadetBlue: return 0x5F9EA0;
|
||||
case XML_chartreuse: return 0x7FFF00;
|
||||
case XML_chocolate: return 0xD2691E;
|
||||
case XML_coral: return 0xFF7F50;
|
||||
case XML_cornflowerBlue: return 0x6495ED;
|
||||
case XML_cornsilk: return 0xFFF8DC;
|
||||
case XML_crimson: return 0xDC143C;
|
||||
case XML_cyan: return 0x00FFFF;
|
||||
case XML_deepPink: return 0xFF1493;
|
||||
case XML_deepSkyBlue: return 0x00BFFF;
|
||||
case XML_dimGray: return 0x696969;
|
||||
case XML_dkBlue: return 0x00008B;
|
||||
case XML_dkCyan: return 0x008B8B;
|
||||
case XML_dkGoldenrod: return 0xB8860B;
|
||||
case XML_dkGray: return 0xA9A9A9;
|
||||
case XML_dkGreen: return 0x006400;
|
||||
case XML_dkKhaki: return 0xBDB76B;
|
||||
case XML_dkMagenta: return 0x8B008B;
|
||||
case XML_dkOliveGreen: return 0x556B2F;
|
||||
case XML_dkOrange: return 0xFF8C00;
|
||||
case XML_dkOrchid: return 0x9932CC;
|
||||
case XML_dkRed: return 0x8B0000;
|
||||
case XML_dkSalmon: return 0xE9967A;
|
||||
case XML_dkSeaGreen: return 0x8FBC8B;
|
||||
case XML_dkSlateBlue: return 0x483D8B;
|
||||
case XML_dkSlateGray: return 0x2F4F4F;
|
||||
case XML_dkTurquoise: return 0x00CED1;
|
||||
case XML_dkViolet: return 0x9400D3;
|
||||
case XML_dodgerBlue: return 0x1E90FF;
|
||||
case XML_firebrick: return 0xB22222;
|
||||
case XML_floralWhite: return 0xFFFAF0;
|
||||
case XML_forestGreen: return 0x228B22;
|
||||
case XML_fuchsia: return 0xFF00FF;
|
||||
case XML_gainsboro: return 0xDCDCDC;
|
||||
case XML_ghostWhite: return 0xF8F8FF;
|
||||
case XML_gold: return 0xFFD700;
|
||||
case XML_goldenrod: return 0xDAA520;
|
||||
case XML_gray: return 0x808080;
|
||||
case XML_green: return 0x008000;
|
||||
case XML_greenYellow: return 0xADFF2F;
|
||||
case XML_honeydew: return 0xF0FFF0;
|
||||
case XML_hotPink: return 0xFF69B4;
|
||||
case XML_indianRed: return 0xCD5C5C;
|
||||
case XML_indigo: return 0x4B0082;
|
||||
case XML_ivory: return 0xFFFFF0;
|
||||
case XML_khaki: return 0xF0E68C;
|
||||
case XML_lavender: return 0xE6E6FA;
|
||||
case XML_lavenderBlush: return 0xFFF0F5;
|
||||
case XML_lawnGreen: return 0x7CFC00;
|
||||
case XML_lemonChiffon: return 0xFFFACD;
|
||||
case XML_lime: return 0x00FF00;
|
||||
case XML_limeGreen: return 0x32CD32;
|
||||
case XML_linen: return 0xFAF0E6;
|
||||
case XML_ltBlue: return 0xADD8E6;
|
||||
case XML_ltCoral: return 0xF08080;
|
||||
case XML_ltCyan: return 0xE0FFFF;
|
||||
case XML_ltGoldenrodYellow: return 0xFAFA78;
|
||||
case XML_ltGray: return 0xD3D3D3;
|
||||
case XML_ltGreen: return 0x90EE90;
|
||||
case XML_ltPink: return 0xFFB6C1;
|
||||
case XML_ltSalmon: return 0xFFA07A;
|
||||
case XML_ltSeaGreen: return 0x20B2AA;
|
||||
case XML_ltSkyBlue: return 0x87CEFA;
|
||||
case XML_ltSlateGray: return 0x778899;
|
||||
case XML_ltSteelBlue: return 0xB0C4DE;
|
||||
case XML_ltYellow: return 0xFFFFE0;
|
||||
case XML_magenta: return 0xFF00FF;
|
||||
case XML_maroon: return 0x800000;
|
||||
case XML_medAquamarine: return 0x66CDAA;
|
||||
case XML_medBlue: return 0x0000CD;
|
||||
case XML_medOrchid: return 0xBA55D3;
|
||||
case XML_medPurple: return 0x9370DB;
|
||||
case XML_medSeaGreen: return 0x3CB371;
|
||||
case XML_medSlateBlue: return 0x7B68EE;
|
||||
case XML_medSpringGreen: return 0x00FA9A;
|
||||
case XML_medTurquoise: return 0x48D1CC;
|
||||
case XML_medVioletRed: return 0xC71585;
|
||||
case XML_midnightBlue: return 0x191970;
|
||||
case XML_mintCream: return 0xF5FFFA;
|
||||
case XML_mistyRose: return 0xFFE4E1;
|
||||
case XML_moccasin: return 0xFFE4B5;
|
||||
case XML_navajoWhite: return 0xFFDEAD;
|
||||
case XML_navy: return 0x000080;
|
||||
case XML_oldLace: return 0xFDF5E6;
|
||||
case XML_olive: return 0x808000;
|
||||
case XML_oliveDrab: return 0x6B8E23;
|
||||
case XML_orange: return 0xFFA500;
|
||||
case XML_orangeRed: return 0xFF4500;
|
||||
case XML_orchid: return 0xDA70D6;
|
||||
case XML_paleGoldenrod: return 0xEEE8AA;
|
||||
case XML_paleGreen: return 0x98FB98;
|
||||
case XML_paleTurquoise: return 0xAFEEEE;
|
||||
case XML_paleVioletRed: return 0xDB7093;
|
||||
case XML_papayaWhip: return 0xFFEFD5;
|
||||
case XML_peachPuff: return 0xFFDAB9;
|
||||
case XML_peru: return 0xCD853F;
|
||||
case XML_pink: return 0xFFC0CB;
|
||||
case XML_plum: return 0xDDA0DD;
|
||||
case XML_powderBlue: return 0xB0E0E6;
|
||||
case XML_purple: return 0x800080;
|
||||
case XML_red: return 0xFF0000;
|
||||
case XML_rosyBrown: return 0xBC8F8F;
|
||||
case XML_royalBlue: return 0x4169E1;
|
||||
case XML_saddleBrown: return 0x8B4513;
|
||||
case XML_salmon: return 0xFA8072;
|
||||
case XML_sandyBrown: return 0xF4A460;
|
||||
case XML_seaGreen: return 0x2E8B57;
|
||||
case XML_seaShell: return 0xFFF5EE;
|
||||
case XML_sienna: return 0xA0522D;
|
||||
case XML_silver: return 0xC0C0C0;
|
||||
case XML_skyBlue: return 0x87CEEB;
|
||||
case XML_slateBlue: return 0x6A5ACD;
|
||||
case XML_slateGray: return 0x708090;
|
||||
case XML_snow: return 0xFFFAFA;
|
||||
case XML_springGreen: return 0x00FF7F;
|
||||
case XML_steelBlue: return 0x4682B4;
|
||||
case XML_tan: return 0xD2B48C;
|
||||
case XML_teal: return 0x008080;
|
||||
case XML_thistle: return 0xD8BFD8;
|
||||
case XML_tomato: return 0xFF6347;
|
||||
case XML_turquoise: return 0x40E0D0;
|
||||
case XML_violet: return 0xEE82EE;
|
||||
case XML_wheat: return 0xF5DEB3;
|
||||
case XML_white: return 0xFFFFFF;
|
||||
case XML_whiteSmoke: return 0xF5F5F5;
|
||||
case XML_yellow: return 0xFFFF00;
|
||||
case XML_yellowGreen: return 0x9ACD32;
|
||||
}
|
||||
OSL_ENSURE( false, "lclGetPresetColor - invalid preset color token" );
|
||||
return API_RGB_BLACK;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
inline void lclRgbToRgbComponents( sal_Int32& ornR, sal_Int32& ornG, sal_Int32& ornB, sal_Int32 nRgb )
|
||||
{
|
||||
|
@ -248,7 +215,7 @@ void lclOffValue( sal_Int32& ornValue, sal_Int32 nOff, sal_Int32 nMax = MAX_PERC
|
|||
|
||||
} // namespace
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ============================================================================
|
||||
|
||||
Color::Color() :
|
||||
meMode( COLOR_UNUSED ),
|
||||
|
@ -263,6 +230,24 @@ Color::~Color()
|
|||
{
|
||||
}
|
||||
|
||||
/*static*/ sal_Int32 Color::getDmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb )
|
||||
{
|
||||
/* Do not pass nDefaultRgb to ContainerHelper::getVectorElement(), to be
|
||||
able to catch the existing vector entries without corresponding XML
|
||||
token identifier. */
|
||||
sal_Int32 nRgbValue = ContainerHelper::getVectorElement( StaticPresetColorsPool::get().maDmlColors, nToken, API_RGB_TRANSPARENT );
|
||||
return (nRgbValue >= 0) ? nRgbValue : nDefaultRgb;
|
||||
}
|
||||
|
||||
/*static*/ sal_Int32 Color::getVmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb )
|
||||
{
|
||||
/* Do not pass nDefaultRgb to ContainerHelper::getVectorElement(), to be
|
||||
able to catch the existing vector entries without corresponding XML
|
||||
token identifier. */
|
||||
sal_Int32 nRgbValue = ContainerHelper::getVectorElement( StaticPresetColorsPool::get().maVmlColors, nToken, API_RGB_TRANSPARENT );
|
||||
return (nRgbValue >= 0) ? nRgbValue : nDefaultRgb;
|
||||
}
|
||||
|
||||
void Color::setUnused()
|
||||
{
|
||||
meMode = COLOR_UNUSED;
|
||||
|
@ -299,7 +284,10 @@ void Color::setHslClr( sal_Int32 nHue, sal_Int32 nSat, sal_Int32 nLum )
|
|||
|
||||
void Color::setPrstClr( sal_Int32 nToken )
|
||||
{
|
||||
setSrgbClr( lclGetPresetColor( nToken ) );
|
||||
sal_Int32 nRgbValue = getDmlPresetColor( nToken, API_RGB_TRANSPARENT );
|
||||
OSL_ENSURE( nRgbValue >= 0, "Color::setPrstClr - invalid preset color token" );
|
||||
if( nRgbValue >= 0 )
|
||||
setSrgbClr( nRgbValue );
|
||||
}
|
||||
|
||||
void Color::setSchemeClr( sal_Int32 nToken )
|
||||
|
@ -309,6 +297,13 @@ void Color::setSchemeClr( sal_Int32 nToken )
|
|||
mnC1 = nToken;
|
||||
}
|
||||
|
||||
void Color::setPaletteClr( sal_Int32 nPaletteIdx )
|
||||
{
|
||||
OSL_ENSURE( nPaletteIdx >= 0, "Color::setPaletteClr - invalid palette index" );
|
||||
meMode = COLOR_PALETTE;
|
||||
mnC1 = nPaletteIdx;
|
||||
}
|
||||
|
||||
void Color::setSysClr( sal_Int32 nToken, sal_Int32 nLastRgb )
|
||||
{
|
||||
OSL_ENSURE( (-1 <= nLastRgb) && (nLastRgb <= 0xFFFFFF), "Color::setSysClr - invalid RGB value" );
|
||||
|
@ -347,12 +342,18 @@ void Color::addExcelTintTransformation( double fTint )
|
|||
maTransforms.push_back( Transformation( NMSP_XLS | XML_tint, nValue ) );
|
||||
}
|
||||
|
||||
void Color::clearTransformations()
|
||||
{
|
||||
maTransforms.clear();
|
||||
clearTransparence();
|
||||
}
|
||||
|
||||
void Color::clearTransparence()
|
||||
{
|
||||
mnAlpha = MAX_PERCENT;
|
||||
}
|
||||
|
||||
sal_Int32 Color::getColor( const ::oox::core::XmlFilterBase& rFilter, sal_Int32 nPhClr ) const
|
||||
sal_Int32 Color::getColor( const ::oox::core::FilterBase& rFilter, sal_Int32 nPhClr ) const
|
||||
{
|
||||
/* Special handling for theme style list placeholder colors (state
|
||||
COLOR_PH), Color::getColor() may be called with different placeholder
|
||||
|
@ -364,151 +365,154 @@ sal_Int32 Color::getColor( const ::oox::core::XmlFilterBase& rFilter, sal_Int32
|
|||
|
||||
switch( meMode )
|
||||
{
|
||||
case COLOR_UNUSED: return -1;
|
||||
case COLOR_FINAL: return mnC1;
|
||||
case COLOR_UNUSED: mnC1 = API_RGB_TRANSPARENT; break;
|
||||
|
||||
case COLOR_RGB: break; // nothing to do
|
||||
case COLOR_CRGB: break; // nothing to do
|
||||
case COLOR_HSL: break; // nothing to do
|
||||
|
||||
case COLOR_SCHEME:
|
||||
meMode = COLOR_RGB;
|
||||
lclRgbToRgbComponents( mnC1, mnC2, mnC3, rFilter.getSchemeClr( mnC1 ) );
|
||||
break;
|
||||
case COLOR_PH:
|
||||
meMode = COLOR_RGB;
|
||||
lclRgbToRgbComponents( mnC1, mnC2, mnC3, nPhClr );
|
||||
bIsPh = true;
|
||||
break;
|
||||
case COLOR_SYSTEM:
|
||||
meMode = COLOR_RGB;
|
||||
lclRgbToRgbComponents( mnC1, mnC2, mnC3, rFilter.getSystemColor( mnC1, mnC2 ) );
|
||||
break;
|
||||
case COLOR_SCHEME: setResolvedRgb( rFilter.getSchemeColor( mnC1 ) ); break;
|
||||
case COLOR_PALETTE: setResolvedRgb( rFilter.getPaletteColor( mnC1 ) ); break;
|
||||
case COLOR_SYSTEM: setResolvedRgb( rFilter.getSystemColor( mnC1, mnC2 ) ); break;
|
||||
case COLOR_PH: setResolvedRgb( nPhClr ); bIsPh = true; break;
|
||||
|
||||
case COLOR_FINAL: return mnC1;
|
||||
}
|
||||
|
||||
for( TransformVec::const_iterator aIt = maTransforms.begin(), aEnd = maTransforms.end(); aIt != aEnd; ++aIt )
|
||||
// if color is UNUSED or turns to UNUSED in setResolvedRgb, do not perform transformations
|
||||
if( meMode != COLOR_UNUSED )
|
||||
{
|
||||
switch( aIt->mnToken )
|
||||
for( TransformVec::const_iterator aIt = maTransforms.begin(), aEnd = maTransforms.end(); aIt != aEnd; ++aIt )
|
||||
{
|
||||
case XML_red: toCrgb(); lclSetValue( mnC1, aIt->mnValue ); break;
|
||||
case XML_redMod: toCrgb(); lclModValue( mnC1, aIt->mnValue ); break;
|
||||
case XML_redOff: toCrgb(); lclOffValue( mnC1, aIt->mnValue ); break;
|
||||
case XML_green: toCrgb(); lclSetValue( mnC2, aIt->mnValue ); break;
|
||||
case XML_greenMod: toCrgb(); lclModValue( mnC2, aIt->mnValue ); break;
|
||||
case XML_greenOff: toCrgb(); lclOffValue( mnC2, aIt->mnValue ); break;
|
||||
case XML_blue: toCrgb(); lclSetValue( mnC3, aIt->mnValue ); break;
|
||||
case XML_blueMod: toCrgb(); lclModValue( mnC3, aIt->mnValue ); break;
|
||||
case XML_blueOff: toCrgb(); lclOffValue( mnC3, aIt->mnValue ); break;
|
||||
switch( aIt->mnToken )
|
||||
{
|
||||
case XML_red: toCrgb(); lclSetValue( mnC1, aIt->mnValue ); break;
|
||||
case XML_redMod: toCrgb(); lclModValue( mnC1, aIt->mnValue ); break;
|
||||
case XML_redOff: toCrgb(); lclOffValue( mnC1, aIt->mnValue ); break;
|
||||
case XML_green: toCrgb(); lclSetValue( mnC2, aIt->mnValue ); break;
|
||||
case XML_greenMod: toCrgb(); lclModValue( mnC2, aIt->mnValue ); break;
|
||||
case XML_greenOff: toCrgb(); lclOffValue( mnC2, aIt->mnValue ); break;
|
||||
case XML_blue: toCrgb(); lclSetValue( mnC3, aIt->mnValue ); break;
|
||||
case XML_blueMod: toCrgb(); lclModValue( mnC3, aIt->mnValue ); break;
|
||||
case XML_blueOff: toCrgb(); lclOffValue( mnC3, aIt->mnValue ); break;
|
||||
|
||||
case XML_hue: toHsl(); lclSetValue( mnC1, aIt->mnValue, MAX_DEGREE ); break;
|
||||
case XML_hueMod: toHsl(); lclModValue( mnC1, aIt->mnValue, MAX_DEGREE ); break;
|
||||
case XML_hueOff: toHsl(); lclOffValue( mnC1, aIt->mnValue, MAX_DEGREE ); break;
|
||||
case XML_sat: toHsl(); lclSetValue( mnC2, aIt->mnValue ); break;
|
||||
case XML_satMod: toHsl(); lclModValue( mnC2, aIt->mnValue ); break;
|
||||
case XML_satOff: toHsl(); lclOffValue( mnC2, aIt->mnValue ); break;
|
||||
case XML_hue: toHsl(); lclSetValue( mnC1, aIt->mnValue, MAX_DEGREE ); break;
|
||||
case XML_hueMod: toHsl(); lclModValue( mnC1, aIt->mnValue, MAX_DEGREE ); break;
|
||||
case XML_hueOff: toHsl(); lclOffValue( mnC1, aIt->mnValue, MAX_DEGREE ); break;
|
||||
case XML_sat: toHsl(); lclSetValue( mnC2, aIt->mnValue ); break;
|
||||
case XML_satMod: toHsl(); lclModValue( mnC2, aIt->mnValue ); break;
|
||||
case XML_satOff: toHsl(); lclOffValue( mnC2, aIt->mnValue ); break;
|
||||
|
||||
case XML_lum:
|
||||
toHsl();
|
||||
lclSetValue( mnC3, aIt->mnValue );
|
||||
// if color changes to black or white, it will stay gray if luminance changes again
|
||||
if( (mnC3 == 0) || (mnC3 == MAX_PERCENT) ) mnC2 = 0;
|
||||
break;
|
||||
case XML_lumMod:
|
||||
toHsl();
|
||||
lclModValue( mnC3, aIt->mnValue );
|
||||
// if color changes to black or white, it will stay gray if luminance changes again
|
||||
if( (mnC3 == 0) || (mnC3 == MAX_PERCENT) ) mnC2 = 0;
|
||||
break;
|
||||
case XML_lumOff:
|
||||
toHsl();
|
||||
lclOffValue( mnC3, aIt->mnValue );
|
||||
// if color changes to black or white, it will stay gray if luminance changes again
|
||||
if( (mnC3 == 0) || (mnC3 == MAX_PERCENT) ) mnC2 = 0;
|
||||
break;
|
||||
case XML_lum:
|
||||
toHsl();
|
||||
lclSetValue( mnC3, aIt->mnValue );
|
||||
// if color changes to black or white, it will stay gray if luminance changes again
|
||||
if( (mnC3 == 0) || (mnC3 == MAX_PERCENT) ) mnC2 = 0;
|
||||
break;
|
||||
case XML_lumMod:
|
||||
toHsl();
|
||||
lclModValue( mnC3, aIt->mnValue );
|
||||
// if color changes to black or white, it will stay gray if luminance changes again
|
||||
if( (mnC3 == 0) || (mnC3 == MAX_PERCENT) ) mnC2 = 0;
|
||||
break;
|
||||
case XML_lumOff:
|
||||
toHsl();
|
||||
lclOffValue( mnC3, aIt->mnValue );
|
||||
// if color changes to black or white, it will stay gray if luminance changes again
|
||||
if( (mnC3 == 0) || (mnC3 == MAX_PERCENT) ) mnC2 = 0;
|
||||
break;
|
||||
|
||||
case XML_shade:
|
||||
// shade: 0% = black, 100% = original color
|
||||
toCrgb();
|
||||
OSL_ENSURE( (0 <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT), "Color::getColor - invalid shade value" );
|
||||
if( (0 <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT) )
|
||||
{
|
||||
double fFactor = static_cast< double >( aIt->mnValue ) / MAX_PERCENT;
|
||||
mnC1 = static_cast< sal_Int32 >( mnC1 * fFactor );
|
||||
mnC2 = static_cast< sal_Int32 >( mnC2 * fFactor );
|
||||
mnC3 = static_cast< sal_Int32 >( mnC3 * fFactor );
|
||||
}
|
||||
break;
|
||||
case XML_tint:
|
||||
// tint: 0% = white, 100% = original color
|
||||
toCrgb();
|
||||
OSL_ENSURE( (0 <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT), "Color::getColor - invalid tint value" );
|
||||
if( (0 <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT) )
|
||||
{
|
||||
double fFactor = static_cast< double >( aIt->mnValue ) / MAX_PERCENT;
|
||||
mnC1 = static_cast< sal_Int32 >( MAX_PERCENT - (MAX_PERCENT - mnC1) * fFactor );
|
||||
mnC2 = static_cast< sal_Int32 >( MAX_PERCENT - (MAX_PERCENT - mnC2) * fFactor );
|
||||
mnC3 = static_cast< sal_Int32 >( MAX_PERCENT - (MAX_PERCENT - mnC3) * fFactor );
|
||||
}
|
||||
break;
|
||||
case XLS_TOKEN( tint ):
|
||||
// Excel tint: move luminance relative to current value
|
||||
toHsl();
|
||||
OSL_ENSURE( (-MAX_PERCENT <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT), "Color::getColor - invalid tint value" );
|
||||
if( (-MAX_PERCENT <= aIt->mnValue) && (aIt->mnValue < 0) )
|
||||
{
|
||||
// negative: luminance towards 0% (black)
|
||||
lclModValue( mnC3, aIt->mnValue + MAX_PERCENT );
|
||||
}
|
||||
else if( (0 < aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT) )
|
||||
{
|
||||
// positive: luminance towards 100% (white)
|
||||
case XML_shade:
|
||||
// shade: 0% = black, 100% = original color
|
||||
toCrgb();
|
||||
OSL_ENSURE( (0 <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT), "Color::getColor - invalid shade value" );
|
||||
if( (0 <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT) )
|
||||
{
|
||||
double fFactor = static_cast< double >( aIt->mnValue ) / MAX_PERCENT;
|
||||
mnC1 = static_cast< sal_Int32 >( mnC1 * fFactor );
|
||||
mnC2 = static_cast< sal_Int32 >( mnC2 * fFactor );
|
||||
mnC3 = static_cast< sal_Int32 >( mnC3 * fFactor );
|
||||
}
|
||||
break;
|
||||
case XML_tint:
|
||||
// tint: 0% = white, 100% = original color
|
||||
toCrgb();
|
||||
OSL_ENSURE( (0 <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT), "Color::getColor - invalid tint value" );
|
||||
if( (0 <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT) )
|
||||
{
|
||||
double fFactor = static_cast< double >( aIt->mnValue ) / MAX_PERCENT;
|
||||
mnC1 = static_cast< sal_Int32 >( MAX_PERCENT - (MAX_PERCENT - mnC1) * fFactor );
|
||||
mnC2 = static_cast< sal_Int32 >( MAX_PERCENT - (MAX_PERCENT - mnC2) * fFactor );
|
||||
mnC3 = static_cast< sal_Int32 >( MAX_PERCENT - (MAX_PERCENT - mnC3) * fFactor );
|
||||
}
|
||||
break;
|
||||
case XLS_TOKEN( tint ):
|
||||
// Excel tint: move luminance relative to current value
|
||||
toHsl();
|
||||
OSL_ENSURE( (-MAX_PERCENT <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT), "Color::getColor - invalid tint value" );
|
||||
if( (-MAX_PERCENT <= aIt->mnValue) && (aIt->mnValue < 0) )
|
||||
{
|
||||
// negative: luminance towards 0% (black)
|
||||
lclModValue( mnC3, aIt->mnValue + MAX_PERCENT );
|
||||
}
|
||||
else if( (0 < aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT) )
|
||||
{
|
||||
// positive: luminance towards 100% (white)
|
||||
mnC3 = MAX_PERCENT - mnC3;
|
||||
lclModValue( mnC3, MAX_PERCENT - aIt->mnValue );
|
||||
mnC3 = MAX_PERCENT - mnC3;
|
||||
}
|
||||
break;
|
||||
|
||||
case XML_gray:
|
||||
// change color to gray, weighted RGB: 22% red, 72% green, 6% blue
|
||||
toRgb();
|
||||
mnC1 = mnC2 = mnC3 = (mnC1 * 22 + mnC2 * 72 + mnC3 * 6) / 100;
|
||||
break;
|
||||
|
||||
case XML_comp:
|
||||
// comp: rotate hue by 180 degrees, do not change lum/sat
|
||||
toHsl();
|
||||
(mnC1 += 180 * PER_DEGREE) %= MAX_DEGREE;
|
||||
break;
|
||||
case XML_inv:
|
||||
// invert percentual RGB values
|
||||
toCrgb();
|
||||
mnC1 = MAX_PERCENT - mnC1;
|
||||
mnC2 = MAX_PERCENT - mnC2;
|
||||
mnC3 = MAX_PERCENT - mnC3;
|
||||
lclModValue( mnC3, MAX_PERCENT - aIt->mnValue );
|
||||
mnC3 = MAX_PERCENT - mnC3;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case XML_gray:
|
||||
// change color to gray, weighted RGB: 22% red, 72% green, 6% blue
|
||||
toRgb();
|
||||
mnC1 = mnC2 = mnC3 = (mnC1 * 22 + mnC2 * 72 + mnC3 * 6) / 100;
|
||||
break;
|
||||
|
||||
case XML_comp:
|
||||
// comp: rotate hue by 180 degrees, do not change lum/sat
|
||||
toHsl();
|
||||
(mnC1 += 180 * PER_DEGREE) %= MAX_DEGREE;
|
||||
break;
|
||||
case XML_inv:
|
||||
// invert percentual RGB values
|
||||
toCrgb();
|
||||
mnC1 = MAX_PERCENT - mnC1;
|
||||
mnC2 = MAX_PERCENT - mnC2;
|
||||
mnC3 = MAX_PERCENT - mnC3;
|
||||
break;
|
||||
|
||||
case XML_gamma:
|
||||
// increase gamma of color
|
||||
toCrgb();
|
||||
mnC1 = lclGamma( mnC1, INC_GAMMA );
|
||||
mnC2 = lclGamma( mnC2, INC_GAMMA );
|
||||
mnC3 = lclGamma( mnC3, INC_GAMMA );
|
||||
break;
|
||||
case XML_invGamma:
|
||||
// decrease gamma of color
|
||||
toCrgb();
|
||||
mnC1 = lclGamma( mnC1, DEC_GAMMA );
|
||||
mnC2 = lclGamma( mnC2, DEC_GAMMA );
|
||||
mnC3 = lclGamma( mnC3, DEC_GAMMA );
|
||||
break;
|
||||
case XML_gamma:
|
||||
// increase gamma of color
|
||||
toCrgb();
|
||||
mnC1 = lclGamma( mnC1, INC_GAMMA );
|
||||
mnC2 = lclGamma( mnC2, INC_GAMMA );
|
||||
mnC3 = lclGamma( mnC3, INC_GAMMA );
|
||||
break;
|
||||
case XML_invGamma:
|
||||
// decrease gamma of color
|
||||
toCrgb();
|
||||
mnC1 = lclGamma( mnC1, DEC_GAMMA );
|
||||
mnC2 = lclGamma( mnC2, DEC_GAMMA );
|
||||
mnC3 = lclGamma( mnC3, DEC_GAMMA );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// store resulting RGB value in mnC1
|
||||
toRgb();
|
||||
mnC1 = lclRgbComponentsToRgb( mnC1, mnC2, mnC3 );
|
||||
}
|
||||
else // if( meMode != COLOR_UNUSED )
|
||||
{
|
||||
mnC1 = API_RGB_TRANSPARENT;
|
||||
}
|
||||
|
||||
toRgb();
|
||||
meMode = bIsPh ? COLOR_PH : COLOR_FINAL;
|
||||
if( meMode == COLOR_FINAL )
|
||||
maTransforms.clear();
|
||||
return mnC1 = lclRgbComponentsToRgb( mnC1, mnC2, mnC3 );
|
||||
return mnC1;
|
||||
}
|
||||
|
||||
bool Color::hasTransparence() const
|
||||
|
@ -523,6 +527,12 @@ sal_Int16 Color::getTransparence() const
|
|||
|
||||
// private --------------------------------------------------------------------
|
||||
|
||||
void Color::setResolvedRgb( sal_Int32 nRgb ) const
|
||||
{
|
||||
meMode = (nRgb < 0) ? COLOR_UNUSED : COLOR_RGB;
|
||||
lclRgbToRgbComponents( mnC1, mnC2, mnC3, nRgb );
|
||||
}
|
||||
|
||||
void Color::toRgb() const
|
||||
{
|
||||
switch( meMode )
|
||||
|
|
|
@ -63,7 +63,7 @@ void CustomShapeProperties::apply( const CustomShapePropertiesPtr& /* rSourceCus
|
|||
// not sure if this needs to be implemented
|
||||
}
|
||||
|
||||
void CustomShapeProperties::pushToPropSet( const ::oox::core::XmlFilterBase& /* rFilterBase */,
|
||||
void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFilterBase */,
|
||||
const Reference < XPropertySet >& xPropSet, const Reference < XShape > & xShape ) const
|
||||
{
|
||||
if ( maShapePresetType.getLength() )
|
||||
|
|
|
@ -44,7 +44,8 @@
|
|||
#include "oox/helper/modelobjecthelper.hxx"
|
||||
#include "oox/helper/propertymap.hxx"
|
||||
#include "oox/helper/propertyset.hxx"
|
||||
#include "oox/core/xmlfilterbase.hxx"
|
||||
#include "oox/core/filterbase.hxx"
|
||||
#include "oox/drawingml/drawingmltypes.hxx"
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::drawing;
|
||||
|
@ -55,7 +56,8 @@ using ::com::sun::star::uno::Reference;
|
|||
using ::com::sun::star::uno::Exception;
|
||||
using ::com::sun::star::uno::UNO_QUERY;
|
||||
using ::com::sun::star::uno::UNO_QUERY_THROW;
|
||||
using ::oox::core::XmlFilterBase;
|
||||
using ::com::sun::star::geometry::IntegerRectangle2D;
|
||||
using ::oox::core::FilterBase;
|
||||
|
||||
namespace oox {
|
||||
namespace drawingml {
|
||||
|
@ -106,7 +108,7 @@ RectanglePoint lclGetRectanglePoint( sal_Int32 nToken )
|
|||
return RectanglePoint_LEFT_TOP;
|
||||
}
|
||||
|
||||
const awt::Size lclGetOriginalSize( const XmlFilterBase& rFilter, const Reference< XGraphic >& rxGraphic )
|
||||
const awt::Size lclGetOriginalSize( const FilterBase& rFilter, const Reference< XGraphic >& rxGraphic )
|
||||
{
|
||||
awt::Size aSize100thMM( 0, 0 );
|
||||
try
|
||||
|
@ -222,8 +224,8 @@ Color FillProperties::getBestSolidColor() const
|
|||
return aSolidColor;
|
||||
}
|
||||
|
||||
void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyIds& rPropIds,
|
||||
const XmlFilterBase& rFilter, ModelObjectHelper& rModelObjHelper,
|
||||
void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilter,
|
||||
ModelObjectHelper& rModelObjHelper, const FillPropertyIds& rPropIds,
|
||||
sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const
|
||||
{
|
||||
if( moFillType.has() )
|
||||
|
@ -254,7 +256,8 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyIds
|
|||
aGradient.StartIntensity = 100;
|
||||
aGradient.EndIntensity = 100;
|
||||
|
||||
if( maGradientProps.maGradientStops.size() > 1 )
|
||||
size_t nColorCount = maGradientProps.maGradientStops.size();
|
||||
if( nColorCount > 1 )
|
||||
{
|
||||
aGradient.StartColor = maGradientProps.maGradientStops.begin()->second.getColor( rFilter, nPhClr );
|
||||
aGradient.EndColor = maGradientProps.maGradientStops.rbegin()->second.getColor( rFilter, nPhClr );
|
||||
|
@ -264,19 +267,36 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyIds
|
|||
if ( !maGradientProps.moRotateWithShape.get( false ) )
|
||||
nShapeRotation = 0;
|
||||
|
||||
sal_Int32 nDmlAngle = 0;
|
||||
if( maGradientProps.moGradientPath.has() )
|
||||
{
|
||||
aGradient.Style = (maGradientProps.moGradientPath.get() == XML_circle) ? awt::GradientStyle_ELLIPTICAL : awt::GradientStyle_RECT;
|
||||
aGradient.Angle = static_cast< sal_Int16 >( (900 - (nShapeRotation / 6000)) % 3600 );
|
||||
aGradient.XOffset = maGradientProps.moFillToRect.has() ? getLimitedValue< sal_Int16, sal_Int32 >( maGradientProps.moFillToRect.get().X1 / 1000, 30, 70 ) : 50;
|
||||
aGradient.YOffset = maGradientProps.moFillToRect.has() ? getLimitedValue< sal_Int16, sal_Int32 >( maGradientProps.moFillToRect.get().Y1 / 1000, 30, 70 ) : 50;
|
||||
// position of gradient center (limited to [30%;70%], otherwise gradient is too hidden)
|
||||
IntegerRectangle2D aFillToRect = maGradientProps.moFillToRect.get( IntegerRectangle2D( 0, 0, MAX_PERCENT, MAX_PERCENT ) );
|
||||
sal_Int32 nCenterX = (MAX_PERCENT + aFillToRect.X1 - aFillToRect.X2) / 2;
|
||||
aGradient.XOffset = getLimitedValue< sal_Int16, sal_Int32 >( nCenterX / PER_PERCENT, 30, 70 );
|
||||
sal_Int32 nCenterY = (MAX_PERCENT + aFillToRect.Y1 - aFillToRect.Y2) / 2;
|
||||
aGradient.YOffset = getLimitedValue< sal_Int16, sal_Int32 >( nCenterY / PER_PERCENT, 30, 70 );
|
||||
::std::swap( aGradient.StartColor, aGradient.EndColor );
|
||||
nDmlAngle = nShapeRotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
aGradient.Style = awt::GradientStyle_LINEAR;
|
||||
aGradient.Angle = static_cast< sal_Int16 >( (4500 - ((maGradientProps.moShadeAngle.get( 0 ) - nShapeRotation) / 6000)) % 3600 );
|
||||
/* Try to detect a VML axial gradient. This type of
|
||||
gradient is simulated by a 3-point linear gradient
|
||||
with equal start and end color. */
|
||||
bool bAxial = (nColorCount == 3) && (aGradient.StartColor == aGradient.EndColor);
|
||||
aGradient.Style = bAxial ? awt::GradientStyle_AXIAL : awt::GradientStyle_LINEAR;
|
||||
if( bAxial )
|
||||
{
|
||||
GradientFillProperties::GradientStopMap::const_iterator aIt = maGradientProps.maGradientStops.begin();
|
||||
// API StartColor is inner color in axial gradient
|
||||
aGradient.StartColor = (++aIt)->second.getColor( rFilter, nPhClr );
|
||||
}
|
||||
nDmlAngle = maGradientProps.moShadeAngle.get( 0 ) - nShapeRotation;
|
||||
}
|
||||
// convert DrawingML angle (in 1/60000 degrees) to API angle (in 1/10 degrees)
|
||||
aGradient.Angle = static_cast< sal_Int16 >( (4500 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 );
|
||||
|
||||
// push gradient or named gradient to property map
|
||||
if( rPropIds.mbNamedFillGradient )
|
||||
|
@ -340,10 +360,10 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyIds
|
|||
if( (aOriginalSize.Width > 0) && (aOriginalSize.Height > 0) )
|
||||
{
|
||||
// size of one bitmap tile (given as 1/1000 percent of bitmap size), convert to 1/100 mm
|
||||
double fScaleX = maBlipProps.moTileScaleX.get( 100000 ) / 100000.0;
|
||||
double fScaleX = maBlipProps.moTileScaleX.get( MAX_PERCENT ) / static_cast< double >( MAX_PERCENT );
|
||||
sal_Int32 nFillBmpSizeX = getLimitedValue< sal_Int32, double >( aOriginalSize.Width * fScaleX, 1, SAL_MAX_INT32 );
|
||||
rPropMap.setProperty( rPropIds[ FillBitmapSizeXId ], nFillBmpSizeX );
|
||||
double fScaleY = maBlipProps.moTileScaleY.get( 100000 ) / 100000.0;
|
||||
double fScaleY = maBlipProps.moTileScaleY.get( MAX_PERCENT ) / static_cast< double >( MAX_PERCENT );
|
||||
sal_Int32 nFillBmpSizeY = getLimitedValue< sal_Int32, double >( aOriginalSize.Height * fScaleY, 1, SAL_MAX_INT32 );
|
||||
rPropMap.setProperty( rPropIds[ FillBitmapSizeYId ], nFillBmpSizeY );
|
||||
|
||||
|
@ -383,12 +403,12 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyIds
|
|||
}
|
||||
}
|
||||
|
||||
void FillProperties::pushToPropSet( PropertySet& rPropSet, const FillPropertyIds& rPropIds,
|
||||
const XmlFilterBase& rFilter, ModelObjectHelper& rModelObjHelper,
|
||||
void FillProperties::pushToPropSet( PropertySet& rPropSet, const FilterBase& rFilter,
|
||||
ModelObjectHelper& rModelObjHelper, const FillPropertyIds& rPropIds,
|
||||
sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const
|
||||
{
|
||||
PropertyMap aPropMap;
|
||||
pushToPropMap( aPropMap, rPropIds, rFilter, rModelObjHelper, nShapeRotation, nPhClr );
|
||||
pushToPropMap( aPropMap, rFilter, rModelObjHelper, rPropIds, nShapeRotation, nPhClr );
|
||||
rPropSet.setProperties( aPropMap );
|
||||
}
|
||||
|
||||
|
@ -399,7 +419,7 @@ void GraphicProperties::assignUsed( const GraphicProperties& rSourceProps )
|
|||
maBlipProps.assignUsed( rSourceProps.maBlipProps );
|
||||
}
|
||||
|
||||
void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFilterBase& rFilter, sal_Int32 nPhClr ) const
|
||||
void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilter, sal_Int32 nPhClr ) const
|
||||
{
|
||||
if( maBlipProps.mxGraphic.is() )
|
||||
{
|
||||
|
@ -436,15 +456,15 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFilterBas
|
|||
rPropMap[ PROP_GraphicColorMode ] <<= eColorMode;
|
||||
|
||||
// brightness and contrast
|
||||
sal_Int16 nBrightness = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moBrightness.get( 0 ) / 1000, -100, 100 );
|
||||
sal_Int16 nBrightness = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moBrightness.get( 0 ) / PER_PERCENT, -100, 100 );
|
||||
if( nBrightness != 0 )
|
||||
rPropMap[ PROP_AdjustLuminance ] <<= nBrightness;
|
||||
sal_Int16 nContrast = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moContrast.get( 0 ) / 1000, -100, 100 );
|
||||
sal_Int16 nContrast = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moContrast.get( 0 ) / PER_PERCENT, -100, 100 );
|
||||
if( nContrast != 0 )
|
||||
rPropMap[ PROP_AdjustContrast ] <<= nContrast;
|
||||
}
|
||||
|
||||
void GraphicProperties::pushToPropSet( PropertySet& rPropSet, const XmlFilterBase& rFilter, sal_Int32 nPhClr ) const
|
||||
void GraphicProperties::pushToPropSet( PropertySet& rPropSet, const FilterBase& rFilter, sal_Int32 nPhClr ) const
|
||||
{
|
||||
PropertyMap aPropMap;
|
||||
pushToPropMap( aPropMap, rFilter, nPhClr );
|
||||
|
|
|
@ -271,15 +271,14 @@ Reference< XFastContextHandler > FillPropertiesContext::createFastChildContext(
|
|||
ContextHandler& rParent, sal_Int32 nElement,
|
||||
const Reference< XFastAttributeList >& rxAttribs, FillProperties& rFillProps )
|
||||
{
|
||||
rFillProps.moFillType = getToken( nElement );
|
||||
switch( nElement )
|
||||
{
|
||||
case A_TOKEN( noFill ): return 0;
|
||||
case A_TOKEN( solidFill ): return new SolidFillContext( rParent, rxAttribs, rFillProps );
|
||||
case A_TOKEN( gradFill ): return new GradientFillContext( rParent, rxAttribs, rFillProps.maGradientProps );
|
||||
case A_TOKEN( pattFill ): return new PatternFillContext( rParent, rxAttribs, rFillProps.maPatternProps );
|
||||
case A_TOKEN( blipFill ): return new BlipFillContext( rParent, rxAttribs, rFillProps.maBlipProps );
|
||||
case A_TOKEN( grpFill ): return 0; // TODO
|
||||
case A_TOKEN( noFill ): { rFillProps.moFillType = getToken( nElement ); return 0; };
|
||||
case A_TOKEN( solidFill ): { rFillProps.moFillType = getToken( nElement ); return new SolidFillContext( rParent, rxAttribs, rFillProps ); };
|
||||
case A_TOKEN( gradFill ): { rFillProps.moFillType = getToken( nElement ); return new GradientFillContext( rParent, rxAttribs, rFillProps.maGradientProps ); };
|
||||
case A_TOKEN( pattFill ): { rFillProps.moFillType = getToken( nElement ); return new PatternFillContext( rParent, rxAttribs, rFillProps.maPatternProps ); };
|
||||
case A_TOKEN( blipFill ): { rFillProps.moFillType = getToken( nElement ); return new BlipFillContext( rParent, rxAttribs, rFillProps.maBlipProps ); };
|
||||
case A_TOKEN( grpFill ): { rFillProps.moFillType = getToken( nElement ); return 0; }; // TODO
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
#include "oox/helper/modelobjecthelper.hxx"
|
||||
#include "oox/helper/propertymap.hxx"
|
||||
#include "oox/helper/propertyset.hxx"
|
||||
#include "oox/core/filterbase.hxx"
|
||||
#include "oox/core/namespaces.hxx"
|
||||
#include "oox/core/xmlfilterbase.hxx"
|
||||
#include "oox/drawingml/drawingmltypes.hxx"
|
||||
|
||||
using namespace ::com::sun::star::drawing;
|
||||
|
@ -55,7 +55,7 @@ using ::com::sun::star::uno::Any;
|
|||
using ::com::sun::star::uno::Reference;
|
||||
using ::com::sun::star::awt::Point;
|
||||
using ::com::sun::star::container::XNameContainer;
|
||||
using ::oox::core::XmlFilterBase;
|
||||
using ::oox::core::FilterBase;
|
||||
|
||||
namespace oox {
|
||||
namespace drawingml {
|
||||
|
@ -82,6 +82,85 @@ static const sal_Int32 spnDefaultLineIds[ LineId_END ] =
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void lclSetDashData( LineDash& orLineDash, sal_Int16 nDots, sal_Int32 nDotLen,
|
||||
sal_Int16 nDashes, sal_Int32 nDashLen, sal_Int32 nDistance )
|
||||
{
|
||||
orLineDash.Dots = nDots;
|
||||
orLineDash.DotLen = nDotLen;
|
||||
orLineDash.Dashes = nDashes;
|
||||
orLineDash.DashLen = nDashLen;
|
||||
orLineDash.Distance = nDistance;
|
||||
}
|
||||
|
||||
/** Converts the specified preset dash to API dash.
|
||||
|
||||
Line length and dot length are set relative to line width and have to be
|
||||
multiplied by the actual line width after this function.
|
||||
*/
|
||||
void lclConvertPresetDash( LineDash& orLineDash, sal_Int32 nPresetDash )
|
||||
{
|
||||
switch( nPresetDash )
|
||||
{
|
||||
case XML_dot: lclSetDashData( orLineDash, 1, 1, 0, 0, 3 ); break;
|
||||
case XML_dash: lclSetDashData( orLineDash, 0, 0, 1, 4, 3 ); break;
|
||||
case XML_dashDot: lclSetDashData( orLineDash, 1, 1, 1, 4, 3 ); break;
|
||||
|
||||
case XML_lgDash: lclSetDashData( orLineDash, 0, 0, 1, 8, 3 ); break;
|
||||
case XML_lgDashDot: lclSetDashData( orLineDash, 1, 1, 1, 8, 3 ); break;
|
||||
case XML_lgDashDotDot: lclSetDashData( orLineDash, 2, 1, 1, 8, 3 ); break;
|
||||
|
||||
case XML_sysDot: lclSetDashData( orLineDash, 1, 1, 0, 0, 1 ); break;
|
||||
case XML_sysDash: lclSetDashData( orLineDash, 0, 0, 1, 3, 1 ); break;
|
||||
case XML_sysDashDot: lclSetDashData( orLineDash, 1, 1, 1, 3, 1 ); break;
|
||||
case XML_sysDashDotDot: lclSetDashData( orLineDash, 2, 1, 1, 3, 1 ); break;
|
||||
|
||||
default:
|
||||
OSL_ENSURE( false, "lclConvertPresetDash - unsupported preset dash" );
|
||||
lclSetDashData( orLineDash, 0, 0, 1, 4, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
/** Converts the passed custom dash to API dash.
|
||||
|
||||
Line length and dot length are set relative to line width and have to be
|
||||
multiplied by the actual line width after this function.
|
||||
*/
|
||||
void lclConvertCustomDash( LineDash& orLineDash, const LineProperties::DashStopVector& rCustomDash )
|
||||
{
|
||||
if( rCustomDash.empty() )
|
||||
{
|
||||
OSL_ENSURE( false, "lclConvertCustomDash - unexpected empty custom dash" );
|
||||
lclSetDashData( orLineDash, 0, 0, 1, 4, 3 );
|
||||
return;
|
||||
}
|
||||
|
||||
// count dashes and dots (stops equal or less than 2 are assumed to be dots)
|
||||
sal_Int16 nDots = 0;
|
||||
sal_Int32 nDotLen = 0;
|
||||
sal_Int16 nDashes = 0;
|
||||
sal_Int32 nDashLen = 0;
|
||||
sal_Int32 nDistance = 0;
|
||||
for( LineProperties::DashStopVector::const_iterator aIt = rCustomDash.begin(), aEnd = rCustomDash.end(); aIt != aEnd; ++aIt )
|
||||
{
|
||||
if( aIt->first <= 2 )
|
||||
{
|
||||
++nDots;
|
||||
nDotLen += aIt->first;
|
||||
}
|
||||
else
|
||||
{
|
||||
++nDashes;
|
||||
nDashLen += aIt->first;
|
||||
}
|
||||
nDistance += aIt->second;
|
||||
}
|
||||
orLineDash.DotLen = (nDots > 0) ? ::std::max< sal_Int32 >( nDotLen / nDots, 1 ) : 0;
|
||||
orLineDash.Dots = nDots;
|
||||
orLineDash.DashLen = (nDashes > 0) ? ::std::max< sal_Int32 >( nDashLen / nDashes, 1 ) : 0;
|
||||
orLineDash.Dashes = nDashes;
|
||||
orLineDash.Distance = ::std::max< sal_Int32 >( nDistance / rCustomDash.size(), 1 );
|
||||
}
|
||||
|
||||
DashStyle lclGetDashStyle( sal_Int32 nToken )
|
||||
{
|
||||
switch( nToken )
|
||||
|
@ -122,7 +201,7 @@ sal_Int32 lclGetArrowSize( sal_Int32 nToken )
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties& rArrowProps,
|
||||
const LinePropertyIds& rPropIds, ModelObjectHelper& rModelObjHelper, sal_Int32 nLineWidth, bool bLineEnd )
|
||||
ModelObjectHelper& rModelObjHelper, const LinePropertyIds& rPropIds, sal_Int32 nLineWidth, bool bLineEnd )
|
||||
{
|
||||
PolyPolygonBezierCoords aMarker;
|
||||
OUString aMarkerName;
|
||||
|
@ -310,14 +389,17 @@ void LineProperties::assignUsed( const LineProperties& rSourceProps )
|
|||
maStartArrow.assignUsed( rSourceProps.maStartArrow );
|
||||
maEndArrow.assignUsed( rSourceProps.maEndArrow );
|
||||
maLineFill.assignUsed( rSourceProps.maLineFill );
|
||||
if( !rSourceProps.maCustomDash.empty() )
|
||||
maCustomDash = rSourceProps.maCustomDash;
|
||||
moLineWidth.assignIfUsed( rSourceProps.moLineWidth );
|
||||
moPresetDash.assignIfUsed( rSourceProps.moPresetDash );
|
||||
moLineCompound.assignIfUsed( rSourceProps.moLineCompound );
|
||||
moLineCap.assignIfUsed( rSourceProps.moLineCap );
|
||||
moLineJoint.assignIfUsed( rSourceProps.moLineJoint );
|
||||
}
|
||||
|
||||
void LineProperties::pushToPropMap( PropertyMap& rPropMap, const LinePropertyIds& rPropIds,
|
||||
const XmlFilterBase& rFilter, ModelObjectHelper& rModelObjHelper, sal_Int32 nPhClr ) const
|
||||
void LineProperties::pushToPropMap( PropertyMap& rPropMap, const FilterBase& rFilter,
|
||||
ModelObjectHelper& rModelObjHelper, const LinePropertyIds& rPropIds, sal_Int32 nPhClr ) const
|
||||
{
|
||||
// line fill type must exist, otherwise ignore other properties
|
||||
if( maLineFill.moFillType.has() )
|
||||
|
@ -326,51 +408,22 @@ void LineProperties::pushToPropMap( PropertyMap& rPropMap, const LinePropertyIds
|
|||
LineStyle eLineStyle = (maLineFill.moFillType.get() == XML_noFill) ? LineStyle_NONE : LineStyle_SOLID;
|
||||
|
||||
// create line dash from preset dash token (not for invisible line)
|
||||
if( (eLineStyle != LineStyle_NONE) && moPresetDash.differsFrom( XML_solid ) )
|
||||
if( (eLineStyle != LineStyle_NONE) && (moPresetDash.differsFrom( XML_solid ) || (!moPresetDash && !maCustomDash.empty())) )
|
||||
{
|
||||
LineDash aLineDash;
|
||||
|
||||
sal_Int32 nLineWidth = GetCoordinate( moLineWidth.get( 103500 ) );
|
||||
aLineDash.Style = lclGetDashStyle( moLineCap.get( XML_rnd ) );
|
||||
aLineDash.Dots = 1;
|
||||
aLineDash.DotLen = nLineWidth;
|
||||
aLineDash.Dashes = 0;
|
||||
aLineDash.DashLen = 8 * nLineWidth;
|
||||
aLineDash.Distance = 3 * nLineWidth;
|
||||
|
||||
switch( moPresetDash.get() )
|
||||
{
|
||||
default:
|
||||
case XML_dash:
|
||||
case XML_sysDash:
|
||||
aLineDash.DashLen = 4 * nLineWidth;
|
||||
// passthrough intended
|
||||
case XML_lgDash:
|
||||
aLineDash.Dots = 0;
|
||||
aLineDash.Dashes = 1;
|
||||
break;
|
||||
// convert preset dash or custom dash
|
||||
if( moPresetDash.has() )
|
||||
lclConvertPresetDash( aLineDash, moPresetDash.get() );
|
||||
else
|
||||
lclConvertCustomDash( aLineDash, maCustomDash );
|
||||
|
||||
case XML_dashDot:
|
||||
case XML_sysDashDot:
|
||||
aLineDash.DashLen = 4 * nLineWidth;
|
||||
// passthrough intended
|
||||
case XML_lgDashDot:
|
||||
aLineDash.Dashes = 1;
|
||||
break;
|
||||
|
||||
case XML_sysDashDotDot:
|
||||
aLineDash.DashLen = 4 * nLineWidth;
|
||||
// passthrough intended
|
||||
case XML_lgDashDotDot:
|
||||
aLineDash.Dots = 2;
|
||||
aLineDash.Dashes = 1;
|
||||
break;
|
||||
|
||||
case XML_dot:
|
||||
case XML_sysDot:
|
||||
aLineDash.Distance = aLineDash.DotLen;
|
||||
break;
|
||||
}
|
||||
// convert relative dash/dot length to absolute length
|
||||
sal_Int32 nLineWidth = GetCoordinate( moLineWidth.get( 103500 ) );
|
||||
aLineDash.DotLen *= nLineWidth;
|
||||
aLineDash.DashLen *= nLineWidth;
|
||||
aLineDash.Distance *= nLineWidth;
|
||||
|
||||
if( rPropIds.mbNamedLineDash )
|
||||
{
|
||||
|
@ -409,16 +462,16 @@ void LineProperties::pushToPropMap( PropertyMap& rPropMap, const LinePropertyIds
|
|||
}
|
||||
|
||||
// line markers
|
||||
lclPushMarkerProperties( rPropMap, maStartArrow, rPropIds, rModelObjHelper, moLineWidth.get( 0 ), false );
|
||||
lclPushMarkerProperties( rPropMap, maEndArrow, rPropIds, rModelObjHelper, moLineWidth.get( 0 ), true );
|
||||
lclPushMarkerProperties( rPropMap, maStartArrow, rModelObjHelper, rPropIds, moLineWidth.get( 0 ), false );
|
||||
lclPushMarkerProperties( rPropMap, maEndArrow, rModelObjHelper, rPropIds, moLineWidth.get( 0 ), true );
|
||||
}
|
||||
}
|
||||
|
||||
void LineProperties::pushToPropSet( PropertySet& rPropSet, const LinePropertyIds& rPropIds,
|
||||
const XmlFilterBase& rFilter, ModelObjectHelper& rModelObjHelper, sal_Int32 nPhClr ) const
|
||||
void LineProperties::pushToPropSet( PropertySet& rPropSet, const FilterBase& rFilter,
|
||||
ModelObjectHelper& rModelObjHelper, const LinePropertyIds& rPropIds, sal_Int32 nPhClr ) const
|
||||
{
|
||||
PropertyMap aPropMap;
|
||||
pushToPropMap( aPropMap, rPropIds, rFilter, rModelObjHelper, nPhClr );
|
||||
pushToPropMap( aPropMap, rFilter, rModelObjHelper, rPropIds, nPhClr );
|
||||
rPropSet.setProperties( aPropMap );
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ LinePropertiesContext::LinePropertiesContext( ContextHandler& rParent, const Ref
|
|||
{
|
||||
AttributeList aAttribs( xAttribs );
|
||||
mrLineProperties.moLineWidth = aAttribs.getInteger( XML_w );
|
||||
mrLineProperties.moLineCompound = aAttribs.getToken( XML_cmpd );
|
||||
mrLineProperties.moLineCap = aAttribs.getToken( XML_cap );
|
||||
}
|
||||
|
||||
|
@ -79,6 +80,11 @@ Reference< XFastContextHandler > LinePropertiesContext::createFastChildContext(
|
|||
mrLineProperties.moPresetDash = aAttribs.getToken( XML_val );
|
||||
break;
|
||||
case A_TOKEN( custDash ): // CT_DashStopList
|
||||
xRet = this;
|
||||
break;
|
||||
case A_TOKEN( ds ):
|
||||
mrLineProperties.maCustomDash.push_back( LineProperties::DashStop(
|
||||
aAttribs.getInteger( XML_d, 0 ), aAttribs.getInteger( XML_sp, 0 ) ) );
|
||||
break;
|
||||
|
||||
// LineJoinPropertiesGroup
|
||||
|
|
|
@ -423,11 +423,11 @@ Reference< XShape > Shape::createAndInsert(
|
|||
// applying properties
|
||||
PropertySet aPropSet( xSet );
|
||||
if ( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) )
|
||||
mpGraphicPropertiesPtr->pushToPropSet( aPropSet, rFilterBase, -1 );
|
||||
mpGraphicPropertiesPtr->pushToPropSet( aPropSet, rFilterBase );
|
||||
if ( mpTablePropertiesPtr.get() && ( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.TableShape" ) ) )
|
||||
mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle );
|
||||
aFillProperties.pushToPropSet( aPropSet, FillProperties::DEFAULT_IDS, rFilterBase, rFilterBase.getModelObjectHelper(), mnRotation, nFillPhClr );
|
||||
aLineProperties.pushToPropSet( aPropSet, LineProperties::DEFAULT_IDS, rFilterBase, rFilterBase.getModelObjectHelper(), nLinePhClr );
|
||||
aFillProperties.pushToPropSet( aPropSet, rFilterBase, rFilterBase.getModelObjectHelper(), FillProperties::DEFAULT_IDS, mnRotation, nFillPhClr );
|
||||
aLineProperties.pushToPropSet( aPropSet, rFilterBase, rFilterBase.getModelObjectHelper(), LineProperties::DEFAULT_IDS, nLinePhClr );
|
||||
|
||||
// applying autogrowheight property before setting shape size, because
|
||||
// the shape size might be changed if currently autogrowheight is true
|
||||
|
|
|
@ -363,8 +363,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
|
|||
aFillProperties.assignUsed( maFillProperties );
|
||||
PropertySet aPropSet( xPropSet );
|
||||
// TODO: phClr?
|
||||
aFillProperties.pushToPropSet( aPropSet, FillProperties::DEFAULT_IDS,
|
||||
rFilterBase, rFilterBase.getModelObjectHelper(), 0, -1 );
|
||||
aFillProperties.pushToPropSet( aPropSet, rFilterBase, rFilterBase.getModelObjectHelper() );
|
||||
}
|
||||
|
||||
} } }
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <com/sun/star/awt/FontWeight.hpp>
|
||||
#include "oox/helper/helper.hxx"
|
||||
#include "oox/helper/propertyset.hxx"
|
||||
#include "oox/core/xmlfilterbase.hxx"
|
||||
#include "oox/drawingml/drawingmltypes.hxx"
|
||||
#include "properties.hxx"
|
||||
#include "tokens.hxx"
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "oox/helper/helper.hxx"
|
||||
#include "oox/helper/propertyset.hxx"
|
||||
#include "oox/core/namespaces.hxx"
|
||||
#include "oox/core/xmlfilterbase.hxx"
|
||||
#include "oox/drawingml/drawingmltypes.hxx"
|
||||
#include "properties.hxx"
|
||||
#include "tokens.hxx"
|
||||
|
|
|
@ -50,6 +50,7 @@ using ::com::sun::star::uno::Reference;
|
|||
using ::com::sun::star::util::DateTime;
|
||||
using ::com::sun::star::lang::XMultiServiceFactory;
|
||||
using ::com::sun::star::io::XInputStream;
|
||||
using ::comphelper::MediaDescriptor;
|
||||
using ::oox::core::FilterBase;
|
||||
|
||||
using namespace ::oox::xls;
|
||||
|
@ -326,14 +327,6 @@ bool BiffObjectBase::implStartRecord( BinaryInputStream&, sal_Int64& ornRecPos,
|
|||
ornRecPos = mxBiffStrm->tellBase() - 4;
|
||||
ornRecId = mxBiffStrm->getRecId();
|
||||
|
||||
// record specific settings
|
||||
switch( mxBiffStrm->getRecId() )
|
||||
{
|
||||
case BIFF_ID_CHEND:
|
||||
out().decIndent();
|
||||
break;
|
||||
}
|
||||
|
||||
// special CONTINUE handling
|
||||
mxBiffStrm->resetRecord( mbMergeContRec );
|
||||
if( mbMergeContRec ) switch( mxBiffStrm->getRecId() )
|
||||
|
@ -350,6 +343,21 @@ bool BiffObjectBase::implStartRecord( BinaryInputStream&, sal_Int64& ornRecPos,
|
|||
break;
|
||||
}
|
||||
|
||||
// record specific settings
|
||||
switch( mxBiffStrm->getRecId() )
|
||||
{
|
||||
case BIFF2_ID_BOF:
|
||||
case BIFF3_ID_BOF:
|
||||
case BIFF4_ID_BOF:
|
||||
case BIFF5_ID_BOF:
|
||||
case BIFF_ID_INTERFACEHDR:
|
||||
mxBiffStrm->enableDecoder( false );
|
||||
break;
|
||||
case BIFF_ID_CHEND:
|
||||
out().decIndent();
|
||||
break;
|
||||
}
|
||||
|
||||
ornRecSize = mxBiffStrm->getLength();
|
||||
return bValid;
|
||||
}
|
||||
|
@ -677,12 +685,12 @@ sal_uInt16 BiffObjectBase::dumpRepeatedRecId()
|
|||
|
||||
void BiffObjectBase::dumpFrHeader( bool bWithFlags, bool bWithRange )
|
||||
{
|
||||
dumpHex< sal_uInt16 >( "rec-id", getRecNames() );
|
||||
sal_Int16 nFlags = bWithFlags ? dumpHex< sal_uInt16 >( "flags", "FR-FLAGS" ) : 0x0001;
|
||||
dumpHex< sal_uInt16 >( "fr-rec-id", getRecNames() );
|
||||
sal_Int16 nFlags = bWithFlags ? dumpHex< sal_uInt16 >( "fr-flags", "FR-FLAGS" ) : 0x0001;
|
||||
if( bWithRange )
|
||||
{
|
||||
if( getFlag< sal_uInt16 >( nFlags, 0x0001 ) )
|
||||
dumpRange( "range" );
|
||||
dumpRange( "fr-range" );
|
||||
else
|
||||
dumpUnused( 8 );
|
||||
}
|
||||
|
@ -1329,6 +1337,7 @@ bool FormulaObject::dumpAttrToken()
|
|||
dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "skip-err" );
|
||||
}
|
||||
break;
|
||||
case 0: // in array formulas and defined names, the skip-bit may be 0
|
||||
case BIFF_TOK_ATTR_SKIP:
|
||||
dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "skip" );
|
||||
break;
|
||||
|
@ -2183,6 +2192,52 @@ void WorkbookStreamObject::implDumpRecordBody()
|
|||
}
|
||||
break;
|
||||
|
||||
case BIFF_ID_FILEPASS:
|
||||
{
|
||||
rStrm.enableDecoder( false );
|
||||
if( eBiff == BIFF8 )
|
||||
{
|
||||
switch( dumpDec< sal_uInt16 >( "type", "FILEPASS-TYPE" ) )
|
||||
{
|
||||
case 0:
|
||||
dumpHex< sal_uInt16 >( "key" );
|
||||
dumpHex< sal_uInt16 >( "verifier" );
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
sal_uInt16 nMajor = dumpDec< sal_uInt16 >( "major-version", "FILEPASS-MAJOR" );
|
||||
dumpDec< sal_uInt16 >( "minor-version" );
|
||||
switch( nMajor )
|
||||
{
|
||||
case 1:
|
||||
dumpArray( "salt", 16 );
|
||||
dumpArray( "verifier", 16 );
|
||||
dumpArray( "verifier-hash", 16 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dumpHex< sal_uInt16 >( "key" );
|
||||
dumpHex< sal_uInt16 >( "verifier" );
|
||||
}
|
||||
rStrm.seekToStart();
|
||||
BiffDecoderRef xDecoder = BiffCodecHelper::implReadFilePass( rStrm, eBiff );
|
||||
if( xDecoder.get() )
|
||||
cfg().requestPassword( *xDecoder );
|
||||
setBinaryOnlyMode( !xDecoder || !xDecoder->isValid() );
|
||||
}
|
||||
break;
|
||||
|
||||
case BIFF_ID_FILESHARING:
|
||||
dumpBool< sal_uInt16 >( "recommend-read-only" );
|
||||
dumpHex< sal_uInt16 >( "password-hash" );
|
||||
dumpString( "password-creator", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
|
||||
break;
|
||||
|
||||
case BIFF2_ID_FONT:
|
||||
case BIFF3_ID_FONT:
|
||||
dumpFontRec();
|
||||
|
@ -2602,9 +2657,14 @@ void WorkbookStreamObject::implDumpRecordBody()
|
|||
break;
|
||||
|
||||
case BIFF_ID_SHEET:
|
||||
if( eBiff >= BIFF5 ) dumpHex< sal_uInt32 >( "sheet-stream-pos", "CONV-DEC" );
|
||||
if( eBiff >= BIFF5 ) dumpDec< sal_uInt8 >( "sheet-state", "SHEET-STATE" );
|
||||
if( eBiff >= BIFF5 ) dumpDec< sal_uInt8 >( "sheet-type", "SHEET-TYPE" );
|
||||
if( eBiff >= BIFF5 )
|
||||
{
|
||||
rStrm.enableDecoder( false );
|
||||
dumpHex< sal_uInt32 >( "sheet-stream-pos", "CONV-DEC" );
|
||||
rStrm.enableDecoder( true );
|
||||
dumpDec< sal_uInt8 >( "sheet-state", "SHEET-STATE" );
|
||||
dumpDec< sal_uInt8 >( "sheet-type", "SHEET-TYPE" );
|
||||
}
|
||||
dumpString( "sheet-name", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH );
|
||||
break;
|
||||
|
||||
|
@ -2638,14 +2698,23 @@ void WorkbookStreamObject::implDumpRecordBody()
|
|||
sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "STYLE-FLAGS" );
|
||||
if( getFlag( nFlags, BIFF_STYLE_BUILTIN ) )
|
||||
{
|
||||
dumpDec< sal_uInt8 >( "builtin-idx", "STYLE-BUILTIN" );
|
||||
dumpDec< sal_uInt8 >( "outline-level" );
|
||||
dumpDec< sal_Int8 >( "builtin-idx", "STYLE-BUILTIN" );
|
||||
dumpDec< sal_Int8 >( "outline-level" );
|
||||
}
|
||||
else
|
||||
dumpString( "style-name", BIFF_STR_8BITLENGTH );
|
||||
}
|
||||
break;
|
||||
|
||||
case BIFF_ID_STYLEEXT:
|
||||
dumpFrHeader( true, true );
|
||||
dumpHex< sal_uInt8 >( "flags", "STYLEEXT-FLAGS" );
|
||||
dumpDec< sal_uInt8 >( "category", "STYLEEXT-CATEGORY" );
|
||||
dumpDec< sal_Int8 >( "builtin-idx", "STYLEEXT-BUILTIN" );
|
||||
dumpDec< sal_Int8 >( "outline-level" );
|
||||
dumpUnicodeArray( "style-name", rStrm.readuInt16() );
|
||||
break;
|
||||
|
||||
case BIFF_ID_SXEXT:
|
||||
if( eBiff == BIFF8 )
|
||||
{
|
||||
|
@ -3682,7 +3751,8 @@ Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Refere
|
|||
if( rxFactory.is() && rxInStrm.is() )
|
||||
{
|
||||
StorageRef xStrg( new OleStorage( rxFactory, rxInStrm, true ) );
|
||||
ConfigRef xCfg( new Config( DUMP_BIFF_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName ) );
|
||||
MediaDescriptor aMediaDesc;
|
||||
ConfigRef xCfg( new Config( DUMP_BIFF_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName, aMediaDesc ) );
|
||||
DumperBase::construct( xCfg );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,6 +207,7 @@ combilist=NLRADDFLAGS
|
|||
end
|
||||
|
||||
flagslist=ATTRTYPES
|
||||
0x00=skip
|
||||
0x01=volatile
|
||||
0x02=if
|
||||
0x04=choose
|
||||
|
@ -346,6 +347,7 @@ multilist=RECORD-NAMES-BIFF8
|
|||
0x0858=CHPIVOTREF,,,,,,,
|
||||
0x0860=,,SHEETLAYOUT,,,,,SHEETPROTECTION
|
||||
0x0868=,,,CHFRLABELPROPS,,,,
|
||||
0x0890=,,STYLEEXT,,,,,
|
||||
# chart records
|
||||
0x1058=,,,,,,,CH3DDATAFORMAT
|
||||
0x1060=CHFONTBASE,CHPIEEXT,CHLABELRANGE2,CHDATATABLE,CHPLOTGROWTH,CHSERINDEX,CHESCHERFORMAT,CHPIEEXTSETT
|
||||
|
@ -1093,6 +1095,11 @@ constlist=EXTERNSHEET-IDX-BIFF8
|
|||
-2=special
|
||||
end
|
||||
|
||||
# FILEPASS -------------------------------------------------------------------
|
||||
|
||||
shortlist=FILEPASS-TYPE,0,xor,rc4
|
||||
shortlist=FILEPASS-MAJOR,1,rc4,crypto-api-2003,crypto-api-2007
|
||||
|
||||
# FONT -----------------------------------------------------------------------
|
||||
|
||||
flagslist=FONT-FLAGS
|
||||
|
@ -1648,7 +1655,26 @@ combilist=STYLE-FLAGS
|
|||
0x8000=builtin
|
||||
end
|
||||
|
||||
shortlist=STYLE-BUILTIN,0,normal,rowlevel,collevel,comma,currency,percent,comma-0,currency-0,hyperlink,followed-hyperlink
|
||||
shortlist=STYLE-BUILTIN,-1,user-defined,normal,rowlevel,collevel,comma,currency,percent,comma-0,currency-0,hyperlink,followed-hyperlink
|
||||
|
||||
# STYLEEXT -------------------------------------------------------------------
|
||||
|
||||
flagslist=STYLEEXT-FLAGS
|
||||
0x01=builtin
|
||||
0x02=hidden
|
||||
0x04=custom
|
||||
end
|
||||
|
||||
shortlist=STYLEEXT-CATEGORY,0,custom,good-bad-neutral,data-model,title-heading,themed,number-format
|
||||
|
||||
multilist=STYLEEXT-BUILTIN
|
||||
include=STYLE-BUILTIN
|
||||
10=note,warning-text,,,,title,heading-1,heading-2,heading-3,heading-4
|
||||
20=input,output,calculation,check-cell,linked-cell,total,good,bad,neutral,accent1
|
||||
30=20%-accent1,40%-accent1,60%-accent1,accent2,20%-accent2,40%-accent2,60%-accent2,accent3,20%-accent3,40%-accent3
|
||||
40=60%-accent3,accent4,20%-accent4,40%-accent4,60%-accent4,accent5,20%-accent5,40%-accent5,60%-accent5,accent6
|
||||
50=20%-accent6,40%-accent6,60%-accent6,explanatory-text
|
||||
end
|
||||
|
||||
# SXEXT ----------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <com/sun/star/io/XTextOutputStream.hpp>
|
||||
#include <rtl/math.hxx>
|
||||
#include <osl/file.hxx>
|
||||
#include <comphelper/docpasswordhelper.hxx>
|
||||
#include "oox/helper/binaryoutputstream.hxx"
|
||||
#include "oox/core/filterbase.hxx"
|
||||
#include "oox/xls/biffhelper.hxx"
|
||||
|
@ -51,8 +52,8 @@ using ::rtl::OStringToOUString;
|
|||
using ::rtl::OUString;
|
||||
using ::rtl::OUStringBuffer;
|
||||
using ::rtl::OUStringToOString;
|
||||
using ::com::sun::star::uno::Reference;
|
||||
using ::com::sun::star::uno::Exception;
|
||||
using ::com::sun::star::uno::Reference;
|
||||
using ::com::sun::star::uno::UNO_QUERY_THROW;
|
||||
using ::com::sun::star::util::DateTime;
|
||||
using ::com::sun::star::lang::XMultiServiceFactory;
|
||||
|
@ -60,9 +61,10 @@ using ::com::sun::star::ucb::XSimpleFileAccess;
|
|||
using ::com::sun::star::io::XActiveDataSink;
|
||||
using ::com::sun::star::io::XActiveDataSource;
|
||||
using ::com::sun::star::io::XInputStream;
|
||||
using ::com::sun::star::io::XTextInputStream;
|
||||
using ::com::sun::star::io::XOutputStream;
|
||||
using ::com::sun::star::io::XTextInputStream;
|
||||
using ::com::sun::star::io::XTextOutputStream;
|
||||
using ::comphelper::MediaDescriptor;
|
||||
using ::oox::core::FilterBase;
|
||||
|
||||
namespace oox {
|
||||
|
@ -1465,11 +1467,14 @@ NameListRef NameListWrapper::getNameList( const Config& rCfg ) const
|
|||
// ============================================================================
|
||||
|
||||
SharedConfigData::SharedConfigData( const OUString& rFileName,
|
||||
const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName ) :
|
||||
const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg,
|
||||
const OUString& rSysFileName, MediaDescriptor& rMediaDesc ) :
|
||||
mxFactory( rxFactory ),
|
||||
mxRootStrg( rxRootStrg ),
|
||||
maSysFileName( rSysFileName ),
|
||||
mbLoaded( false )
|
||||
mrMediaDesc( rMediaDesc ),
|
||||
mbLoaded( false ),
|
||||
mbPwCancelled( false )
|
||||
{
|
||||
OUString aFileUrl = InputOutputHelper::convertFileNameToUrl( rFileName );
|
||||
if( aFileUrl.getLength() > 0 )
|
||||
|
@ -1515,6 +1520,20 @@ NameListRef SharedConfigData::getNameList( const OUString& rListName ) const
|
|||
return xList;
|
||||
}
|
||||
|
||||
OUString SharedConfigData::requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier )
|
||||
{
|
||||
OUString aPassword;
|
||||
if( !mbPwCancelled )
|
||||
{
|
||||
::std::vector< OUString > aDefaultPasswords;
|
||||
aDefaultPasswords.push_back( CREATE_OUSTRING( "VelvetSweatshop" ) );
|
||||
aPassword = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
|
||||
rVerifier, mrMediaDesc, ::comphelper::DocPasswordRequestType_MS, &aDefaultPasswords );
|
||||
mbPwCancelled = aPassword.getLength() == 0;
|
||||
}
|
||||
return aPassword;
|
||||
}
|
||||
|
||||
bool SharedConfigData::implIsValid() const
|
||||
{
|
||||
return mbLoaded && mxFactory.is() && mxRootStrg.get() && (maSysFileName.getLength() > 0);
|
||||
|
@ -1614,9 +1633,9 @@ Config::Config( const sal_Char* pcEnvVar, const FilterBase& rFilter )
|
|||
construct( pcEnvVar, rFilter );
|
||||
}
|
||||
|
||||
Config::Config( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName )
|
||||
Config::Config( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc )
|
||||
{
|
||||
construct( pcEnvVar, rxFactory, rxRootStrg, rSysFileName );
|
||||
construct( pcEnvVar, rxFactory, rxRootStrg, rSysFileName, rMediaDesc );
|
||||
}
|
||||
|
||||
Config::~Config()
|
||||
|
@ -1631,14 +1650,14 @@ void Config::construct( const Config& rParent )
|
|||
void Config::construct( const sal_Char* pcEnvVar, const FilterBase& rFilter )
|
||||
{
|
||||
if( rFilter.getFileUrl().getLength() > 0 )
|
||||
construct( pcEnvVar, rFilter.getGlobalFactory(), rFilter.getStorage(), rFilter.getFileUrl() );
|
||||
construct( pcEnvVar, rFilter.getGlobalFactory(), rFilter.getStorage(), rFilter.getFileUrl(), rFilter.getMediaDescriptor() );
|
||||
}
|
||||
|
||||
void Config::construct( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName )
|
||||
void Config::construct( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc )
|
||||
{
|
||||
if( pcEnvVar && rxRootStrg.get() && (rSysFileName.getLength() > 0) )
|
||||
if( const sal_Char* pcFileName = ::getenv( pcEnvVar ) )
|
||||
mxCfgData.reset( new SharedConfigData( OUString::createFromAscii( pcFileName ), rxFactory, rxRootStrg, rSysFileName ) );
|
||||
mxCfgData.reset( new SharedConfigData( OUString::createFromAscii( pcFileName ), rxFactory, rxRootStrg, rSysFileName, rMediaDesc ) );
|
||||
}
|
||||
|
||||
void Config::setStringOption( const String& rKey, const String& rData )
|
||||
|
@ -1683,6 +1702,16 @@ NameListRef Config::getNameList( const String& rListName ) const
|
|||
return implGetNameList( rListName );
|
||||
}
|
||||
|
||||
OUString Config::requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier )
|
||||
{
|
||||
return mxCfgData->requestPassword( rVerifier );
|
||||
}
|
||||
|
||||
bool Config::isPasswordCancelled() const
|
||||
{
|
||||
return mxCfgData->isPasswordCancelled();
|
||||
}
|
||||
|
||||
bool Config::implIsValid() const
|
||||
{
|
||||
return isValid( mxCfgData );
|
||||
|
@ -3050,7 +3079,7 @@ void RecordObjectBase::implDump()
|
|||
sal_Int64 nRecPos = in().tell();
|
||||
|
||||
// record body
|
||||
if( cfg().hasName( xRecNames, mnRecId ) )
|
||||
if( !mbBinaryOnly && cfg().hasName( xRecNames, mnRecId ) )
|
||||
{
|
||||
ItemFormatMap::const_iterator aIt = aSimpleRecs.find( mnRecId );
|
||||
if( aIt != aSimpleRecs.end() )
|
||||
|
@ -3081,6 +3110,7 @@ void RecordObjectBase::constructRecObjBase( const BinaryInputStreamRef& rxBaseSt
|
|||
maRecNames = rRecNames;
|
||||
maSimpleRecs = rSimpleRecs;
|
||||
mnRecPos = mnRecId = mnRecSize = 0;
|
||||
mbBinaryOnly = false;
|
||||
if( InputObjectBase::implIsValid() )
|
||||
mbShowRecPos = cfg().getBoolOption( "show-record-position", true );
|
||||
}
|
||||
|
@ -3166,6 +3196,11 @@ bool DumperBase::isImportEnabled() const
|
|||
return !isValid() || cfg().isImportEnabled();
|
||||
}
|
||||
|
||||
bool DumperBase::isImportCancelled() const
|
||||
{
|
||||
return isValid() && cfg().isPasswordCancelled();
|
||||
}
|
||||
|
||||
void DumperBase::construct( const ConfigRef& rxConfig )
|
||||
{
|
||||
if( isValid( rxConfig ) && rxConfig->isDumperEnabled() )
|
||||
|
|
|
@ -41,6 +41,7 @@ using ::rtl::OUString;
|
|||
using ::com::sun::star::uno::Reference;
|
||||
using ::com::sun::star::lang::XMultiServiceFactory;
|
||||
using ::com::sun::star::io::XInputStream;
|
||||
using ::comphelper::MediaDescriptor;
|
||||
using ::oox::core::FilterBase;
|
||||
|
||||
namespace oox {
|
||||
|
@ -127,7 +128,8 @@ Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Refere
|
|||
if( rxFactory.is() && rxInStrm.is() )
|
||||
{
|
||||
StorageRef xStrg( new ZipStorage( rxFactory, rxInStrm ) );
|
||||
ConfigRef xCfg( new Config( DUMP_PPTX_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName ) );
|
||||
MediaDescriptor aMediaDesc;
|
||||
ConfigRef xCfg( new Config( DUMP_PPTX_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName, aMediaDesc ) );
|
||||
DumperBase::construct( xCfg );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ using ::com::sun::star::uno::Reference;
|
|||
using ::com::sun::star::util::DateTime;
|
||||
using ::com::sun::star::lang::XMultiServiceFactory;
|
||||
using ::com::sun::star::io::XInputStream;
|
||||
using ::comphelper::MediaDescriptor;
|
||||
using ::oox::core::FilterBase;
|
||||
|
||||
using namespace ::oox::xls;
|
||||
|
@ -1492,6 +1493,12 @@ void RecordStreamObject::implDumpRecordBody()
|
|||
dumpString( "#sheet-name" );
|
||||
break;
|
||||
|
||||
case OOBIN_ID_FILESHARING:
|
||||
dumpBool< sal_uInt16 >( "recommend-read-only" );
|
||||
dumpHex< sal_uInt16 >( "password-hash" );
|
||||
dumpString( "password-creator" );
|
||||
break;
|
||||
|
||||
case OOBIN_ID_FILL:
|
||||
dumpDec< sal_Int32 >( "fill-pattern", "FILLPATTERNS" );
|
||||
dumpColor( "fg-color" );
|
||||
|
@ -2267,7 +2274,8 @@ Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Refere
|
|||
if( rxFactory.is() && rxInStrm.is() )
|
||||
{
|
||||
StorageRef xStrg( new ZipStorage( rxFactory, rxInStrm ) );
|
||||
ConfigRef xCfg( new Config( DUMP_XLSB_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName ) );
|
||||
MediaDescriptor aMediaDesc;
|
||||
ConfigRef xCfg( new Config( DUMP_XLSB_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName, aMediaDesc ) );
|
||||
DumperBase::construct( xCfg );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <com/sun/star/beans/XPropertySetInfo.hpp>
|
||||
#include "properties.hxx"
|
||||
#include "oox/token/propertylist.hxx"
|
||||
|
||||
using ::rtl::OUString;
|
||||
using ::com::sun::star::uno::Any;
|
||||
|
@ -59,7 +60,7 @@ namespace oox {
|
|||
namespace {
|
||||
|
||||
/** Thread-save singleton of a vector of all supported property names. */
|
||||
struct PropertyNamesPool : public ::rtl::Static< PropertyNamesList, PropertyNamesPool > {};
|
||||
struct StaticPropertyList : public ::rtl::Static< PropertyList, StaticPropertyList > {};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
@ -103,7 +104,7 @@ GenericPropertySet::GenericPropertySet()
|
|||
|
||||
GenericPropertySet::GenericPropertySet( const PropertyMap& rPropMap )
|
||||
{
|
||||
const PropertyNamesList& rPropNames = PropertyNamesPool::get();
|
||||
const PropertyList& rPropNames = StaticPropertyList::get();
|
||||
for( PropertyMap::const_iterator aIt = rPropMap.begin(), aEnd = rPropMap.end(); aIt != aEnd; ++aIt )
|
||||
maPropMap[ rPropNames[ aIt->first ] ] = aIt->second;
|
||||
}
|
||||
|
@ -170,10 +171,19 @@ sal_Bool SAL_CALL GenericPropertySet::hasPropertyByName( const OUString& rProper
|
|||
|
||||
// ============================================================================
|
||||
|
||||
const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId )
|
||||
PropertyMap::PropertyMap() :
|
||||
mpPropNames( &StaticPropertyList::get() )
|
||||
{
|
||||
}
|
||||
|
||||
PropertyMap::~PropertyMap()
|
||||
{
|
||||
}
|
||||
|
||||
/*static*/ const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId )
|
||||
{
|
||||
OSL_ENSURE( (0 <= nPropId) && (nPropId < PROP_COUNT), "PropertyMap::getPropertyName - invalid property identifier" );
|
||||
return PropertyNamesPool::get()[ nPropId ];
|
||||
return StaticPropertyList::get()[ nPropId ];
|
||||
}
|
||||
|
||||
const Any* PropertyMap::getProperty( sal_Int32 nPropId ) const
|
||||
|
@ -187,12 +197,11 @@ Sequence< PropertyValue > PropertyMap::makePropertyValueSequence() const
|
|||
Sequence< PropertyValue > aSeq( static_cast< sal_Int32 >( size() ) );
|
||||
if( !empty() )
|
||||
{
|
||||
const PropertyNamesList& rPropNames = PropertyNamesPool::get();
|
||||
PropertyValue* pValues = aSeq.getArray();
|
||||
for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt, ++pValues )
|
||||
{
|
||||
OSL_ENSURE( (0 <= aIt->first) && (aIt->first < PROP_COUNT), "PropertyMap::makePropertyValueSequence - invalid property identifier" );
|
||||
pValues->Name = rPropNames[ aIt->first ];
|
||||
pValues->Name = (*mpPropNames)[ aIt->first ];
|
||||
pValues->Value = aIt->second;
|
||||
pValues->State = ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
|
||||
}
|
||||
|
@ -206,13 +215,12 @@ void PropertyMap::fillSequences( Sequence< OUString >& rNames, Sequence< Any >&
|
|||
rValues.realloc( static_cast< sal_Int32 >( size() ) );
|
||||
if( !empty() )
|
||||
{
|
||||
const PropertyNamesList& rPropNames = PropertyNamesPool::get();
|
||||
OUString* pNames = rNames.getArray();
|
||||
Any* pValues = rValues.getArray();
|
||||
for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt, ++pNames, ++pValues )
|
||||
{
|
||||
OSL_ENSURE( (0 <= aIt->first) && (aIt->first < PROP_COUNT), "PropertyMap::fillSequences - invalid property identifier" );
|
||||
*pNames = rPropNames[ aIt->first ];
|
||||
*pNames = (*mpPropNames)[ aIt->first ];
|
||||
*pValues = aIt->second;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,12 +117,12 @@ sal_Int32 AxControlHelper::convertColor( sal_uInt32 nAxColor ) const
|
|||
switch( meColorMode )
|
||||
{
|
||||
case AX_DEFAULTCOLORMODE_BGR: return lclDecodeBgrColor( nAxColor );
|
||||
case AX_DEFAULTCOLORMODE_PALETTE: return getPaletteColor( static_cast< sal_uInt16 >( nAxColor & AX_PALETTECOLOR_MASK ) );
|
||||
case AX_DEFAULTCOLORMODE_PALETTE: return mrFilter.getPaletteColor( nAxColor & AX_PALETTECOLOR_MASK );
|
||||
}
|
||||
break;
|
||||
|
||||
case AX_COLORTYPE_PALETTE:
|
||||
return getPaletteColor( static_cast< sal_uInt16 >( nAxColor & AX_PALETTECOLOR_MASK ) );
|
||||
return mrFilter.getPaletteColor( nAxColor & AX_PALETTECOLOR_MASK );
|
||||
|
||||
case AX_COLORTYPE_BGR:
|
||||
return lclDecodeBgrColor( nAxColor );
|
||||
|
@ -134,12 +134,6 @@ sal_Int32 AxControlHelper::convertColor( sal_uInt32 nAxColor ) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
sal_Int32 AxControlHelper::getPaletteColor( sal_uInt16 /*nPaletteIdx*/ ) const
|
||||
{
|
||||
OSL_ENSURE( false, "AxControlHelper::getPaletteColor - palette colors not implemented" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
AxEmbeddedControlHelper::AxEmbeddedControlHelper( const FilterBase& rFilter,
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "oox/helper/attributelist.hxx"
|
||||
#include "oox/core/namespaces.hxx"
|
||||
#include "oox/core/fragmenthandler.hxx"
|
||||
#include "oox/core/xmlfilterbase.hxx"
|
||||
#include "oox/drawingml/colorchoicecontext.hxx"
|
||||
#include "pptfilterhelpers.hxx"
|
||||
#include "tokens.hxx"
|
||||
|
|
|
@ -88,12 +88,7 @@ bool PowerPointImport::exportDocument() throw()
|
|||
return false;
|
||||
}
|
||||
|
||||
const ::oox::drawingml::Theme* PowerPointImport::getCurrentTheme() const
|
||||
{
|
||||
return mpActualSlidePersist ? mpActualSlidePersist->getTheme().get() : 0;
|
||||
}
|
||||
|
||||
sal_Int32 PowerPointImport::getSchemeClr( sal_Int32 nColorSchemeToken ) const
|
||||
sal_Int32 PowerPointImport::getSchemeColor( sal_Int32 nToken ) const
|
||||
{
|
||||
sal_Int32 nColor = 0;
|
||||
if ( mpActualSlidePersist )
|
||||
|
@ -101,7 +96,7 @@ sal_Int32 PowerPointImport::getSchemeClr( sal_Int32 nColorSchemeToken ) const
|
|||
sal_Bool bColorMapped = sal_False;
|
||||
oox::drawingml::ClrMapPtr pClrMapPtr( mpActualSlidePersist->getClrMap() );
|
||||
if ( pClrMapPtr )
|
||||
bColorMapped = pClrMapPtr->getColorMap( nColorSchemeToken );
|
||||
bColorMapped = pClrMapPtr->getColorMap( nToken );
|
||||
|
||||
if ( !bColorMapped ) // try masterpage mapping
|
||||
{
|
||||
|
@ -110,18 +105,18 @@ sal_Int32 PowerPointImport::getSchemeClr( sal_Int32 nColorSchemeToken ) const
|
|||
{
|
||||
pClrMapPtr = pMasterPersist->getClrMap();
|
||||
if ( pClrMapPtr )
|
||||
bColorMapped = pClrMapPtr->getColorMap( nColorSchemeToken );
|
||||
bColorMapped = pClrMapPtr->getColorMap( nToken );
|
||||
}
|
||||
}
|
||||
oox::drawingml::ClrSchemePtr pClrSchemePtr( mpActualSlidePersist->getClrScheme() );
|
||||
if ( pClrSchemePtr )
|
||||
pClrSchemePtr->getColor( nColorSchemeToken, nColor );
|
||||
pClrSchemePtr->getColor( nToken, nColor );
|
||||
else
|
||||
{
|
||||
::oox::drawingml::ThemePtr pTheme = mpActualSlidePersist->getTheme();
|
||||
if( pTheme )
|
||||
{
|
||||
pTheme->getClrScheme().getColor( nColorSchemeToken, nColor );
|
||||
pTheme->getClrScheme().getColor( nToken, nColor );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -132,6 +127,11 @@ sal_Int32 PowerPointImport::getSchemeClr( sal_Int32 nColorSchemeToken ) const
|
|||
return nColor;
|
||||
}
|
||||
|
||||
const ::oox::drawingml::Theme* PowerPointImport::getCurrentTheme() const
|
||||
{
|
||||
return mpActualSlidePersist ? mpActualSlidePersist->getTheme().get() : 0;
|
||||
}
|
||||
|
||||
::oox::vml::Drawing* PowerPointImport::getVmlDrawing()
|
||||
{
|
||||
return mpActualSlidePersist ? mpActualSlidePersist->getDrawing() : 0;
|
||||
|
|
|
@ -180,9 +180,7 @@ void SlidePersist::createBackground( const XmlFilterBase& rFilterBase )
|
|||
uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY_THROW );
|
||||
uno::Reference< beans::XPropertySet > xPropertySet( aPropMap.makePropertySet() );
|
||||
PropertySet aPropSet( xPropertySet );
|
||||
mpBackgroundPropertiesPtr->pushToPropSet(
|
||||
aPropSet, ::oox::drawingml::FillProperties::DEFAULT_IDS,
|
||||
rFilterBase, rFilterBase.getModelObjectHelper(), 0, -1 );
|
||||
mpBackgroundPropertiesPtr->pushToPropSet( aPropSet, rFilterBase, rFilterBase.getModelObjectHelper() );
|
||||
xPagePropSet->setPropertyValue( sBackground, Any( xPropertySet ) );
|
||||
}
|
||||
catch( Exception )
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
|
||||
#include "oox/helper/attributelist.hxx"
|
||||
#include "oox/core/namespaces.hxx"
|
||||
#include "oox/core/xmlfilterbase.hxx"
|
||||
#include "oox/drawingml/drawingmltypes.hxx"
|
||||
#include "oox/drawingml/colorchoicecontext.hxx"
|
||||
#include "oox/ppt/slidetransition.hxx"
|
||||
|
|
|
@ -27,17 +27,16 @@
|
|||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
#ifndef OOX_SHAPE_FAST_TOKEN_HANDLER_SERVICE_HXX
|
||||
#define OOX_SHAPE_FAST_TOKEN_HANDLER_SERVICE_HXX
|
||||
|
||||
#include <oox/core/fasttokenhandler.hxx>
|
||||
#ifndef OOX_SHAPE_FASTTOKENHANDLERSERVICE_HXX
|
||||
#define OOX_SHAPE_FASTTOKENHANDLERSERVICE_HXX
|
||||
|
||||
#include "sal/config.h"
|
||||
#include "cppuhelper/factory.hxx"
|
||||
#include "cppuhelper/implementationentry.hxx"
|
||||
#include "cppuhelper/implbase2.hxx"
|
||||
#include "com/sun/star/lang/XServiceInfo.hpp"
|
||||
#include "com/sun/star/xml/sax/XFastTokenHandler.hpp"
|
||||
#include <sal/config.h>
|
||||
#include <cppuhelper/factory.hxx>
|
||||
#include <cppuhelper/implementationentry.hxx>
|
||||
#include <cppuhelper/implbase2.hxx>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include "oox/core/fasttokenhandler.hxx"
|
||||
|
||||
namespace css = ::com::sun::star;
|
||||
|
||||
|
@ -70,7 +69,7 @@ private:
|
|||
virtual ~FastTokenHandlerService() {}
|
||||
|
||||
css::uno::Reference< css::uno::XComponentContext > m_xContext;
|
||||
FastTokenHandler mFastTokenHandler;
|
||||
::oox::core::FastTokenHandler mFastTokenHandler;
|
||||
};
|
||||
|
||||
::rtl::OUString SAL_CALL FastTokenHandlerService_getImplementationName();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue