diff options
author | sb <sb@openoffice.org> | 2010-09-22 15:59:47 +0200 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-09-22 15:59:47 +0200 |
commit | cdfb2f1e99bb6905a76a65896eb1b98a37bf65d9 (patch) | |
tree | 52ca9c1b8728c4e1a173ddb8f1ae46b970abd707 | |
parent | ed31d7faf70a2b5f197cc7e0172244d9139c54cf (diff) | |
parent | bb5c1664ffed54f323c42d9d1d5211ba7b33f119 (diff) |
sb123: merged in DEV300_m88
80 files changed, 3415 insertions, 2820 deletions
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index eec6a09fb215..60647d4f8224 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -1395,6 +1395,7 @@ namespace cairocanvas ::rtl::math::approxEqual( aMatrix.x0, 0 ) && ::rtl::math::approxEqual( aMatrix.y0, 0 ) ) cairo_set_operator( mpCairo.get(), CAIRO_OPERATOR_SOURCE ); + cairo_pattern_set_extend( cairo_get_source(mpCairo.get()), CAIRO_EXTEND_PAD ); cairo_rectangle( mpCairo.get(), 0, 0, aBitmapSize.Width, aBitmapSize.Height ); cairo_clip( mpCairo.get() ); diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index 637b3af3315e..c1e71ceb943f 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -704,6 +704,7 @@ namespace vclcanvas { ::basegfx::B2DRectangle aRect(0.0, 0.0, 1.0, 1.0); ::basegfx::B2DRectangle aTextureDeviceRect; + ::basegfx::B2DHomMatrix aTextureTransform; ::canvas::tools::calcTransformedRectBounds( aTextureDeviceRect, aRect, aTextureTransform ); diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx index dfadecfd5eb7..2109c310b233 100644 --- a/i18npool/source/transliteration/transliterationImpl.cxx +++ b/i18npool/source/transliteration/transliterationImpl.cxx @@ -295,7 +295,6 @@ OUString SAL_CALL TransliterationImpl::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) throw(RuntimeException) { - if (numCascade == 0) return inStr; diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index b58347826470..43222b7a41eb 100755 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -35,6 +35,7 @@ #include <comphelper/processfactory.hxx> #include <osl/diagnose.h> +#include <string.h> #include "characterclassificationImpl.hxx" #include "breakiteratorImpl.hxx" @@ -96,7 +97,7 @@ static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Un nRes = MappingTypeLowerToUpper; else { - OSL_ENSURE( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); + // should also work properly for non-upper characters like white spacs, numbers, ... nRes = MappingTypeUpperToLower; } } @@ -330,185 +331,143 @@ Transliteration_titlecase::Transliteration_titlecase() implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase"; } -rtl::OUString SAL_CALL Transliteration_titlecase::transliterate( - const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& /*offset*/ ) - throw(RuntimeException) +#if 0 +struct LigatureData { - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - CharacterClassificationImpl aCharClassImpl( xMSF ); - - // possible problem: the locale is not exactly specific for each word in the text... - OUString aRes( aCharClassImpl.toTitle( inStr, startPos, nCount, aLocale ) ); - return aRes; + sal_uInt32 cChar; + sal_Char * pUtf8Text; +}; + +// available Unicode ligatures: +// http://www.unicode.org/charts +// http://www.unicode.org/charts/PDF/UFB00.pdf +static LigatureData aLigatures[] = +{ + { 0x0FB00, "ff" }, + { 0x0FB01, "fi" }, + { 0x0FB02, "fl" }, + { 0x0FB03, "ffi" }, + { 0x0FB04, "ffl" }, + { 0x0FB05, "ft" }, + { 0x0FB06, "st" }, + + { 0x0FB13, "\xD5\xB4\xD5\xB6" }, // Armenian small men now + { 0x0FB14, "\xD5\xB4\xD5\xA5" }, // Armenian small men ech + { 0x0FB15, "\xD5\xB4\xD5\xAB" }, // Armenian small men ini + { 0x0FB16, "\xD5\xBE\xD5\xB6" }, // Armenian small vew now + { 0x0FB17, "\xD5\xB4\xD5\xAD" }, // Armenian small men xeh + { 0x00000, "" } +}; + +static inline bool lcl_IsLigature( sal_uInt32 cChar ) +{ + return (0x0FB00 <= cChar && cChar <= 0x0FB06) || (0x0FB13 <= cChar && cChar <= 0x0FB17); } -Transliteration_sentencecase::Transliteration_sentencecase() +static rtl::OUString lcl_ResolveLigature( sal_uInt32 cChar ) { - nMappingType = MappingTypeToTitle; // though only to be applied to the first word... - transliterationName = "sentence(generic)"; - implementationName = "com.sun.star.i18n.Transliteration.Transliteration_sentencecase"; + rtl::OUString aRes; + if (lcl_IsLigature( cChar )) + { + LigatureData *pFound = NULL; + LigatureData *pData = aLigatures; + while (!pFound && pData->cChar != 0) + { + if (pData->cChar == cChar) + pFound = pData; + ++pData; + } + if (pFound) + aRes = rtl::OUString( pFound->pUtf8Text, strlen( pFound->pUtf8Text ), RTL_TEXTENCODING_UTF8 ); + } + else + aRes = rtl::OUString( &cChar, 1 ); + return aRes; } +#endif // if 0 -rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( +static rtl::OUString transliterate_titlecase_Impl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + const Locale &rLocale, Sequence< sal_Int32 >& offset ) throw(RuntimeException) { - // inspired from Transliteration_body::transliterate - sal_Int32 nOffCount = 0, i; - bool bPoint = true; - if (useOffset) - { - for( i = 0; i < nCount; ++i ) { - sal_Unicode c = inStr.getStr()[ i + startPos ]; - if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { - bPoint = true; - nOffCount++; - } - else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) - { - const Mapping* map = 0; - if( bPoint && unicode::isLower( c )) - { - map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); - bPoint = false; - } - else if (!bPoint && unicode::isUpper( c )) - { - map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower); - } - - if(map == 0) - { - nOffCount++; - } - else - { - nOffCount += map->nmap; - } - } - else - { - nOffCount++; - } - } - } - - bPoint = true; - rtl::OUStringBuffer result; + const OUString aText( inStr.copy( startPos, nCount ) ); - if (useOffset) + OUString aRes; + if (aText.getLength() > 0) { - result.ensureCapacity(nOffCount); - if ( nOffCount != offset.getLength() ) - offset.realloc( nOffCount ); - } - - - sal_Int32 j = 0; - sal_Int32 * pArr = offset.getArray(); - for( i = 0; i < nCount; ++i ) { - sal_Unicode c = inStr.getStr()[ i + startPos ]; - if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { - bPoint = true; - result.append(c); - pArr[j++] = i + startPos; - } - else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) - { - const Mapping* map = 0; - if( bPoint && unicode::isLower( c )) - { - map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); - } - else if (!bPoint && unicode::isUpper( c )) - { - map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower); - } - - if(map == 0) - { - result.append( c ); - pArr[j++] = i + startPos; - } - else - { - for (sal_Int32 k = 0; k < map->nmap; k++) - { - result.append( map->map[k] ); - pArr[j++] = i + startPos; - } - } - bPoint = false; - } - else + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + CharacterClassificationImpl aCharClassImpl( xMSF ); + + // because aCharClassImpl.toTitle does not handle ligatures or but will raise + // an exception we need to handle the first chara manually... + + // we don't want to change surrogates by accident, thuse we use proper code point iteration + sal_Int32 nPos = 0; + sal_uInt32 cFirstChar = aText.iterateCodePoints( &nPos ); + OUString aResolvedLigature( &cFirstChar, 1 ); //lcl_ResolveLigature( cFirstChar ) ); + // toUpper can be used to properly resolve ligatures and characters like + aResolvedLigature = aCharClassImpl.toUpper( aResolvedLigature, 0, aResolvedLigature.getLength(), rLocale ); + // since toTitle will leave all-uppercase text unchanged we first need to + // use toLower to bring possible 2nd and following charas in lowercase + aResolvedLigature = aCharClassImpl.toLower( aResolvedLigature, 0, aResolvedLigature.getLength(), rLocale ); + sal_Int32 nResolvedLen = aResolvedLigature.getLength(); + + // now we can properly use toTitle to get the expected result for the resolved string. + // The rest of the text should just become lowercase. + aRes = aCharClassImpl.toTitle( aResolvedLigature, 0, nResolvedLen, rLocale ); + aRes += aCharClassImpl.toLower( aText, 1, aText.getLength() - 1, rLocale ); + offset.realloc( aRes.getLength() ); + + sal_Int32 *pOffset = offset.getArray(); + sal_Int32 nLen = offset.getLength(); + for (sal_Int32 i = 0; i < nLen; ++i) { - result.append( c ); - pArr[j++] = i + startPos; + sal_Int32 nIdx = 0; + if (i >= nResolvedLen) + nIdx = i - nResolvedLen + 1; + pOffset[i] = nIdx; } } - return result.makeStringAndClear(); +#if OSL_DEBUG_LEVEL > 1 + const sal_Int32 *pCOffset = offset.getConstArray(); + (void) pCOffset; +#endif + + return aRes; } -#if 0 -// TL: alternative implemntation try. But breakiterator has its problem too since -// beginOfSentence does not work as expected with '.'. See comment below. -// For the time being I will leave this code here as a from-scratch sample if the -// breakiterator works better at some point... -rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( - const OUString& inStr, sal_Int32 nStartPos, sal_Int32 nCount, - Sequence< sal_Int32 >& /*offset*/ ) + +// this function expects to be called on a word-by-word basis, +// namely that startPos points to the first char of the word +rtl::OUString SAL_CALL Transliteration_titlecase::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset ) throw(RuntimeException) { - OUString aRes( inStr.copy( nStartPos, nCount ) ); + return transliterate_titlecase_Impl( inStr, startPos, nCount, aLocale, offset ); +} - if (nStartPos >= 0 && nStartPos < inStr.getLength() && nCount > 0) - { - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - BreakIteratorImpl brk( xMSF ); - sal_Int32 nSentenceStart = -1, nOldSentenceStart = -1; - sal_Int32 nPos = nStartPos + nCount - 1; - while (nPos >= nStartPos && nPos != -1) - { - // possible problem: the locale is not exactly specific for each sentence in the text, - // but it is the only one we have... - nOldSentenceStart = nSentenceStart; - nSentenceStart = brk.beginOfSentence( inStr, nPos, aLocale ); - - // since the breakiterator completely ignores '.' characvters as end-of-sentence when - // the next word is lower case we need to take care of that ourself. The drawback: - // la mid-sentence abbreviation like e.g. will now be identified as end-of-sentence. :-( - // Well, at least the other product does it in the same way... - sal_Int32 nFullStopPos = inStr.lastIndexOf( (sal_Unicode)'.', nPos ); - nPos = nSentenceStart; - if (nFullStopPos > 0 && nFullStopPos > nSentenceStart) - { - Boundary aBd2 = brk.nextWord( inStr, nFullStopPos, aLocale, WordType::DICTIONARY_WORD ); - nSentenceStart = aBd2.startPos; - nPos = nFullStopPos; - } +Transliteration_sentencecase::Transliteration_sentencecase() +{ + nMappingType = MappingTypeToTitle; // though only to be applied to the first word... + transliterationName = "sentence(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_sentencecase"; +} - if (nSentenceStart < nOldSentenceStart || nOldSentenceStart == -1) - { - // the sentence start might be a quotation mark or some kind of bracket, thus - // we need the first dictionary word starting or following this position - // Boundary aBd1 = brk.nextWord( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD ); - Boundary aBd2 = brk.getWordBoundary( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD, true ); - // OUString aWord1( inStr.copy( aBd1.startPos, aBd1.endPos - aBd1.startPos + 1 ) ); - OUString aWord2( inStr.copy( aBd2.startPos, aBd2.endPos - aBd2.startPos + 1 ) ); - } - else - break; // prevent endless loop - // continue with previous sentence - if (nPos != -1) - --nPos; - } - } - return aRes; +// this function expects to be called on a sentence-by-sentence basis, +// namely that startPos points to the first word (NOT first char!) in the sentence +rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset ) + throw(RuntimeException) +{ + return transliterate_titlecase_Impl( inStr, startPos, nCount, aLocale, offset ); } -#endif + } } } } + diff --git a/l10ntools/java/jpropex/java/JPropEx.java b/l10ntools/java/jpropex/java/JPropEx.java index be59d7f29479..f068f93ad18b 100644 --- a/l10ntools/java/jpropex/java/JPropEx.java +++ b/l10ntools/java/jpropex/java/JPropEx.java @@ -126,8 +126,8 @@ public class JPropEx { key = (String) e.nextElement(); currentStr = (SdfEntity) dolly.clone(); - // Set the new LID and the string text - currentStr.setLid( key ); + // Set the new GID and the string text + currentStr.setGid( key ); value = prop.getProperty( key , "" ); //if( value.equals("") ) System.err.println("Warning: in file "+inputFileArg+" the string with the key "+key+" has a empty string!"); str = (prop.getProperty( key )).replaceAll("\t" , " " ); // remove tab @@ -145,8 +145,11 @@ public class JPropEx //String path = makeAbs( inputFileArg ); path = path.replace( rootArg + "/" , "" ); path = path.replace("/","\\"); - return new SdfEntity( projectArg , path , "" /* dummy1 */ , resourceType , "", "" , "" , "" , "" /* dummy2 */ , - sourceLanguage , "", "" , "" , "" , "2002-02-02 02:02:02" ); + // TODO: Make this static + java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String date = dateformat.format( new Date() ); + return new SdfEntity( projectArg , path , "0" /* dummy1 */ , resourceType , "", "" , "" , "" , "0" /* dummy2 */ , + sourceLanguage , "", "" , "" , "" , date ); } private void merge() @@ -208,7 +211,7 @@ public class JPropEx key = (String) e.nextElement(); sourceString = sourceProp.getProperty( key ); curStr = (SdfEntity) dolly.clone(); - curStr.setLid( key ); + curStr.setGid( key ); for( Enumeration lang = langs.elements(); lang.hasMoreElements(); ) // merge in every language { curEntity = (SdfEntity) curStr.clone(); @@ -218,12 +221,12 @@ public class JPropEx if( mergedEntity == null ) { // in case there is no translation then fallback to the en-US source string - ( (java.util.Properties) props.get( curLang )).setProperty( curEntity.getLid() , sourceString ); + ( (java.util.Properties) props.get( curLang )).setProperty( curEntity.getGid() , sourceString ); } else { // Set the merged text from the sdf file - ( (java.util.Properties) props.get( curLang )).setProperty( mergedEntity.getLid() , mergedEntity.getText() ); // TODO: Quoting ??? + ( (java.util.Properties) props.get( curLang )).setProperty( mergedEntity.getGid() , mergedEntity.getText() ); // TODO: Quoting ??? } } diff --git a/l10ntools/prj/build.lst b/l10ntools/prj/build.lst index 8387154897b3..d8a2e8c00649 100644 --- a/l10ntools/prj/build.lst +++ b/l10ntools/prj/build.lst @@ -1,6 +1,7 @@ -tr l10ntools : tools LIBXSLT:libxslt BERKELEYDB:berkeleydb LUCENE:lucene NULL +tr l10ntools : tools LIBXSLT:libxslt BERKELEYDB:berkeleydb LUCENE:lucene PYTHON:python NULL tr l10ntools usr1 - all tr_mkout NULL tr l10ntools\inc nmake - all tr_inc NULL +tr l10ntools\scripts nmake - all tr_scripts NULL tr l10ntools\source nmake - all tr_src tr_inc NULL tr l10ntools\layout nmake - all rt_layout tr_src tr_inc NULL tr l10ntools\java\jpropex nmake - all tr_blah NULL diff --git a/l10ntools/prj/d.lst b/l10ntools/prj/d.lst index 53c846832fca..9d493e1e9673 100644 --- a/l10ntools/prj/d.lst +++ b/l10ntools/prj/d.lst @@ -47,14 +47,18 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help ..\scripts\localize %_DEST%\bin%_EXT%\localize ..\scripts\fast_merge.pl %_DEST%\bin%_EXT%\fast_merge.pl ..\scripts\keyidGen.pl %_DEST%\bin%_EXT%\keyidGen.pl -..\scripts\tool\const.py %_DEST%\bin%_EXT%\const.py -..\scripts\tool\l10ntool.py %_DEST%\bin%_EXT%\l10ntool.py -..\scripts\tool\xtxex.py %_DEST%\bin%_EXT%\xtxex.py -..\scripts\tool\sdf.py %_DEST%\bin%_EXT%\sdf.py -..\scripts\tool\xhtex.py %_DEST%\bin%_EXT%\xhtex.py -..\scripts\tool\pseudo.py %_DEST%\bin%_EXT%\pseudo.py ..\scripts\xtxex %_DEST%\bin%_EXT%\xtxex ..\scripts\xhtex %_DEST%\bin%_EXT%\xhtex +..\%__SRC%\bin\const.py %_DEST%\bin%_EXT%\const.py +..\%__SRC%\bin\l10ntool.py %_DEST%\bin%_EXT%\l10ntool.py +..\%__SRC%\bin\pseudo.py %_DEST%\bin%_EXT%\pseudo.py +..\%__SRC%\bin\sdf.py %_DEST%\bin%_EXT%\sdf.py +..\%__SRC%\bin\const.pyc %_DEST%\bin%_EXT%\const.pyc +..\%__SRC%\bin\l10ntool.pyc %_DEST%\bin%_EXT%\l10ntool.pyc +..\%__SRC%\bin\pseudo.pyc %_DEST%\bin%_EXT%\pseudo.pyc +..\%__SRC%\bin\sdf.pyc %_DEST%\bin%_EXT%\sdf.pyc +..\%__SRC%\bin\xhtex.py %_DEST%\bin%_EXT%\xhtex.py +..\%__SRC%\bin\xtxex.py %_DEST%\bin%_EXT%\xtxex.py ..\inc\export.hxx %_DEST%\inc%_EXT%\l10ntools\export.hxx ..\inc\l10ntools\directory.hxx %_DEST%\inc%_EXT%\l10ntools\directory.hxx diff --git a/l10ntools/scripts/localize.pl b/l10ntools/scripts/localize.pl index 4b7040d6583d..7a9d8beb6f15 100755 --- a/l10ntools/scripts/localize.pl +++ b/l10ntools/scripts/localize.pl @@ -492,7 +492,7 @@ sub collectfiles{ # -e # if ( -x $command ){ if( $command ){ - if( !$bVerbose ){ $args .= " -QQ "; } + if( !$bVerbose ){ $args .= " "; } $args .= " -e -f $localizeSDF -l "; my $bFlag=""; if( $bAll ) {$args .= " en-US";} diff --git a/l10ntools/scripts/makefile.mk b/l10ntools/scripts/makefile.mk new file mode 100644 index 000000000000..8bfa64e3fbad --- /dev/null +++ b/l10ntools/scripts/makefile.mk @@ -0,0 +1,59 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +# Copy *.py files into output tree and call a script once to +# force python to create the *.pyc files. + +PRJ=.. +TARGET = l10ntools_dummy_pyc + +.INCLUDE: settings.mk + +.IF "$(SYSTEM_PYTHON)"!="YES" +PYTHON=$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) $(SOLARBINDIR)/python +.ELSE # "$(SYSTEM_PYTHON)"!="YES" +PYTHON=$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) python +.ENDIF # "$(SYSTEM_PYTHON)"!="YES" + +PYFILES = $(BIN)$/const.py \ + $(BIN)$/l10ntool.py \ + $(BIN)$/pseudo.py \ + $(BIN)$/sdf.py \ + $(BIN)$/xhtex.py \ + $(BIN)$/xtxex.py + +.INCLUDE: target.mk + +.IGNORE : create_pyc +ALLTAR : create_pyc +create_pyc : $(PYFILES) + @$(PYTHON) $(BIN)/xtxex.py >& /dev/null + +$(BIN)$/%.py : tool/%.py + @$(COPY) $< $@ + + diff --git a/l10ntools/scripts/tool/sdf.py b/l10ntools/scripts/tool/sdf.py index 2afcbaf4bb1f..96afbed1452c 100644 --- a/l10ntools/scripts/tool/sdf.py +++ b/l10ntools/scripts/tool/sdf.py @@ -26,6 +26,7 @@ #************************************************************************* from pseudo import PseudoSet,PseudoOrderedDict +from time import gmtime, strftime class SdfData: _filename = ""; @@ -113,8 +114,8 @@ class SdfEntity: const._TITLE_POS = 13 const._DATE_POS = 14 - def __init__(self, project="", source_file="", dummy1="", resource_type="", gid="", lid="", helpid="", platform="", dummy2="", langid="", - text="", helptext="", quickhelptext="", title="", date="2002-02-02 02:02:02"): + def __init__(self, project="", source_file="", dummy1="0", resource_type="", gid="", lid="", helpid="", platform="", dummy2="0", langid="", + text="", helptext="", quickhelptext="", title="", date=""): self.project = project; self.source_file = source_file; self.dummy1 = dummy1; @@ -129,7 +130,11 @@ class SdfEntity: self.helptext = helptext; self.quickhelptext = quickhelptext; self.title = title; - self.date = date; + if date != "": + self.date = date; + else: + self.date = strftime("%Y-%m-%d %H:%M:%S",gmtime()) + def set_properties(self, line): splitted = line.split("\t") diff --git a/l10ntools/scripts/tool/xhtex.py b/l10ntools/scripts/tool/xhtex.py index c427a7feccdd..ae973aacc555 100644 --- a/l10ntools/scripts/tool/xhtex.py +++ b/l10ntools/scripts/tool/xhtex.py @@ -108,7 +108,7 @@ class Xhtex(AbstractL10nTool): def parse_file(self, filename): document = "" try: - f = open(filename,"r+") + f = open(filename,"r") document = f.read() except IOError: print "ERROR: Can not read file " + filename diff --git a/l10ntools/scripts/tool/xtxex.py b/l10ntools/scripts/tool/xtxex.py index 2c5f132530a6..96912754b7df 100644 --- a/l10ntools/scripts/tool/xtxex.py +++ b/l10ntools/scripts/tool/xtxex.py @@ -39,7 +39,8 @@ class Xtxex(AbstractL10nTool): def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang, is_forced_lang, sdfdata): # Special handling for en-US files if lang == "en-US": - mod_outputfilename = outputfilename.replace("_en-US",'') + mod_outputfilename = outputfilename + # mod here if needed self.copy_file(inputfilename, mod_outputfilename) return # merge usual lang diff --git a/l10ntools/scripts/xhtex b/l10ntools/scripts/xhtex index ca307cf2d4a4..5409f179777d 100755 --- a/l10ntools/scripts/xhtex +++ b/l10ntools/scripts/xhtex @@ -39,8 +39,8 @@ else fi else if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then - exec python -B $SOLARVERSION/$INPATH/bin/xhtex.py "$@" + exec python $SOLARVERSION/$INPATH/bin/xhtex.py "$@" else - exec python -B $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xhtex.py "$@" + exec python $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xhtex.py "$@" fi fi diff --git a/l10ntools/scripts/xtxex b/l10ntools/scripts/xtxex index fb54c1aee36c..39da89fd81ce 100755 --- a/l10ntools/scripts/xtxex +++ b/l10ntools/scripts/xtxex @@ -39,9 +39,9 @@ else fi else if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then - exec python -B $SOLARVERSION/$INPATH/bin/xtxex.py "$@" + exec python $SOLARVERSION/$INPATH/bin/xtxex.py "$@" else - exec python -B $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xtxex.py "$@" + exec python $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xtxex.py "$@" fi fi diff --git a/l10ntools/source/help/HelpIndexerTool.java b/l10ntools/source/help/HelpIndexerTool.java index 2a49f964d48f..a39b5399e38d 100644 --- a/l10ntools/source/help/HelpIndexerTool.java +++ b/l10ntools/source/help/HelpIndexerTool.java @@ -72,6 +72,9 @@ public class HelpIndexerTool String aSegmentName = ""; // Scan arguments + //If this tool is invoked in the build process for extensions help, + //then -extension must be set. + boolean bExtension = false; boolean bLang = false; boolean bMod = false; boolean bZipDir = false; @@ -83,7 +86,11 @@ public class HelpIndexerTool int nArgCount = args.length; for( int i = 0 ; i < nArgCount ; i++ ) { - if( "-lang".equals(args[i]) ) + if( "-extension".equals(args[i]) ) + { + bExtension = true; + } + else if( "-lang".equals(args[i]) ) { if( i + 1 < nArgCount ) { @@ -142,20 +149,21 @@ public class HelpIndexerTool bSegmentName = true; } i++; - if (!(bCfsName && bSegmentName)) - { - System.out.println("Usage: HelpIndexer -checkcfsandsegname _0 _3 (2 arguments needed)"); - System.exit( -1 ); - } + if (!(bCfsName && bSegmentName)) + { + System.out.println("Usage: HelpIndexer -checkcfsandsegname _0 _3 (2 arguments needed)"); + System.exit( -1 ); + } } } - if( !bLang || !bMod || !bZipDir || (!bOutput && !bExtensionMode) ) + if( !bLang || !bMod || !bZipDir || (!bOutput && !bExtensionMode && !bExtension) ) { if( bExtensionMode ) return; System.out.println("Usage: HelpIndexer -lang ISOLangCode -mod HelpModule -zipdir TempZipDir -o OutputZipFile"); + System.out.println("Usage: HelpIndexer -extension -lang ISOLangCode -mod HelpModule -zipdir PathToLangDir"); System.exit( -1 ); } @@ -199,7 +207,7 @@ public class HelpIndexerTool System.out.println( "Checking segment file " + aSegmentName+ ": " + (bSegmentFileOk ? "Found" : "Not found") ); } - if( bExtensionMode ) + if( bExtensionMode || bExtension) { if( !bSrcDir ) { diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx index 94139f89de1e..411859bfe994 100644 --- a/l10ntools/source/help/HelpLinker.cxx +++ b/l10ntools/source/help/HelpLinker.cxx @@ -269,6 +269,8 @@ private: fs::path idxContentStylesheet; fs::path zipdir; fs::path outputFile; + std::string extsource; + std::string extdestination; std::string module; std::string lang; std::string hid; @@ -762,18 +764,9 @@ void HelpLinker::main( std::vector<std::string> &args, const rtl::OUString* pOfficeHelpPath ) throw( HelpProcessingException ) { - rtl::OUString aOfficeHelpPath; - bExtensionMode = false; - if( pExtensionPath && pExtensionPath->length() > 0 && pOfficeHelpPath ) - { - helpFiles.clear(); - bExtensionMode = true; - extensionPath = *pExtensionPath; - sourceRoot = fs::path(extensionPath); - extensionDestination = *pDestination; - aOfficeHelpPath = *pOfficeHelpPath; - } + helpFiles.clear(); + if (args.size() > 0 && args[0][0] == '@') { std::vector<std::string> stringList; @@ -793,10 +786,34 @@ void HelpLinker::main( std::vector<std::string> &args, } size_t i = 0; - + bool bSrcOption = false; while (i < args.size()) { - if (args[i].compare("-src") == 0) + if (args[i].compare("-extlangsrc") == 0) + { + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "extension source missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + extsource = args[i]; + } + else if (args[i].compare("-extlangdest") == 0) + { + //If this argument is not provided then the location provided in -extsource will + //also be the destination + ++i; + if (i >= args.size()) + { + std::stringstream aStrStream; + aStrStream << "extension destination missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + extdestination = args[i]; + } + else if (args[i].compare("-src") == 0) { ++i; if (i >= args.size()) @@ -805,9 +822,8 @@ void HelpLinker::main( std::vector<std::string> &args, aStrStream << "sourceroot missing" << std::endl; throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); } - - if( !bExtensionMode ) - sourceRoot = fs::path(args[i], fs::native); + bSrcOption = true; + sourceRoot = fs::path(args[i], fs::native); } else if (args[i].compare("-sty") == 0) { @@ -933,21 +949,70 @@ void HelpLinker::main( std::vector<std::string> &args, ++i; } + //We can be called from the helplinker executable or the extension manager + //In the latter case extsource is not used. + if( (pExtensionPath && pExtensionPath->length() > 0 && pOfficeHelpPath) + || !extsource.empty()) + { + bExtensionMode = true; + if (!extsource.empty()) + { + //called from helplinker.exe, pExtensionPath and pOfficeHelpPath + //should be NULL + sourceRoot = fs::path(extsource, fs::native); + extensionPath = sourceRoot.toUTF8(); + + if (extdestination.empty()) + { + std::stringstream aStrStream; + aStrStream << "-extlangdest is missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + else + { + //Convert from system path to file URL!!! + fs::path p(extdestination, fs::native); + extensionDestination = p.toUTF8(); + } + } + else + { //called from extension manager + extensionPath = *pExtensionPath; + sourceRoot = fs::path(extensionPath); + extensionDestination = *pDestination; + } + //check if -src option was used. This option must not be used + //when extension help is compiled. + if (bSrcOption) + { + std::stringstream aStrStream; + aStrStream << "-src must not be used together with -extsource missing" << std::endl; + throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); + } + } + if (!bExtensionMode && zipdir.empty()) { std::stringstream aStrStream; aStrStream << "no index dir given" << std::endl; throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); } - if (!bExtensionMode && idxCaptionStylesheet.empty()) + + if (!bExtensionMode && idxCaptionStylesheet.empty() + || !extsource.empty() && idxCaptionStylesheet.empty()) { + //No extension mode and extension mode using commandline + //!extsource.empty indicates extension mode using commandline + // -idxcaption paramter is required std::stringstream aStrStream; aStrStream << "no index caption stylesheet given" << std::endl; throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); } - else if ( bExtensionMode ) + else if ( bExtensionMode && extsource.empty()) { - rtl::OUString aIdxCaptionPathFileURL( aOfficeHelpPath ); + //This part is used when compileExtensionHelp is called from the extensions manager. + //If extension help is compiled using helplinker in the build process + rtl::OUString aIdxCaptionPathFileURL( *pOfficeHelpPath ); aIdxCaptionPathFileURL += rtl::OUString::createFromAscii( "/idxcaption.xsl" ); rtl::OString aOStr_IdxCaptionPathFileURL( rtl::OUStringToOString @@ -956,15 +1021,23 @@ void HelpLinker::main( std::vector<std::string> &args, idxCaptionStylesheet = fs::path( aStdStr_IdxCaptionPathFileURL ); } - if (!bExtensionMode && idxContentStylesheet.empty()) + + if (!bExtensionMode && idxContentStylesheet.empty() + || !extsource.empty() && idxContentStylesheet.empty()) { + //No extension mode and extension mode using commandline + //!extsource.empty indicates extension mode using commandline + // -idxcontent paramter is required std::stringstream aStrStream; aStrStream << "no index content stylesheet given" << std::endl; throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); } - else if ( bExtensionMode ) + else if ( bExtensionMode && extsource.empty()) { - rtl::OUString aIdxContentPathFileURL( aOfficeHelpPath ); + //If extension help is compiled using helplinker in the build process + //then -idxcontent must be supplied + //This part is used when compileExtensionHelp is called from the extensions manager. + rtl::OUString aIdxContentPathFileURL( *pOfficeHelpPath ); aIdxContentPathFileURL += rtl::OUString::createFromAscii( "/idxcontent.xsl" ); rtl::OString aOStr_IdxContentPathFileURL( rtl::OUStringToOString diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index b0318516b72c..af89761a2c86 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -27,6 +27,7 @@ #include "fastserializer.hxx" #include <rtl/ustrbuf.hxx> +#include <rtl/byteseq.hxx> #include <com/sun/star/xml/Attribute.hpp> #include <com/sun/star/xml/FastAttribute.hpp> @@ -41,6 +42,7 @@ using ::rtl::OUStringToOString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::toUnoSequence; using ::com::sun::star::xml::FastAttribute; using ::com::sun::star::xml::Attribute; using ::com::sun::star::xml::sax::SAXException; @@ -52,15 +54,15 @@ using ::com::sun::star::io::NotConnectedException; using ::com::sun::star::io::IOException; using ::com::sun::star::io::BufferSizeExceededException; -static Sequence< sal_Int8 > aClosingBracket((sal_Int8 *)">", 1); -static Sequence< sal_Int8 > aSlashAndClosingBracket((sal_Int8 *)"/>", 2); -static Sequence< sal_Int8 > aColon((sal_Int8 *)":", 1); -static Sequence< sal_Int8 > aOpeningBracket((sal_Int8 *)"<", 1); -static Sequence< sal_Int8 > aOpeningBracketAndSlash((sal_Int8 *)"</", 2); -static Sequence< sal_Int8 > aQuote((sal_Int8 *)"\"", 1); -static Sequence< sal_Int8 > aEqualSignAndQuote((sal_Int8 *)"=\"", 2); -static Sequence< sal_Int8 > aSpace((sal_Int8 *)" ", 1); -static Sequence< sal_Int8 > aXmlHeader((sal_Int8*) "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", 56); +static rtl::ByteSequence aClosingBracket((const sal_Int8 *)">", 1); +static rtl::ByteSequence aSlashAndClosingBracket((const sal_Int8 *)"/>", 2); +static rtl::ByteSequence aColon((const sal_Int8 *)":", 1); +static rtl::ByteSequence aOpeningBracket((const sal_Int8 *)"<", 1); +static rtl::ByteSequence aOpeningBracketAndSlash((const sal_Int8 *)"</", 2); +static rtl::ByteSequence aQuote((const sal_Int8 *)"\"", 1); +static rtl::ByteSequence aEqualSignAndQuote((const sal_Int8 *)"=\"", 2); +static rtl::ByteSequence aSpace((const sal_Int8 *)" ", 1); +static rtl::ByteSequence aXmlHeader((const sal_Int8*) "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", 56); #define HAS_NAMESPACE(x) ((x & 0xffff0000) != 0) #define NAMESPACE(x) (x >> 16) @@ -74,7 +76,7 @@ namespace sax_fastparser { { if (!mxOutputStream.is()) return; - writeBytes(aXmlHeader); + writeBytes(toUnoSequence(aXmlHeader)); } OUString FastSaxSerializer::escapeXml( const OUString& s ) @@ -116,7 +118,7 @@ namespace sax_fastparser { { if( HAS_NAMESPACE( nElement ) ) { writeBytes(mxFastTokenHandler->getUTF8Identifier(NAMESPACE(nElement))); - writeBytes(aColon); + writeBytes(toUnoSequence(aColon)); writeBytes(mxFastTokenHandler->getUTF8Identifier(TOKEN(nElement))); } else writeBytes(mxFastTokenHandler->getUTF8Identifier(nElement)); @@ -128,12 +130,12 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; - writeBytes(aOpeningBracket); + writeBytes(toUnoSequence(aOpeningBracket)); writeId(Element); writeFastAttributeList(Attribs); - writeBytes(aClosingBracket); + writeBytes(toUnoSequence(aClosingBracket)); } void SAL_CALL FastSaxSerializer::startUnknownElement( const OUString& Namespace, const OUString& Name, const Reference< XFastAttributeList >& Attribs ) @@ -142,19 +144,19 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; - writeBytes(aOpeningBracket); + writeBytes(toUnoSequence(aOpeningBracket)); if (Namespace.getLength()) { write(Namespace); - writeBytes(aColon); + writeBytes(toUnoSequence(aColon)); } write(Name); writeFastAttributeList(Attribs); - writeBytes(aClosingBracket); + writeBytes(toUnoSequence(aClosingBracket)); } void SAL_CALL FastSaxSerializer::endFastElement( ::sal_Int32 Element ) @@ -163,11 +165,11 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; - writeBytes(aOpeningBracketAndSlash); + writeBytes(toUnoSequence(aOpeningBracketAndSlash)); writeId(Element); - writeBytes(aClosingBracket); + writeBytes(toUnoSequence(aClosingBracket)); } void SAL_CALL FastSaxSerializer::endUnknownElement( const OUString& Namespace, const OUString& Name ) @@ -176,17 +178,17 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; - writeBytes(aOpeningBracketAndSlash); + writeBytes(toUnoSequence(aOpeningBracketAndSlash)); if (Namespace.getLength()) { write(Namespace); - writeBytes(aColon); + writeBytes(toUnoSequence(aColon)); } write(Name); - writeBytes(aClosingBracket); + writeBytes(toUnoSequence(aClosingBracket)); } void SAL_CALL FastSaxSerializer::singleFastElement( ::sal_Int32 Element, const Reference< XFastAttributeList >& Attribs ) @@ -195,12 +197,12 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; - writeBytes(aOpeningBracket); + writeBytes(toUnoSequence(aOpeningBracket)); writeId(Element); writeFastAttributeList(Attribs); - writeBytes(aSlashAndClosingBracket); + writeBytes(toUnoSequence(aSlashAndClosingBracket)); } void SAL_CALL FastSaxSerializer::singleUnknownElement( const OUString& Namespace, const OUString& Name, const Reference< XFastAttributeList >& Attribs ) @@ -209,19 +211,19 @@ namespace sax_fastparser { if (!mxOutputStream.is()) return; - writeBytes(aOpeningBracket); + writeBytes(toUnoSequence(aOpeningBracket)); if (Namespace.getLength()) { write(Namespace); - writeBytes(aColon); + writeBytes(toUnoSequence(aColon)); } write(Name); writeFastAttributeList(Attribs); - writeBytes(aSlashAndClosingBracket); + writeBytes(toUnoSequence(aSlashAndClosingBracket)); } void SAL_CALL FastSaxSerializer::characters( const OUString& aChars ) @@ -251,12 +253,12 @@ namespace sax_fastparser { sal_Int32 nAttrLength = aAttrSeq.getLength(); for (sal_Int32 i = 0; i < nAttrLength; i++) { - writeBytes(aSpace); + writeBytes(toUnoSequence(aSpace)); write(pAttr[i].Name); - writeBytes(aEqualSignAndQuote); + writeBytes(toUnoSequence(aEqualSignAndQuote)); write(escapeXml(pAttr[i].Value)); - writeBytes(aQuote); + writeBytes(toUnoSequence(aQuote)); } Sequence< FastAttribute > aFastAttrSeq = Attribs->getFastAttributes(); @@ -264,16 +266,16 @@ namespace sax_fastparser { sal_Int32 nFastAttrLength = aFastAttrSeq.getLength(); for (sal_Int32 j = 0; j < nFastAttrLength; j++) { - writeBytes(aSpace); + writeBytes(toUnoSequence(aSpace)); sal_Int32 nToken = pFastAttr[j].Token; writeId(nToken); - writeBytes(aEqualSignAndQuote); + writeBytes(toUnoSequence(aEqualSignAndQuote)); write(escapeXml(Attribs->getValue(pFastAttr[j].Token))); - writeBytes(aQuote); + writeBytes(toUnoSequence(aQuote)); } } diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx index 00dd454233e2..2c18429b9d64 100644 --- a/sot/source/sdstor/stgio.cxx +++ b/sot/source/sdstor/stgio.cxx @@ -158,7 +158,7 @@ class EasyFat public: EasyFat( StgIo & rIo, StgStrm *pFatStream, INT32 nPSize ); - ~EasyFat() { delete pFat; delete pFree; } + ~EasyFat() { delete[] pFat; delete[] pFree; } INT32 GetPageSize() { return nPageSize; } INT32 Count() { return nPages; } INT32 operator[]( INT32 nOffset ) { return pFat[ nOffset ]; } diff --git a/svtools/inc/svtools/svtools.hrc b/svtools/inc/svtools/svtools.hrc index a57a0f5bb0fe..3dd2f0706a2e 100644 --- a/svtools/inc/svtools/svtools.hrc +++ b/svtools/inc/svtools/svtools.hrc @@ -38,22 +38,12 @@ //............................................................................. // various unsorted stuff -#define DLG_EXPORT_PIX (RID_SVTOOLS_START+1) -#define DLG_EXPORT_VEC (RID_SVTOOLS_START+2) #define DLG_TWAIN_SOURCE (RID_SVTOOLS_START+3) #define DLG_SVT_EXPLORERFILE (RID_SVTOOLS_START+4) #define DLG_SVT_QUERYFOLDERNAME (RID_SVTOOLS_START+5) #define DLG_SVT_QUERYDELETE (RID_SVTOOLS_START+6) -#define EXPORT_DIALOG_TITLE (RID_SVTOOLS_START+4) -#define KEY_MODE (RID_SVTOOLS_START+5) -#define KEY_RES (RID_SVTOOLS_START+6) -#define KEY_SIZE (RID_SVTOOLS_START+7) - -#define KEY_COLORS (RID_SVTOOLS_START+9) -#define KEY_RLE_CODING (RID_SVTOOLS_START+10) - #define STR_SVT_AUTOMATIC_COLOR (RID_SVTOOLS_START+16) #define STR_SVT_FILEVIEW_COLUMN_TITLE (RID_SVTOOLS_START + 20) @@ -289,17 +279,16 @@ //............................................................................. // dialogs - -#define DLG_EXPORT_JPG_START (RID_SVTOOLS_START+110) -#define DLG_EXPORT_JPG (RID_SVTOOLS_START+111) -#define DLG_EXPORT_JPG_END (RID_SVTOOLS_START+112) +#define DLG_EXPORT_START (STR_ARR_SVT_LANGUAGE_TABLE_END + 1) +#define DLG_EXPORT (DLG_EXPORT_START) +#define DLG_EXPORT_TITLE (DLG_EXPORT_START+1) +#define DLG_EXPORT_END (DLG_EXPORT_TITLE) #define DLG_LOGIN (RID_SVTOOLS_START+113) #define DLG_ADDRESSBOOKSOURCE (RID_SVTOOLS_START+114) #define DLG_REGISTRATION_REQUEST (RID_SVTOOLS_START+115) -#define DLG_EXPORT_EPNG (RID_SVTOOLS_START+116) //............................................................................. // bitmaps diff --git a/svtools/inc/svtools/svtreebx.hxx b/svtools/inc/svtools/svtreebx.hxx index a600b91db1c4..787e0956888f 100644 --- a/svtools/inc/svtools/svtreebx.hxx +++ b/svtools/inc/svtools/svtreebx.hxx @@ -156,6 +156,7 @@ protected: virtual void CursorMoved( SvLBoxEntry* pNewCursor ); virtual void PreparePaint( SvLBoxEntry* ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void StateChanged( StateChangedType nStateChange ); void InitSettings(BOOL bFont,BOOL bForeground,BOOL bBackground); BOOL IsCellFocusEnabled() const; diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx index 9a6ece489119..829feecd5836 100644 --- a/svtools/inc/svtools/table/tabledatawindow.hxx +++ b/svtools/inc/svtools/table/tabledatawindow.hxx @@ -55,7 +55,6 @@ namespace svt { namespace table Link m_aMouseButtonDownHdl; Link m_aMouseButtonUpHdl; Link m_aSelectHdl; - RowPos m_nRowAlreadySelected; public: TableDataWindow( TableControl_Impl& _rTableControl ); inline void SetMouseButtonDownHdl( const Link& rLink ) { m_aMouseButtonDownHdl = rLink; } diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 484584828b9f..35324d551858 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -2172,14 +2172,6 @@ void SvImpLBox::MouseButtonDown( const MouseEvent& rMEvt ) SelAllDestrAnch( FALSE, TRUE ); // DeselectAll(); SetCursor( pEntry ); - DBG_ERROR( "Please report what you did to get this assertion to FS!" ); - // The entry which has been double-clicked changed - and we select it, again. - // I have situations where this behaviour does not make any sense at all - even more, it - // leads to hacks to revert it's results. - // So I'm not sure if this behaviour here is nonsense (which I believe at the moment), - // or if there are really scenarious where it dones make sense .... - // 07.12.2001 - 95727 - fs@openoffice.org - return; } if( pEntry->HasChilds() || pEntry->HasChildsOnDemand() ) diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index b11a3f12ddf3..a8635c99d127 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -2516,6 +2516,11 @@ void SvTreeListBox::DataChanged( const DataChangedEvent& rDCEvt ) Control::DataChanged( rDCEvt ); } +void SvTreeListBox::StateChanged( StateChangedType i_nStateChange ) +{ + SvLBox::StateChanged( i_nStateChange ); +} + void SvTreeListBox::InitSettings(BOOL bFont,BOOL bForeground,BOOL bBackground) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); diff --git a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx index 8ca6ba2b124e..1c4eeeff1bbf 100644 --- a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx +++ b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx @@ -36,9 +36,7 @@ #include <osl/module.hxx> #include <svl/solar.hrc> #include <svtools/fltcall.hxx> -#include "dlgexpor.hxx" -#include "dlgejpg.hxx" -#include "dlgepng.hxx" +#include "exportdialog.hxx" #include <uno/mapping.hxx> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/document/XViewDataSupplier.hpp> @@ -49,12 +47,6 @@ #include <unotools/syslocale.hxx> #include "vcl/svapp.hxx" -#if (defined OS2 && !defined ICC) -#define EXPDLG_FUNCTION_NAME "_DoExportDialog" -#else -#define EXPDLG_FUNCTION_NAME "DoExportDialog" -#endif - using namespace ::rtl; using namespace ::com::sun::star; @@ -93,9 +85,10 @@ uno::Sequence< OUString > SAL_CALL SvFilterOptionsDialog_getSupportedServiceName // ----------------------------------------------------------------------------- -SvFilterOptionsDialog::SvFilterOptionsDialog( const uno::Reference< lang::XMultiServiceFactory > & xMgr ) : - rxMgr ( xMgr ), - eFieldUnit ( FUNIT_CM ) +SvFilterOptionsDialog::SvFilterOptionsDialog( const uno::Reference< lang::XMultiServiceFactory > xMgr ) : + mxMgr ( xMgr ), + meFieldUnit ( FUNIT_CM ), + mbExportSelection ( sal_False ) { } @@ -148,18 +141,18 @@ uno::Sequence< beans::PropertyValue > SvFilterOptionsDialog::getPropertyValues() throw ( uno::RuntimeException ) { sal_Int32 i, nCount; - for ( i = 0, nCount = aMediaDescriptor.getLength(); i < nCount; i++ ) + for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) { - if ( aMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) ) + if ( maMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) ) break; } if ( i == nCount ) - aMediaDescriptor.realloc( ++nCount ); + maMediaDescriptor.realloc( ++nCount ); // the "FilterData" Property is an Any that will contain our PropertySequence of Values - aMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) ); - aMediaDescriptor[ i ].Value <<= aFilterDataSequence; - return aMediaDescriptor; + maMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) ); + maMediaDescriptor[ i ].Value <<= maFilterDataSequence; + return maMediaDescriptor; } void SvFilterOptionsDialog::setPropertyValues( const uno::Sequence< beans::PropertyValue > & aProps ) @@ -167,15 +160,18 @@ void SvFilterOptionsDialog::setPropertyValues( const uno::Sequence< beans::Prope lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException ) { - aMediaDescriptor = aProps; + maMediaDescriptor = aProps; sal_Int32 i, nCount; - for ( i = 0, nCount = aMediaDescriptor.getLength(); i < nCount; i++ ) + for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) { - if ( aMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) ) + if ( maMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) ) { - aMediaDescriptor[ i ].Value >>= aFilterDataSequence; - break; + maMediaDescriptor[ i ].Value >>= maFilterDataSequence; + } + else if ( maMediaDescriptor[ i ].Name.equalsAscii( "SelectionOnly" ) ) + { + maMediaDescriptor[ i ].Value >>= mbExportSelection; } } } @@ -184,7 +180,7 @@ void SvFilterOptionsDialog::setPropertyValues( const uno::Sequence< beans::Prope void SvFilterOptionsDialog::setTitle( const OUString& aTitle ) throw ( uno::RuntimeException ) { - aDialogTitle = aTitle; + maDialogTitle = aTitle; } sal_Int16 SvFilterOptionsDialog::execute() @@ -194,13 +190,13 @@ sal_Int16 SvFilterOptionsDialog::execute() String aFilterNameStr( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) ); String aInternalFilterName; - sal_Int32 j, nCount = aMediaDescriptor.getLength(); + sal_Int32 j, nCount = maMediaDescriptor.getLength(); for ( j = 0; j < nCount; j++ ) { - if ( aMediaDescriptor[ j ].Name.equals( aFilterNameStr ) ) + if ( maMediaDescriptor[ j ].Name.equals( aFilterNameStr ) ) { OUString aStr; - aMediaDescriptor[ j ].Value >>= aStr; + maMediaDescriptor[ j ].Value >>= aStr; aInternalFilterName = aStr; aInternalFilterName.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "draw_" ) ), String(), 0 ); aInternalFilterName.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "impress_" ) ), String(), 0 ); @@ -219,79 +215,24 @@ sal_Int16 SvFilterOptionsDialog::execute() } if ( nFormat < nFilterCount ) { - FltCallDialogParameter aFltCallDlgPara( Application::GetDefDialogParent(), NULL, eFieldUnit ); - aFltCallDlgPara.aFilterData = aFilterDataSequence; - - String aFilterName( aGraphicFilter.pConfig->GetExportFilterName( nFormat ) ); - if ( aGraphicFilter.pConfig->IsExportInternalFilter( nFormat ) ) - { - // Export-Dialog fuer Bitmap's, SVM's und WMF's - if( ( aFilterName.EqualsIgnoreCaseAscii( EXP_BMP ) ) || - ( aFilterName.EqualsIgnoreCaseAscii( EXP_SVMETAFILE ) ) || - ( aFilterName.EqualsIgnoreCaseAscii( EXP_WMF ) ) || - ( aFilterName.EqualsIgnoreCaseAscii( EXP_EMF ) ) || - ( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) )|| - ( aFilterName.EqualsIgnoreCaseAscii( EXP_PNG ) ) ) - { - ByteString aResMgrName( "svt", 3 ); - ResMgr* pResMgr; - - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - aFltCallDlgPara.pResMgr = pResMgr; - // JPEG-Dialog - if( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) ) - { - if ( DlgExportEJPG( aFltCallDlgPara ).Execute() == RET_OK ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - else if ( aFilterName.EqualsIgnoreCaseAscii( EXP_PNG ) ) - { - if ( DlgExportEPNG( aFltCallDlgPara ).Execute() == RET_OK ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - else if( aFilterName.EqualsIgnoreCaseAscii( EXP_BMP ) ) - { - // Fuer Vektorformate nehmen wir den Vektor-Dialog - aFltCallDlgPara.aFilterExt = aGraphicFilter.pConfig->GetExportFormatShortName( nFormat ); - if ( DlgExportPix( aFltCallDlgPara ).Execute() == RET_OK ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - else - { - aFltCallDlgPara.aFilterExt = aGraphicFilter.pConfig->GetExportFormatShortName( nFormat ); - if ( DlgExportVec( aFltCallDlgPara ).Execute() == RET_OK ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - delete pResMgr; - } - } - else // ladbare Filter - { - xub_StrLen i, nTokenCount = aGraphicFilter.aFilterPath.GetTokenCount( ';' ); - for ( i = 0; i < nTokenCount; i++ ) - { - - OUString aPathURL; - - ::osl::FileBase::getFileURLFromSystemPath( aGraphicFilter.aFilterPath.GetToken( i ), aPathURL ); - aPathURL += String( '/' ); - - OUString aSystemPath; - ::osl::FileBase::getSystemPathFromFileURL( aPathURL, aSystemPath ); - aSystemPath += OUString( aFilterName ); - - osl::Module aLibrary( aSystemPath ); - PFilterDlgCall pFunc = (PFilterDlgCall) aLibrary.getFunctionSymbol( UniString::CreateFromAscii( EXPDLG_FUNCTION_NAME ) ); - // Dialog in DLL ausfuehren - if( pFunc ) - { - if ( (*pFunc)( aFltCallDlgPara ) ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - } - } + FltCallDialogParameter aFltCallDlgPara( Application::GetDefDialogParent(), NULL, meFieldUnit ); + aFltCallDlgPara.aFilterData = maFilterDataSequence; + + ByteString aResMgrName( "svt", 3 ); + ResMgr* pResMgr; + + pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + aFltCallDlgPara.pResMgr = pResMgr; + + aFltCallDlgPara.aFilterExt = aGraphicFilter.pConfig->GetExportFormatShortName( nFormat ); + sal_Bool bIsPixelFormat( aGraphicFilter.pConfig->IsExportPixelFormat( nFormat ) ); + if ( ExportDialog( aFltCallDlgPara, mxMgr, mxSourceDocument, mbExportSelection, bIsPixelFormat ).Execute() == RET_OK ) + nRet = ui::dialogs::ExecutableDialogResults::OK; + + delete pResMgr; + // taking the out parameter from the dialog - aFilterDataSequence = aFltCallDlgPara.aFilterData; + maFilterDataSequence = aFltCallDlgPara.aFilterData; } } return nRet; @@ -301,6 +242,8 @@ sal_Int16 SvFilterOptionsDialog::execute() void SvFilterOptionsDialog::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc ) throw ( lang::IllegalArgumentException, uno::RuntimeException ) { + mxSourceDocument = xDoc; + // try to set the corresponding metric unit String aConfigPath; uno::Reference< lang::XServiceInfo > xServiceInfo @@ -320,7 +263,7 @@ void SvFilterOptionsDialog::setSourceDocument( const uno::Reference< lang::XComp aPropertyName = String( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); else aPropertyName = String( RTL_CONSTASCII_USTRINGPARAM( "NonMetric" ) ); - eFieldUnit = (FieldUnit)aConfigItem.ReadInt32( aPropertyName, FUNIT_CM ); + meFieldUnit = (FieldUnit)aConfigItem.ReadInt32( aPropertyName, FUNIT_CM ); } } } diff --git a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx index a55fc4c84520..16592bac8df7 100644 --- a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx +++ b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx @@ -46,18 +46,22 @@ class SvFilterOptionsDialog : public cppu::WeakImplHelper5 com::sun::star::lang::XServiceInfo > { - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & - rxMgr; + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > + mxMgr; com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > - aMediaDescriptor; + maMediaDescriptor; com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > - aFilterDataSequence; - rtl::OUString aDialogTitle; - FieldUnit eFieldUnit; + maFilterDataSequence; + com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > + mxSourceDocument; + + rtl::OUString maDialogTitle; + FieldUnit meFieldUnit; + sal_Bool mbExportSelection; public: - SvFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); + SvFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB ); ~SvFilterOptionsDialog(); // XInterface diff --git a/svtools/source/filter.vcl/filter/dlgejpg.cxx b/svtools/source/filter.vcl/filter/dlgejpg.cxx deleted file mode 100644 index 377697023de3..000000000000 --- a/svtools/source/filter.vcl/filter/dlgejpg.cxx +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "dlgejpg.hxx" -#include "dlgejpg.hrc" -#include "strings.hrc" -#include <svtools/FilterConfigItem.hxx> - -#define KEY_QUALITY "Quality" -#define KEY_GRAYSCALES "ColorMode" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEJPG::DlgExportEJPG( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_JPG, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aFiDescr ( this, ResId( FI_DESCR, *rPara.pResMgr ) ), - aNumFldQuality ( this, ResId( NUM_FLD_QUALITY, *rPara.pResMgr ) ), - aGrpQuality ( this, ResId( GRP_QUALITY, *rPara.pResMgr ) ), - aRbGray ( this, ResId( RB_GRAY, *rPara.pResMgr ) ), - aRbRGB ( this, ResId( RB_RGB, *rPara.pResMgr ) ), - aGrpColors ( this, ResId( GRP_COLORS, *rPara.pResMgr ) ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ) -{ - FreeResource(); - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/JPG" ) ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - // reading filter options - sal_Int32 nQuality = pConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_QUALITY ) ), 75 ); - sal_Int32 nColorMode = pConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_GRAYSCALES ) ), 0 ); - aNumFldQuality.SetValue( nQuality ); - - if ( nColorMode ) - aRbGray.Check( sal_True ); - else - aRbRGB.Check( sal_True ); - - aBtnOK.SetClickHdl( LINK( this, DlgExportEJPG, OK ) ); -} - - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEJPG, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - pConfigItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_QUALITY ) ), (sal_Int32)aNumFldQuality.GetValue() ); - pConfigItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_GRAYSCALES ) ), aRbGray.IsChecked() ? 1 : 0 ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - return 0; -} - -DlgExportEJPG::~DlgExportEJPG() -{ - delete pConfigItem; -} - - diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hrc b/svtools/source/filter.vcl/filter/dlgejpg.hrc deleted file mode 100644 index 90a3c1d162be..000000000000 --- a/svtools/source/filter.vcl/filter/dlgejpg.hrc +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svtools/svtools.hrc> - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define FI_DESCR 1 -#define NUM_FLD_QUALITY 1 -#define GRP_QUALITY 1 -#define GRP_COLORS 2 -#define RB_GRAY 1 -#define RB_RGB 2 - - diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hxx b/svtools/source/filter.vcl/filter/dlgejpg.hxx deleted file mode 100644 index d80682574a54..000000000000 --- a/svtools/source/filter.vcl/filter/dlgejpg.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEJPG_HXX_ -#define _DLGEJPG_HXX_ - -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/msgbox.hxx> -#include <svtools/stdctrl.hxx> -#include <svtools/fltcall.hxx> - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen -|* -\************************************************************************/ -class FilterConfigItem; -class DlgExportEJPG : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - FixedInfo aFiDescr; - NumericField aNumFldQuality; - FixedLine aGrpQuality; - RadioButton aRbGray; - RadioButton aRbRGB; - FixedLine aGrpColors; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - FilterConfigItem* pConfigItem; - - DECL_LINK( OK, void * ); - -public: - DlgExportEJPG( FltCallDialogParameter& rDlgPara ); - ~DlgExportEJPG(); -}; - -#endif // _DLGEJPG_HXX_ - diff --git a/svtools/source/filter.vcl/filter/dlgejpg.src b/svtools/source/filter.vcl/filter/dlgejpg.src deleted file mode 100644 index fd224f22c409..000000000000 --- a/svtools/source/filter.vcl/filter/dlgejpg.src +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgejpg.hrc" -ModalDialog DLG_EXPORT_JPG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 159 , 92 ) ; - Text [ en-US ] = "JPEG Options" ; - Moveable = TRUE ; - Closeable = TRUE ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 103 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 103 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 103 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine GRP_QUALITY - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 90 , 8 ) ; - Text [ en-US ] = "Quality" ; - }; - FixedText FI_DESCR - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 81 , 16 ) ; - Text [ en-US ] = "1: min. quality\n100: max. quality" ; - }; - NumericField NUM_FLD_QUALITY - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 33 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Minimum = 1; - Maximum = 100 ; - StrictFormat = TRUE ; - Last = 100 ; - Repeat = TRUE ; - }; - FixedLine GRP_COLORS - { - Pos = MAP_APPFONT ( 6 , 51 ) ; - Size = MAP_APPFONT ( 90 , 8 ) ; - Text [ en-US ] = "Color resolution" ; - }; - RadioButton RB_GRAY - { - Pos = MAP_APPFONT ( 12 , 62 ) ; - Size = MAP_APPFONT ( 81 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Grayscale" ; - }; - RadioButton RB_RGB - { - Pos = MAP_APPFONT ( 12 , 76 ) ; - Size = MAP_APPFONT ( 81 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "True Colors" ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/filter.vcl/filter/dlgepng.cxx b/svtools/source/filter.vcl/filter/dlgepng.cxx deleted file mode 100644 index bd551e9a4bda..000000000000 --- a/svtools/source/filter.vcl/filter/dlgepng.cxx +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <tools/ref.hxx> -#include <vcl/msgbox.hxx> -#include "dlgepng.hxx" -#include "dlgepng.hrc" - -using namespace ::rtl; -using namespace ::com::sun::star::uno; - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEPNG::DlgExportEPNG( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPNG, *rPara.pResMgr ) ), - FilterConfigItem ( OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PNG" ) ), &rPara.aFilterData ), - rFltCallPara ( rPara ), - aGrpCompression ( this, ResId( GRP_COMPRESSION, *rPara.pResMgr ) ), - aFiCompression ( this, ResId( FI_COMPRESSION, *rPara.pResMgr ) ), - aNumCompression ( this, ResId( NUM_COMPRESSION, *rPara.pResMgr ) ), - aCbxInterlaced ( this, ResId( CBX_INTERLACED, *rPara.pResMgr ) ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ) -{ - FreeResource(); - - // Config-Parameter lesen - sal_Int32 nCompression = ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), 6 ); - if ( ( nCompression < 0 ) || ( nCompression > 9 ) ) - nCompression = 6; - aNumCompression.SetValue( nCompression ); - - sal_Int32 nInterlaced = ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 0 ); - sal_Bool bInterlaced = nInterlaced != 0; - aCbxInterlaced.Check( bInterlaced ); - - aBtnOK.SetClickHdl( LINK( this, DlgExportEPNG, OK ) ); -} - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEPNG, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), static_cast<sal_Int32>(aNumCompression.GetValue()) ); - sal_Int32 nInterlace = 0; - if ( aCbxInterlaced.IsChecked() ) - nInterlace++; - WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), nInterlace ); - rFltCallPara.aFilterData = GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} diff --git a/svtools/source/filter.vcl/filter/dlgepng.hrc b/svtools/source/filter.vcl/filter/dlgepng.hrc deleted file mode 100644 index b3ffaab3ab1e..000000000000 --- a/svtools/source/filter.vcl/filter/dlgepng.hrc +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svtools/svtools.hrc> - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define GRP_COMPRESSION 1 -#define FI_COMPRESSION 1 -#define NUM_COMPRESSION 1 -#define CBX_INTERLACED 1 diff --git a/svtools/source/filter.vcl/filter/dlgepng.hxx b/svtools/source/filter.vcl/filter/dlgepng.hxx deleted file mode 100644 index 469985afee59..000000000000 --- a/svtools/source/filter.vcl/filter/dlgepng.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEPNG_HXX_ -#define _DLGEPNG_HXX_ -#include <svtools/fltcall.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <svtools/stdctrl.hxx> -#include <svtools/FilterConfigItem.hxx> - - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen -|* -\************************************************************************/ - -class ResMgr; - -class DlgExportEPNG : public ModalDialog, FilterConfigItem -{ - - private: - - FltCallDialogParameter& rFltCallPara; - - FixedLine aGrpCompression; - FixedInfo aFiCompression; - NumericField aNumCompression; - CheckBox aCbxInterlaced; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - ResMgr* pMgr; - - DECL_LINK( OK, void * ); - - public: - - DlgExportEPNG( FltCallDialogParameter& rPara ); -}; - -#endif // _DLGEPNG_HXX_ diff --git a/svtools/source/filter.vcl/filter/dlgepng.src b/svtools/source/filter.vcl/filter/dlgepng.src deleted file mode 100644 index aa778842dc48..000000000000 --- a/svtools/source/filter.vcl/filter/dlgepng.src +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgepng.hrc" -ModalDialog DLG_EXPORT_EPNG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 169 , 64 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "PNG Options" ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 113 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 113 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 113 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine GRP_COMPRESSION - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text[ en-US ] = "Mode"; - }; - FixedText FI_COMPRESSION - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text[ en-US ] = "~Compression 0..9"; - }; - NumericField NUM_COMPRESSION - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 9 ; - First = 0 ; - Last = 9 ; - StrictFormat = TRUE ; - Repeat = TRUE ; - }; - CheckBox CBX_INTERLACED - { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 80 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Interlaced" ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/filter.vcl/filter/dlgexpor.cxx b/svtools/source/filter.vcl/filter/dlgexpor.cxx deleted file mode 100644 index b4b7c0fc949d..000000000000 --- a/svtools/source/filter.vcl/filter/dlgexpor.cxx +++ /dev/null @@ -1,442 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifndef GCC -# pragma hdrstop -#endif - -#include <tools/ref.hxx> -#include <svtools/FilterConfigItem.hxx> -#include <com/sun/star/awt/Size.hpp> -#include <vcl/msgbox.hxx> -#include "dlgexpor.hxx" -#include "dlgexpor.hrc" -#include "strings.hrc" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportPix::DlgExportPix( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_PIX, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aBtnOK ( this, ResId( BTN_OK_PIX, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL_PIX, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP_PIX, *rPara.pResMgr ) ), - aLbColors ( this, ResId( LB_COLORS, *rPara.pResMgr ) ), - aCbxRLE ( this, ResId( CBX_RLE, *rPara.pResMgr ) ), - aGrpColors ( this, ResId( GRP_COLORS, *rPara.pResMgr ) ), - aRbOriginal ( this, ResId( RB_ORIGINAL_PIX, *rPara.pResMgr ) ), - aRbRes ( this, ResId( RB_RES_PIX, *rPara.pResMgr ) ), - aRbSize ( this, ResId( RB_SIZE_PIX, *rPara.pResMgr ) ), - aFtSizeX ( this, ResId( FT_SIZEX_PIX, *rPara.pResMgr ) ), - aMtfSizeX ( this, ResId( MTF_SIZEX_PIX, *rPara.pResMgr ) ), - aFtSizeY ( this, ResId( FT_SIZEY_PIX, *rPara.pResMgr ) ), - aMtfSizeY ( this, ResId( MTF_SIZEY_PIX, *rPara.pResMgr ) ), - aGrpMode ( this, ResId( GRP_MODE_PIX, *rPara.pResMgr ) ), - aCbbRes ( this, ResId( CBB_RES_PIX, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ), - aExt ( rPara.aFilterExt ) -{ - aExt.ToUpperAscii(); - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/" ) ); - aFilterConfigPath.Append( aExt ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - String aTitle( aExt ); - FreeResource(); - - aBtnOK.SetClickHdl( LINK( this, DlgExportPix, OK ) ); - aRbOriginal.SetClickHdl( LINK( this, DlgExportPix, ClickRbOriginal ) ); - aRbRes.SetClickHdl( LINK( this, DlgExportPix, ClickRbRes ) ); - aRbSize.SetClickHdl( LINK( this, DlgExportPix, ClickRbSize ) ); - aLbColors.SetSelectHdl( LINK( this, DlgExportPix, SelectLbColors ) ); - - aTitle.ToUpperAscii(); - aTitle += String( ResId( EXPORT_DIALOG_TITLE, *pMgr ) ); - SetText( aTitle ); - - // Config-Parameter lesen - sal_Int32 nColors = pConfigItem->ReadInt32( String( ResId( KEY_COLORS, *pMgr ) ), 0 ); - sal_Int32 nMode = pConfigItem->ReadInt32( String( ResId( KEY_MODE, *pMgr ) ), 0 ); - sal_Int32 nRes = pConfigItem->ReadInt32( String( ResId( KEY_RES, *pMgr ) ), 75 ); - sal_Bool bRleCoding = pConfigItem->ReadBool( String( ResId( KEY_RLE_CODING, *pMgr ) ), sal_True ); - - aLbColors.SelectEntryPos( Min( (sal_uInt16) 7, (sal_uInt16)nColors ) ); - - String aStrRes( String::CreateFromInt32( nRes ) ); - aStrRes.Append( String( RTL_CONSTASCII_USTRINGPARAM( " DPI" ) ) ); - aCbbRes.SetText( aStrRes ); - - ::com::sun::star::awt::Size aDefault( 10000, 10000 ); - ::com::sun::star::awt::Size aSize; - aSize = pConfigItem->ReadSize( String( ResId( KEY_SIZE, *pMgr ) ), aDefault ); - - aCbxRLE.Check( bRleCoding ); - - aMtfSizeX.SetDefaultUnit( FUNIT_MM ); - aMtfSizeY.SetDefaultUnit( FUNIT_MM ); - - aMtfSizeX.SetValue( aSize.Width ); - aMtfSizeY.SetValue( aSize.Height ); - - switch ( rPara.eFieldUnit ) - { -// case FUNIT_NONE : -// case FUNIT_KM : -// case FUNIT_PERCENT : -// case FUNIT_CUSTOM : -// case FUNIT_MILE : -// case FUNIT_FOOT : -// case FUNIT_M : - case FUNIT_MM : - case FUNIT_CM : - case FUNIT_TWIP : - case FUNIT_POINT : - case FUNIT_PICA : - case FUNIT_INCH : - case FUNIT_100TH_MM : - { - aMtfSizeX.SetUnit( rPara.eFieldUnit ); - aMtfSizeY.SetUnit( rPara.eFieldUnit ); - } - break; - - default: - break; // -Wall multiple values not handled. - } - - switch ( nMode ) - { - case 2 : - { - aRbSize.Check( TRUE ); - ClickRbSize( NULL ); - } - break; - case 1 : - { - aRbRes.Check( TRUE ); - ClickRbRes( NULL ); - } - break; - default : - { - aRbOriginal.Check( TRUE ); - ClickRbOriginal( NULL ); - } - break; - } - SelectLbColors( &aLbColors ); -} - -DlgExportPix::~DlgExportPix() -{ - delete pConfigItem; -} - - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - - sal_Int32 nRes = Max( Min( aCbbRes.GetText().ToInt32(), sal_Int32( 600 ) ), sal_Int32( 75 ) ); - ::com::sun::star::awt::Size aSize( - static_cast<long>(MetricField::ConvertDoubleValue( static_cast<double>(aMtfSizeX.GetValue()), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM )), - static_cast<long>(MetricField::ConvertDoubleValue( static_cast<double>(aMtfSizeY.GetValue()), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM )) ); - - sal_Int32 nMode; - if ( aRbRes.IsChecked() ) - nMode = 1; - else if ( aRbSize.IsChecked() ) - nMode = 2; - else - nMode = 0; - - pConfigItem->WriteInt32( String( ResId( KEY_MODE, *pMgr ) ), nMode ); - pConfigItem->WriteInt32( String( ResId( KEY_RES, *pMgr ) ), nRes ); - pConfigItem->WriteSize( String( ResId( KEY_SIZE, *pMgr ) ), aSize ); - pConfigItem->WriteInt32( String( ResId( KEY_COLORS, *pMgr ) ), (sal_Int32)aLbColors.GetSelectEntryPos() ); - pConfigItem->WriteBool( String( ResId( KEY_RLE_CODING, *pMgr ) ), aCbxRLE.IsChecked() ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, ClickRbOriginal, void*, EMPTYARG ) -{ - aCbbRes.Disable(); - - aFtSizeX.Disable(); - aMtfSizeX.Disable(); - aFtSizeY.Disable(); - aMtfSizeY.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, ClickRbRes, void*, EMPTYARG ) -{ - aCbbRes.Enable(); - - aFtSizeX.Disable(); - aMtfSizeX.Disable(); - aFtSizeY.Disable(); - aMtfSizeY.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, ClickRbSize, void*, EMPTYARG ) -{ - aFtSizeX.Enable(); - aMtfSizeX.Enable(); - aFtSizeY.Enable(); - aMtfSizeY.Enable(); - - aCbbRes.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, SelectLbColors, void*, EMPTYARG ) -{ - const USHORT nLbPos = aLbColors.GetSelectEntryPos(); - - if ( ( nLbPos >= 3 ) && ( nLbPos <= 6 ) ) - aCbxRLE.Enable(); - else - aCbxRLE.Disable(); - - return 0L; -} - - -/******************************************************************************/ - - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportVec::DlgExportVec( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_VEC, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aBtnOK ( this, ResId( BTN_OK_VEC, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL_VEC, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP_VEC, *rPara.pResMgr ) ), - aRbOriginal ( this, ResId( RB_ORIGINAL_VEC, *rPara.pResMgr ) ), - aRbSize ( this, ResId( RB_SIZE_VEC, *rPara.pResMgr ) ), - aGrpMode ( this, ResId( GRP_MODE_VEC, *rPara.pResMgr ) ), - aFtSizeX ( this, ResId( FT_SIZEX_VEC, *rPara.pResMgr ) ), - aMtfSizeX ( this, ResId( MTF_SIZEX_VEC, *rPara.pResMgr ) ), - aFtSizeY ( this, ResId( FT_SIZEY_VEC, *rPara.pResMgr ) ), - aMtfSizeY ( this, ResId( MTF_SIZEY_VEC, *rPara.pResMgr ) ), - aGrpSize ( this, ResId( GRP_SIZE_VEC, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ), - aExt ( rPara.aFilterExt ) -{ - aExt.ToUpperAscii(); - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/" ) ); - aFilterConfigPath.Append( aExt ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - String aTitle( aExt ); - FreeResource(); - - aBtnOK.SetClickHdl( LINK( this, DlgExportVec, OK ) ); - aRbOriginal.SetClickHdl( LINK( this, DlgExportVec, ClickRbOriginal ) ); - aRbSize.SetClickHdl( LINK( this, DlgExportVec, ClickRbSize ) ); - - aTitle.ToUpperAscii(); - aTitle += String( ResId( EXPORT_DIALOG_TITLE, *pMgr ) ); - SetText( aTitle ); - - // reading config-parameter - sal_Int32 nMode = pConfigItem->ReadInt32( String( ResId( KEY_MODE, *pMgr ) ), 0 ); - - ::com::sun::star::awt::Size aDefault( 10000, 10000 ); - ::com::sun::star::awt::Size aSize; - aSize = pConfigItem->ReadSize( String( ResId( KEY_SIZE, *pMgr ) ), aDefault ); - - aMtfSizeX.SetDefaultUnit( FUNIT_MM ); - aMtfSizeY.SetDefaultUnit( FUNIT_MM ); - aMtfSizeX.SetValue( aSize.Width ); - aMtfSizeY.SetValue( aSize.Height ); - - switch ( rPara.eFieldUnit ) - { -// case FUNIT_NONE : -// case FUNIT_KM : -// case FUNIT_PERCENT : -// case FUNIT_CUSTOM : -// case FUNIT_MILE : -// case FUNIT_FOOT : - case FUNIT_MM : - case FUNIT_CM : - case FUNIT_M : - case FUNIT_TWIP : - case FUNIT_POINT : - case FUNIT_PICA : - case FUNIT_INCH : - case FUNIT_100TH_MM : - { - aMtfSizeX.SetUnit( rPara.eFieldUnit ); - aMtfSizeY.SetUnit( rPara.eFieldUnit ); - } - break; - default: - break; // -Wall Multiple values not handled. - } - - switch ( nMode ) - { - case 1 : - { - aRbSize.Check( TRUE ); - ClickRbSize( NULL ); - } - break; - - default : - { - aRbOriginal.Check( TRUE ); - ClickRbOriginal( NULL ); - } - break; - } -} - -DlgExportVec::~DlgExportVec() -{ - delete pConfigItem; -} -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportVec, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - ::com::sun::star::awt::Size aSize( - static_cast<long>(MetricField::ConvertDoubleValue( static_cast<double>(aMtfSizeX.GetValue()), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM )), - static_cast<long>(MetricField::ConvertDoubleValue( static_cast<double>(aMtfSizeY.GetValue()), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM )) ); - - sal_Int32 nMode; - if ( aRbSize.IsChecked() ) - nMode = 1; - else - nMode = 0; - - pConfigItem->WriteInt32( String( ResId( KEY_MODE, *pMgr ) ), nMode ); - pConfigItem->WriteSize( String( ResId( KEY_SIZE, *pMgr ) ), aSize ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportVec, ClickRbOriginal, void*, EMPTYARG ) -{ - aGrpSize.Disable(); - aFtSizeX.Disable(); - aMtfSizeX.Disable(); - aFtSizeY.Disable(); - aMtfSizeY.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportVec, ClickRbSize, void*, EMPTYARG ) -{ - aGrpSize.Enable(); - aFtSizeX.Enable(); - aMtfSizeX.Enable(); - aFtSizeY.Enable(); - aMtfSizeY.Enable(); - - return 0; -} - - - diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hrc b/svtools/source/filter.vcl/filter/dlgexpor.hrc deleted file mode 100644 index 69870c9b00b0..000000000000 --- a/svtools/source/filter.vcl/filter/dlgexpor.hrc +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svtools/svtools.hrc> - -#define BTN_OK_PIX 1 -#define BTN_CANCEL_PIX 1 -#define BTN_HELP_PIX 1 -#define CBX_RES_PIX 1 -#define CBX_SIZE_PIX 2 -#define CBX_RLE 3 -#define CBB_RES_PIX 1 -#define LB_COLORS 1 -#define MTF_SIZEX_PIX 1 -#define MTF_SIZEY_PIX 2 -#define FT_SIZEX_PIX 1 -#define FT_SIZEY_PIX 2 -#define GRP_MODE_PIX 1 -#define GRP_COLORS 4 -#define RB_ORIGINAL_PIX 1 -#define RB_RES_PIX 2 -#define RB_SIZE_PIX 3 - -#define BTN_OK_VEC 1 -#define BTN_CANCEL_VEC 1 -#define BTN_HELP_VEC 1 -#define CBX_SIZE_VEC 2 -#define MTF_SIZEX_VEC 1 -#define MTF_SIZEY_VEC 2 -#define FT_SIZEX_VEC 1 -#define FT_SIZEY_VEC 2 -#define GRP_SIZE_VEC 1 -#define GRP_MODE_VEC 2 -#define RB_ORIGINAL_VEC 1 -#define RB_SIZE_VEC 2 diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hxx b/svtools/source/filter.vcl/filter/dlgexpor.hxx deleted file mode 100644 index 8c7b2d462e70..000000000000 --- a/svtools/source/filter.vcl/filter/dlgexpor.hxx +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEXPOR_HXX_ -#define _DLGEXPOR_HXX_ - -#include <svtools/fltcall.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <vcl/lstbox.hxx> - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen bei Pixelformaten -|* -\************************************************************************/ - -class FilterConfigItem; -class DlgExportPix : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - ListBox aLbColors; - CheckBox aCbxRLE; - FixedLine aGrpColors; - - RadioButton aRbOriginal; - RadioButton aRbRes; - RadioButton aRbSize; - FixedText aFtSizeX; - MetricField aMtfSizeX; - FixedText aFtSizeY; - MetricField aMtfSizeY; - FixedLine aGrpMode; - ComboBox aCbbRes; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - String aExt; - - DECL_LINK( OK, void* p ); - DECL_LINK( ClickRbOriginal,void* p ); - DECL_LINK( ClickRbRes,void* p ); - DECL_LINK( ClickRbSize,void* p ); - DECL_LINK( SelectLbColors, void* p ); - -public: - DlgExportPix( FltCallDialogParameter& rPara ); - ~DlgExportPix(); -}; - - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen bei Vektorformaten -|* -\************************************************************************/ -class DlgExportVec : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - RadioButton aRbOriginal; - RadioButton aRbSize; - FixedLine aGrpMode; - - FixedText aFtSizeX; - MetricField aMtfSizeX; - FixedText aFtSizeY; - MetricField aMtfSizeY; - FixedLine aGrpSize; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - String aExt; - - DECL_LINK( OK, void* p ); - DECL_LINK( ClickRbOriginal,void* p ); - DECL_LINK( ClickRbSize,void* p ); - -public: - DlgExportVec( FltCallDialogParameter& rPara ); - ~DlgExportVec(); -}; - -#endif // _DLGEXPOR_HXX_ - diff --git a/svtools/source/filter.vcl/filter/dlgexpor.src b/svtools/source/filter.vcl/filter/dlgexpor.src deleted file mode 100644 index 7573b394d72f..000000000000 --- a/svtools/source/filter.vcl/filter/dlgexpor.src +++ /dev/null @@ -1,315 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "dlgexpor.hrc" - -ModalDialog DLG_EXPORT_PIX -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 178 , 135 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - FixedLine GRP_COLORS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Color resolution" ; - }; - ListBox LB_COLORS - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 98 , 90 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - StringList [ en-US ] = - { - < "Original" ; Default ; > ; - < "1 Bit - Threshold Value" ; Default ; > ; - < "1 Bit - Dithering" ; Default ; > ; - < "4 Bit - Grayscale" ; Default ; > ; - < "4 Bit - Color Palette" ; Default ; > ; - < "8 Bit - Grayscales" ; Default ; > ; - < "8 Bit - Color Palette" ; Default ; > ; - < "24 Bit - True Colors" ; Default ; > ; - }; - }; - CheckBox CBX_RLE - { - Pos = MAP_APPFONT ( 12 , 31 ) ; - Size = MAP_APPFONT ( 98 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "RLE coding" ; - }; - FixedLine GRP_MODE_PIX - { - Pos = MAP_APPFONT ( 6 , 48 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Mode" ; - }; - RadioButton RB_ORIGINAL_PIX - { - Pos = MAP_APPFONT ( 12 , 59 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Original" ; - }; - RadioButton RB_RES_PIX - { - Pos = MAP_APPFONT ( 12 , 73 ) ; - Size = MAP_APPFONT ( 55 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Resolution" ; - }; - ComboBox CBB_RES_PIX - { - Pos = MAP_APPFONT ( 70 , 73 ) ; - Size = MAP_APPFONT ( 40 , 50 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList = - { - "75 DPI" ; - "150 DPI" ; - "300 DPI" ; - "600 DPI" ; - }; - }; - RadioButton RB_SIZE_PIX - { - Pos = MAP_APPFONT ( 12 , 87 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Size" ; - }; - MetricField MTF_SIZEX_PIX - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 101 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - FixedText FT_SIZEX_PIX - { - Pos = MAP_APPFONT ( 18 , 102 ) ; - Size = MAP_APPFONT ( 41 , 10 ) ; - Text [ en-US ] = "Width" ; - }; - MetricField MTF_SIZEY_PIX - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 117 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - FixedText FT_SIZEY_PIX - { - Pos = MAP_APPFONT ( 18 , 118 ) ; - Size = MAP_APPFONT ( 41 , 10 ) ; - Text [ en-US ] = "Height" ; - }; - OKButton BTN_OK_PIX - { - Pos = MAP_APPFONT ( 122 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL_PIX - { - Pos = MAP_APPFONT ( 122 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP_PIX - { - Pos = MAP_APPFONT ( 122 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; -ModalDialog DLG_EXPORT_VEC -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 178 , 89 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - - FixedLine GRP_MODE_VEC - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Mode" ; - }; - RadioButton RB_ORIGINAL_VEC - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Original" ; - }; - RadioButton RB_SIZE_VEC - { - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Size" ; - }; - FixedLine GRP_SIZE_VEC - { - Pos = MAP_APPFONT ( 6 , 44 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Size" ; - }; - FixedText FT_SIZEX_VEC - { - Pos = MAP_APPFONT ( 12 , 56 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "Width" ; - }; - MetricField MTF_SIZEX_VEC - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 55 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - FixedText FT_SIZEY_VEC - { - Pos = MAP_APPFONT ( 12 , 72 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "Height" ; - }; - MetricField MTF_SIZEY_VEC - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 71 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - OKButton BTN_OK_VEC - { - Pos = MAP_APPFONT ( 122 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL_VEC - { - Pos = MAP_APPFONT ( 122 , 24 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP_VEC - { - Pos = MAP_APPFONT ( 122 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/filter.vcl/filter/exportdialog.cxx b/svtools/source/filter.vcl/filter/exportdialog.cxx new file mode 100755 index 000000000000..c04b587b6278 --- /dev/null +++ b/svtools/source/filter.vcl/filter/exportdialog.cxx @@ -0,0 +1,1513 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifndef GCC +# pragma hdrstop +#endif + +#include <tools/ref.hxx> +#include <tools/stream.hxx> +#include <svtools/filter.hxx> +#include <svtools/FilterConfigItem.hxx> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/drawing/XDrawView.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp> +#include <com/sun/star/geometry/AffineMatrix2D.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include <unotools/streamwrap.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/outdev.hxx> +#include <vcl/graph.hxx> +#include <rtl/ustrbuf.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include "exportdialog.hxx" +#include "exportdialog.hrc" + +#define FORMAT_UNKNOWN 0 +#define FORMAT_JPG 1 +#define FORMAT_PNG 2 +#define FORMAT_BMP 3 +#define FORMAT_GIF 4 +#define FORMAT_PBM 5 +#define FORMAT_PGM 6 +#define FORMAT_PPM 7 +#define FORMAT_PCT 8 +#define FORMAT_RAS 9 +#define FORMAT_TIF 10 +#define FORMAT_XPM 11 +#define FORMAT_WMF 12 +#define FORMAT_EMF 13 +#define FORMAT_EPS 14 +#define FORMAT_MET 15 +#define FORMAT_SVG 16 +#define FORMAT_SVM 17 + +#define UNIT_DEFAULT -1 +#define UNIT_INCH 0 +#define UNIT_CM 1 +#define UNIT_MM 2 +#define UNIT_POINT 3 +#define UNIT_PIXEL 4 +#define UNIT_MAX_ID UNIT_PIXEL + +using namespace ::com::sun::star; + +static sal_Int16 GetFilterFormat( String& rExt ) +{ + sal_Int16 nFormat = FORMAT_UNKNOWN; + ByteString aExt( rExt, RTL_TEXTENCODING_UTF8 ); + if ( aExt.Equals( "JPG" ) ) + nFormat = FORMAT_JPG; + else if ( aExt.Equals( "PNG" ) ) + nFormat = FORMAT_PNG; + else if ( aExt.Equals( "BMP" ) ) + nFormat = FORMAT_BMP; + else if ( aExt.Equals( "GIF" ) ) + nFormat = FORMAT_GIF; + else if ( aExt.Equals( "PBM" ) ) + nFormat = FORMAT_PBM; + else if ( aExt.Equals( "PGM" ) ) + nFormat = FORMAT_PGM; + else if ( aExt.Equals( "PPM" ) ) + nFormat = FORMAT_PPM; + else if ( aExt.Equals( "PCT" ) ) + nFormat = FORMAT_PCT; + else if ( aExt.Equals( "RAS" ) ) + nFormat = FORMAT_RAS; + else if ( aExt.Equals( "TIF" ) ) + nFormat = FORMAT_TIF; + else if ( aExt.Equals( "XPM" ) ) + nFormat = FORMAT_XPM; + else if ( aExt.Equals( "WMF" ) ) + nFormat = FORMAT_WMF; + else if ( aExt.Equals( "EMF" ) ) + nFormat = FORMAT_EMF; + else if ( aExt.Equals( "EPS" ) ) + nFormat = FORMAT_EPS; + else if ( aExt.Equals( "MET" ) ) + nFormat = FORMAT_MET; + else if ( aExt.Equals( "SVG" ) ) + nFormat = FORMAT_SVG; + else if ( aExt.Equals( "SVM" ) ) + nFormat = FORMAT_SVM; + return nFormat; +} + +static MapUnit GetMapUnit( sal_Int32 nUnit ) +{ + MapUnit aMapUnit( MAP_PIXEL ); + switch( nUnit ) + { + case UNIT_INCH : aMapUnit = MAP_INCH; break; + case UNIT_CM : aMapUnit = MAP_CM; break; + case UNIT_MM : aMapUnit = MAP_MM; break; + case UNIT_POINT : aMapUnit = MAP_POINT; break; + case UNIT_PIXEL : aMapUnit = MAP_PIXEL; break; + } + return aMapUnit; +} + +sal_Int32 ExportDialog::GetDefaultUnit() +{ + sal_Int32 nDefaultUnit = UNIT_CM; + switch( mrFltCallPara.eFieldUnit ) + { +// case FUNIT_NONE : +// case FUNIT_PERCENT : +// case FUNIT_CUSTOM : + default: nDefaultUnit = UNIT_CM; break; + + case FUNIT_MILE : // PASSTHROUGH INTENDED + case FUNIT_FOOT : + case FUNIT_TWIP : + case FUNIT_PICA : nDefaultUnit = UNIT_INCH; break; + + case FUNIT_KM : // PASSTHROUGH INTENDED + case FUNIT_M : + case FUNIT_100TH_MM : nDefaultUnit = UNIT_CM; break; + + case FUNIT_INCH : nDefaultUnit = UNIT_INCH; break; + case FUNIT_CM : nDefaultUnit = UNIT_CM; break; + case FUNIT_MM : nDefaultUnit = UNIT_MM; break; + case FUNIT_POINT : nDefaultUnit = UNIT_POINT; break; + } + return nDefaultUnit; +} + +static basegfx::B2DRange GetShapeRangeForXShape( const uno::Reference< drawing::XShape >& rxShape, + const uno::Reference< graphic::XPrimitiveFactory2D >& rxPrimitiveFactory2D, const uno::Sequence< beans::PropertyValue >& rViewInformation ) +{ + basegfx::B2DRange aShapeRange; + + const uno::Sequence< beans::PropertyValue > aParams; + const uno::Sequence< uno::Reference< graphic::XPrimitive2D > > aPrimitiveSequence( rxPrimitiveFactory2D->createPrimitivesFromXShape( rxShape, aParams ) ); + + const sal_Int32 nCount = aPrimitiveSequence.getLength(); + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + { + const geometry::RealRectangle2D aRect( aPrimitiveSequence[ nIndex ]->getRange( rViewInformation ) ); + aShapeRange.expand( basegfx::B2DTuple( aRect.X1, aRect.Y1 ) ); + aShapeRange.expand( basegfx::B2DTuple( aRect.X2, aRect.Y2 ) ); + } + return aShapeRange; +} + +uno::Sequence< beans::PropertyValue > ExportDialog::GetFilterData( sal_Bool bUpdateConfig ) +{ + if ( bUpdateConfig ) + { + sal_Int32 nUnit = maLbSizeX.GetSelectEntryPos(); + if ( nUnit < 0 ) + nUnit = UNIT_CM; + + if ( ( mnInitialResolutionUnit == UNIT_DEFAULT ) && ( nUnit == GetDefaultUnit() ) ) + nUnit = UNIT_DEFAULT; + + // updating ui configuration + if ( mbIsPixelFormat ) + { + if ( nUnit > UNIT_MAX_ID ) + nUnit = UNIT_PIXEL; + + sal_Int32 nResolution = maNfResolution.GetValue(); + if ( nResolution < 1 ) + nResolution = 96; + + mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportUnit" ) ), nUnit ); + mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolution" ) ), nResolution ); + mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolutionUnit" ) ), maLbResolution.GetSelectEntryPos() ); + } + else + { + if ( nUnit >= UNIT_PIXEL ) + nUnit = UNIT_CM; + + mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "VectorExportUnit" ) ), nUnit ); + } + } + + FilterConfigItem* pFilterOptions; + if ( bUpdateConfig ) + pFilterOptions = mpFilterOptionsItem; + else + { + uno::Sequence< beans::PropertyValue > aFilterData( mpFilterOptionsItem->GetFilterData() ); + pFilterOptions = new FilterConfigItem( &aFilterData ); + } + + const String sLogicalWidth( String( RTL_CONSTASCII_USTRINGPARAM( "LogicalWidth" ) ) ); + const String sLogicalHeight( String( RTL_CONSTASCII_USTRINGPARAM( "LogicalHeight" ) ) ); + if ( mbIsPixelFormat ) + { + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelWidth" ) ), static_cast< sal_Int32 >( maSize.Width ) ); + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelHeight" ) ), static_cast< sal_Int32 >( maSize.Height ) ); + if ( maResolution.Width && maResolution.Height ) + { + const double f100thmmPerPixelX = 100000.0 / maResolution.Width; + const double f100thmmPerPixelY = 100000.0 / maResolution.Height; + sal_Int32 nLogicalWidth = static_cast< sal_Int32 >( f100thmmPerPixelX * maSize.Width ); + sal_Int32 nLogicalHeight= static_cast< sal_Int32 >( f100thmmPerPixelY * maSize.Height ); + if ( nLogicalWidth && nLogicalHeight ) + { + pFilterOptions->WriteInt32( sLogicalWidth, nLogicalWidth ); + pFilterOptions->WriteInt32( sLogicalHeight, nLogicalHeight ); + } + } + } + else + { + pFilterOptions->WriteInt32( sLogicalWidth, static_cast< sal_Int32 >( maSize.Width ) ); + pFilterOptions->WriteInt32( sLogicalHeight, static_cast< sal_Int32 >( maSize.Height ) ); + } + switch ( mnFormat ) + { + case FORMAT_JPG : + { + sal_Int32 nColor = maLbColorDepth.GetSelectEntryPos(); + if ( nColor == 1 ) + nColor = 0; + else + nColor = 1; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), nColor ); + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), static_cast< sal_Int32 >( maSbCompression.GetThumbPos() ) ); + } + break; + + case FORMAT_PNG : + { + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), static_cast< sal_Int32 >( maSbCompression.GetThumbPos() ) ); + sal_Int32 nInterlace = 0; + if ( maCbInterlaced.IsChecked() ) + nInterlace++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), nInterlace ); + } + break; + + case FORMAT_BMP : + { + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ), maLbColorDepth.GetSelectEntryPos() + 1 ); + pFilterOptions->WriteBool( String( RTL_CONSTASCII_USTRINGPARAM( "RLE_Coding" ) ), maCbRLEEncoding.IsChecked() ); + } + break; + + case FORMAT_GIF : + { + sal_Int32 nValue = 0; + if ( maCbInterlaced.IsChecked() ) + nValue++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), nValue ); + + nValue = 0; + if ( maCbSaveTransparency.IsChecked() ) + nValue++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Translucent" ) ), nValue ); + } + break; + + case FORMAT_PBM : + case FORMAT_PGM : + case FORMAT_PPM : + { + sal_Int32 nFormat = 0; + if ( maRbText.IsChecked() ) + nFormat++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), nFormat ); + } + break; + + case FORMAT_EPS : + { + sal_Int32 nCheck = 0; + if ( maCbEPSPreviewTIFF.IsChecked() ) + nCheck++; + if ( maCbEPSPreviewEPSI.IsChecked() ) + nCheck += 2; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ), nCheck ); + + nCheck = 1; + if ( maRbEPSLevel2.IsChecked() ) + nCheck++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), nCheck ); + + nCheck = 1; + if ( maRbEPSColorFormat2.IsChecked() ) + nCheck++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ), nCheck ); + + nCheck = 1; + if ( maRbEPSCompressionNone.IsChecked() ) + nCheck++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ), nCheck ); + } + break; + } + + uno::Sequence< beans::PropertyValue > aRet( pFilterOptions->GetFilterData() ); + if ( bUpdateConfig == sal_False ) + delete pFilterOptions; + return aRet; +} + +// +awt::Size ExportDialog::GetOriginalSize() +{ + basegfx::B2DRange aShapesRange; + + if ( mxPage.is () ) + { + uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY ); + if ( xPagePropSet.is() ) + { + sal_Int32 nWidth = 0; + sal_Int32 nHeight= 0; + com::sun::star::uno::Any aAny; + aAny = xPagePropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ); + aAny >>= nWidth; + aAny = xPagePropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ); + aAny >>= nHeight; + aShapesRange = basegfx::B2DRange( 0, 0, nWidth, nHeight ); + } + } + else + { + uno::Reference< graphic::XPrimitiveFactory2D > xPrimitiveFactory( + mxMgr->createInstance( String( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.graphic.PrimitiveFactory2D" ) ) ), uno::UNO_QUERY ); + if ( xPrimitiveFactory.is() ) + { + basegfx::B2DHomMatrix aViewTransformation( Application::GetDefaultDevice()->GetViewTransformation() ); + com::sun::star::geometry::AffineMatrix2D aTransformation; + aTransformation.m00 = aViewTransformation.get(0,0); + aTransformation.m01 = aViewTransformation.get(0,1); + aTransformation.m02 = aViewTransformation.get(0,2); + aTransformation.m10 = aViewTransformation.get(1,0); + aTransformation.m11 = aViewTransformation.get(1,1); + aTransformation.m12 = aViewTransformation.get(1,2); + + const rtl::OUString sViewTransformation( RTL_CONSTASCII_USTRINGPARAM( "ViewTransformation" ) ); + uno::Sequence< beans::PropertyValue > aViewInformation( 1 ); + aViewInformation[ 0 ].Value <<= aTransformation; + aViewInformation[ 0 ].Name = sViewTransformation; + + if ( mxShape.is() ) + aShapesRange = GetShapeRangeForXShape( mxShape, xPrimitiveFactory, aViewInformation ); + else if ( mxShapes.is() ) + { + const sal_Int32 nCount = mxShapes->getCount(); + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + { + uno::Reference< drawing::XShape > xShape; + mxShapes->getByIndex( nIndex ) >>= xShape; + aShapesRange.expand( GetShapeRangeForXShape( xShape, xPrimitiveFactory, aViewInformation ) ); + } + } + } + } + return awt::Size( aShapesRange.getWidth(), aShapesRange.getHeight() ); +} + +void ExportDialog::GetGraphicSource() +{ + if ( mxSourceDocument.is() ) + { + uno::Reference< frame::XModel > xModel( mxSourceDocument, uno::UNO_QUERY ); + if ( xModel.is() ) + { + uno::Reference< frame::XController > xController( xModel->getCurrentController() ); + if ( xController.is() ) + { + if ( mbExportSelection ) // check if there is a selection + { + uno::Reference< view::XSelectionSupplier > xSelectionSupplier( xController, uno::UNO_QUERY ); + if ( xSelectionSupplier.is() ) + { + uno::Any aAny( xSelectionSupplier->getSelection() ); + if ( ! ( aAny >>= mxShapes ) ) + aAny >>= mxShape; + } + } + if ( !mxShape.is() && !mxShapes.is() ) + { + uno::Reference< drawing::XDrawView > xDrawView( xController, uno::UNO_QUERY ); + if ( xDrawView.is() ) + { + uno::Reference< drawing::XDrawPage > xCurrentPage( xDrawView->getCurrentPage() ); + if ( xCurrentPage.is() ) + { + mxPage = xCurrentPage; // exporting whole page + } + } + } + } + } + } +} + +sal_Bool ExportDialog::GetGraphicStream() +{ + sal_Bool bRet = sal_False; + + if ( !IsTempExportAvailable() ) + { + delete mpTempStream, mpTempStream = new SvMemoryStream(); + maBitmap = Bitmap(); + return bRet; + } + + sal_Bool bRecreateOutputStream = mpTempStream->Tell() == 0; + + static uno::Sequence< beans::PropertyValue > aOldFilterData; + uno::Sequence< beans::PropertyValue > aNewFilterData( GetFilterData( sal_False ) ); + if ( aOldFilterData != aNewFilterData ) + { + aOldFilterData = aNewFilterData; + bRecreateOutputStream = sal_True; + } + try + { + if ( bRecreateOutputStream ) + { + delete mpTempStream, mpTempStream = new SvMemoryStream(); + maBitmap = Bitmap(); + + uno::Reference < io::XStream > xStream( new utl::OStreamWrapper( *mpTempStream ) ); + uno::Reference < io::XOutputStream > xOutputStream( xStream->getOutputStream() ); + + uno::Reference< document::XExporter > xGraphicExporter( + mxMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicExportFilter") ) ), uno::UNO_QUERY_THROW ); + uno::Reference< document::XFilter > xFilter( xGraphicExporter, uno::UNO_QUERY_THROW ); + + sal_Int32 nProperties = 2; + uno::Sequence< beans::PropertyValue > aFilterData( nProperties ); + + + rtl::OUString sFormat( maExt ); + uno::Sequence< beans::PropertyValue > aDescriptor( 3 ); + aDescriptor[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OutputStream") ); + aDescriptor[0].Value <<= xOutputStream; + aDescriptor[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FilterName") ); + aDescriptor[1].Value <<= sFormat; + aDescriptor[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FilterData") ); + aDescriptor[2].Value <<= aNewFilterData; + + uno::Reference< lang::XComponent > xSourceDoc; + if ( mxPage.is() ) + xSourceDoc = uno::Reference< lang::XComponent >( mxPage, uno::UNO_QUERY_THROW ); + else if ( mxShapes.is() ) + xSourceDoc = uno::Reference< lang::XComponent >( mxShapes, uno::UNO_QUERY_THROW ); + else if ( mxShape.is() ) + xSourceDoc = uno::Reference< lang::XComponent >( mxShape, uno::UNO_QUERY_THROW );; + if ( xSourceDoc.is() ) + { + xGraphicExporter->setSourceDocument( xSourceDoc ); + xFilter->filter( aDescriptor ); + bRet = sal_True; + + if ( mnFormat == FORMAT_JPG ) + { + mpTempStream->Seek( STREAM_SEEK_TO_BEGIN ); + maBitmap = GetGraphicBitmap( *mpTempStream ); + mpTempStream->Seek( STREAM_SEEK_TO_END ); + } + } + } + else + bRet = sal_True; + } + catch( uno::Exception& ) + { + + // ups + + } + return bRet; +} + +Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream ) +{ + Bitmap aRet; + Graphic aGraphic; + GraphicFilter aFilter( sal_False ); + if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, NULL ) == GRFILTER_OK ) + { + aRet = aGraphic.GetBitmap(); + } + return aRet; +} + +sal_uInt32 ExportDialog::GetRawFileSize() const +{ + sal_uInt64 nRawFileSize = 0; + if ( mbIsPixelFormat ) + { + sal_Int32 nBitsPerPixel = 24; + String aEntry( maLbColorDepth.GetSelectEntry() ); + if ( ms1BitTreshold == aEntry ) + nBitsPerPixel = 1; + else if ( ms1BitDithered == aEntry ) + nBitsPerPixel = 1; + else if ( ms4BitGrayscale == aEntry ) + nBitsPerPixel = 4; + else if ( ms4BitColorPalette == aEntry ) + nBitsPerPixel = 8; + else if ( ms8BitGrayscale == aEntry ) + nBitsPerPixel = 8; + else if ( ms8BitColorPalette == aEntry ) + nBitsPerPixel = 8; + else if ( ms24BitColor == aEntry ) + nBitsPerPixel = 24; + + if ( mbIsPixelFormat ) + { + nRawFileSize = ( maSize.Width * nBitsPerPixel + 7 ) &~ 7; // rounding up to 8 bits + nRawFileSize /= 8; // in bytes + nRawFileSize *= maSize.Height; + } + if ( nRawFileSize > SAL_MAX_UINT32 ) + nRawFileSize = 0; + } + return static_cast< sal_uInt32 >( nRawFileSize ); +} + +// checks if the source dimension/resolution is not too big +// to determine the exact graphic output size and preview for jpg +sal_Bool ExportDialog::IsTempExportAvailable() const +{ + return GetRawFileSize() < static_cast< sal_uInt32 >( mnMaxFilesizeForRealtimePreview ); +} + +ExportDialog::ExportDialog( FltCallDialogParameter& rPara, + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > rxMgr, + const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxSourceDocument, + sal_Bool bExportSelection, sal_Bool bIsPixelFormat ) : + ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT, *rPara.pResMgr ) ), + mrFltCallPara ( rPara ), + mpMgr ( rPara.pResMgr ), + mxMgr ( rxMgr ), + mxSourceDocument ( rxSourceDocument ), + maFlExportSize ( this, ResId( FL_EXPORT_SIZE, *rPara.pResMgr ) ), + maFtSizeX ( this, ResId( FT_SIZEX, *rPara.pResMgr ) ), + maMfSizeX ( this, ResId( MF_SIZEX, *rPara.pResMgr ) ), + maLbSizeX ( this, ResId( LB_SIZEX, *rPara.pResMgr ) ), + maFtSizeY ( this, ResId( FT_SIZEY, *rPara.pResMgr ) ), + maMfSizeY ( this, ResId( MF_SIZEY, *rPara.pResMgr ) ), + maLbSizeY ( this, ResId( LB_SIZEY, *rPara.pResMgr ) ), + maFtResolution ( this, ResId( FT_RESOLUTION, *rPara.pResMgr ) ), + maNfResolution ( this, ResId( NF_RESOLUTION, *rPara.pResMgr ) ), + maLbResolution ( this, ResId( LB_RESOLUTION, *rPara.pResMgr ) ), + maFlColorDepth ( this, ResId( FL_COLOR_DEPTH, *rPara.pResMgr ) ), + maLbColorDepth ( this, ResId( LB_COLOR_DEPTH, *rPara.pResMgr ) ), + maFlJPGQuality ( this, ResId( FL_JPG_QUALITY, *rPara.pResMgr ) ), + maFlMode ( this, ResId( FL_MODE, *rPara.pResMgr ) ), + maFlPBMOptions ( this, ResId( FL_PBM_OPTIONS, *rPara.pResMgr ) ), + maSbCompression ( this, ResId( SB_COMPRESSION, *rPara.pResMgr ) ), + maNfCompression ( this, ResId( NF_COMPRESSION, *rPara.pResMgr ) ), + maFtJPGMin ( this, ResId( FT_JPG_MIN, *rPara.pResMgr ) ), + maFtJPGMax ( this, ResId( FT_JPG_MAX, *rPara.pResMgr ) ), + maFtPNGMin ( this, ResId( FT_PNG_MIN, *rPara.pResMgr ) ), + maFtPNGMax ( this, ResId( FT_PNG_MAX, *rPara.pResMgr ) ), + maCbJPGPreview ( this, ResId( CB_JPG_PREVIEW, *rPara.pResMgr ) ), + maCbInterlaced ( this, ResId( CB_INTERLACED, *rPara.pResMgr ) ), + maCbRLEEncoding ( this, ResId( CB_RLE_ENCODING, *rPara.pResMgr ) ), + maFlGIFDrawingObjects ( this, ResId( FL_GIF_DRAWING_OBJECTS, *rPara.pResMgr ) ), + maCbSaveTransparency ( this, ResId( CB_SAVE_TRANSPARENCY, *rPara.pResMgr ) ), + maRbBinary ( this, ResId( RB_BINARY, *rPara.pResMgr ) ), + maRbText ( this, ResId( RB_TEXT, *rPara.pResMgr ) ), + maFlEPSPreview ( this, ResId( FL_EPS_PREVIEW, *rPara.pResMgr ) ), + maCbEPSPreviewTIFF ( this, ResId( CB_EPS_PREVIEW_TIFF, *rPara.pResMgr ) ), + maCbEPSPreviewEPSI ( this, ResId( CB_EPS_PREVIEW_EPSI, *rPara.pResMgr ) ), + maFlEPSVersion ( this, ResId( FL_EPS_VERSION, *rPara.pResMgr ) ), + maRbEPSLevel1 ( this, ResId( RB_EPS_LEVEL1, *rPara.pResMgr ) ), + maRbEPSLevel2 ( this, ResId( RB_EPS_LEVEL2, *rPara.pResMgr ) ), + maFlEPSColorFormat ( this, ResId( FL_EPS_COLOR_FORMAT, *rPara.pResMgr ) ), + maRbEPSColorFormat1 ( this, ResId( RB_EPS_COLOR_FORMAT1, *rPara.pResMgr ) ), + maRbEPSColorFormat2 ( this, ResId( RB_EPS_COLOR_FORMAT2, *rPara.pResMgr ) ), + maFlCompression ( this, ResId( FL_COMPRESSION, *rPara.pResMgr ) ), + maRbEPSCompressionLZW ( this, ResId( RB_EPS_COMPRESSION_LZW, *rPara.pResMgr ) ), + maRbEPSCompressionNone ( this, ResId( RB_EPS_COMPRESSION_NONE, *rPara.pResMgr ) ), + maFlEstimatedSize ( this, ResId( FL_ESTIMATED_SIZE, *rPara.pResMgr ) ), + maFtEstimatedSize ( this, ResId( FT_ESTIMATED_SIZE, *rPara.pResMgr ) ), + msEstimatedSizePix1 ( ResId( STR_ESTIMATED_SIZE_PIX_1, *rPara.pResMgr ) ), + msEstimatedSizePix2 ( ResId( STR_ESTIMATED_SIZE_PIX_2, *rPara.pResMgr ) ), + msEstimatedSizeVec ( ResId( STR_ESTIMATED_SIZE_VEC, *rPara.pResMgr ) ), + maFlButtons ( this, ResId( FL_BUTTONS, *rPara.pResMgr ) ), + maFbJPGPreview ( this, ResId( FB_JPG_PREVIEW, *rPara.pResMgr ) ), + maSbZoom ( this, ResId( SB_ZOOM, *rPara.pResMgr ) ), + maNfZoom ( this, ResId( NF_ZOOM, *rPara.pResMgr ) ), + maSbJPGPreviewHorz ( this, ResId( SB_JPG_PREVIEW_HORZ, *rPara.pResMgr ) ), + maSbJPGPreviewVert ( this, ResId( SB_JPG_PREVIEW_VERT, *rPara.pResMgr ) ), + maBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), + maBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), + maBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), + ms1BitTreshold ( ResId( STR_1BIT_THRESHOLD, *rPara.pResMgr ) ), + ms1BitDithered ( ResId( STR_1BIT_DITHERED, *rPara.pResMgr ) ), + ms4BitGrayscale ( ResId( STR_4BIT_GRAYSCALE, *rPara.pResMgr ) ), + ms4BitColorPalette ( ResId( STR_4BIT_COLOR_PALETTE, *rPara.pResMgr ) ), + ms8BitGrayscale ( ResId( STR_8BIT_GRAYSCALE, *rPara.pResMgr ) ), + ms8BitColorPalette ( ResId( STR_8BIT_COLOR_PALETTE, *rPara.pResMgr ) ), + ms24BitColor ( ResId( STR_24BIT_TRUE_COLOR, *rPara.pResMgr ) ), + maExt ( rPara.aFilterExt ), + mnFormat ( FORMAT_UNKNOWN ), + mnMaxFilesizeForRealtimePreview( 0 ), + mpTempStream ( new SvMemoryStream() ), + maOriginalSize ( awt::Size( 0, 0 ) ), + mbPreview ( sal_False ), + mbIsPixelFormat ( bIsPixelFormat ), + mbExportSelection ( bExportSelection ), + mbPreserveAspectRatio ( sal_True ) +{ + GetGraphicSource(); + + maExt.ToUpperAscii(); + + String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/" ) ); + mpOptionsItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + aFilterConfigPath.Append( maExt ); + mpFilterOptionsItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + + mnInitialResolutionUnit = mbIsPixelFormat + ? mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportUnit" ) ), UNIT_DEFAULT ) + : mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "VectorExportUnit" ) ), UNIT_DEFAULT ); + + mnMaxFilesizeForRealtimePreview = mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "MaxFilesizeForRealtimePreview" ) ), 0 ); + maFtEstimatedSize.SetText( String( RTL_CONSTASCII_USTRINGPARAM( " \n " ) ) ); + + String aTitle( maExt ); + aTitle += String( ResId( DLG_EXPORT_TITLE, *mpMgr ) ); + SetText( aTitle ); + + mnFormat = GetFilterFormat( maExt ); + + Size aResolution( Application::GetDefaultDevice()->LogicToPixel( Size( 100, 100 ), MAP_CM ) ); + maResolution.Width = aResolution.Width(); + maResolution.Height= aResolution.Height(); + maOriginalSize = GetOriginalSize(); + if ( bIsPixelFormat ) + { + double fPixelsPer100thmm = static_cast< double >( maResolution.Width ) / 100000.0; + maSize = awt::Size( static_cast< sal_Int32 >( ( fPixelsPer100thmm * maOriginalSize.Width ) + 0.5 ), + static_cast< sal_Int32 >( ( fPixelsPer100thmm * maOriginalSize.Height ) + 0.5 ) ); + } + else + { + maSize = maOriginalSize; + } + + // Size + maLbSizeX.SetSelectHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maSbCompression.SetScrollHdl( LINK( this, ExportDialog, SbCompressionUpdateHdl ) ); + maNfCompression.SetModifyHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maMfSizeX.SetModifyHdl( LINK( this, ExportDialog, UpdateHdlMtfSizeX ) ); + maMfSizeY.SetModifyHdl( LINK( this, ExportDialog, UpdateHdlMtfSizeY ) ); + + maNfResolution.SetModifyHdl( LINK( this, ExportDialog, UpdateHdlNfResolution ) ); + maLbResolution.SetSelectHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maLbColorDepth.SetSelectHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maCbInterlaced.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maCbSaveTransparency.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maCbEPSPreviewTIFF.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maCbEPSPreviewEPSI.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maRbEPSCompressionLZW.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maRbEPSCompressionNone.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maRbBinary.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maRbText.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + + // JPG Preview +// maCbJPGPreview.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); +maCbJPGPreview.Enable( sal_False ); + + maSbJPGPreviewVert.SetScrollHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maSbJPGPreviewHorz.SetScrollHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maSbZoom.SetScrollHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + // BMP + maCbRLEEncoding.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + // EPS + maRbEPSLevel1.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maRbEPSLevel2.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maBtnOK.SetClickHdl( LINK( this, ExportDialog, OK ) ); + + setupLayout(); + updateControls(); + + FreeResource(); +} + +void ExportDialog::createSizeControls( vcl::RowOrColumn& rLayout ) +{ + size_t nIndex; + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + long nIndent = aBorder.Width(); + + // Size controls + rLayout.addWindow( &maFlExportSize ); + + Size aLbMax( maLbSizeX.GetSizePixel() ); + aLbMax.Width() = Max( aLbMax.Width(), maLbResolution.GetSizePixel().Width() ); + + boost::shared_ptr< vcl::LabelColumn > xSizeColumns( new vcl::LabelColumn( &rLayout ) ); + rLayout.addChild( xSizeColumns ); + + // row 1 + boost::shared_ptr< vcl::RowOrColumn > xColumn( new vcl::RowOrColumn( xSizeColumns.get(), false ) ); + xSizeColumns->addRow( &maFtSizeX, xColumn, nIndent ); + Size aMinSize( maMfSizeX.GetSizePixel() ); + nIndex = xColumn->addWindow( &maMfSizeX ); + xColumn->setMinimumSize( nIndex, aMinSize ); + nIndex = xColumn->addWindow( &maLbSizeX ); + xColumn->setMinimumSize( nIndex, aLbMax ); + + // row 2 + xColumn = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xSizeColumns.get(), false ) ); + xSizeColumns->addRow( &maFtSizeY, xColumn, nIndent ); + nIndex = xColumn->addWindow( &maMfSizeY ); + xColumn->setMinimumSize( nIndex, aMinSize ); + nIndex = xColumn->addWindow( &maLbSizeY ); + xColumn->setMinimumSize( nIndex, aLbMax ); + + // row 3 + if ( mbIsPixelFormat ) // TODO: (metafileresolutionsupport) + { + xColumn = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xSizeColumns.get(), false ) ); + xSizeColumns->addRow( &maFtResolution, xColumn, nIndent ); + nIndex = xColumn->addWindow( &maNfResolution ); + xColumn->setMinimumSize( nIndex, aMinSize ); + nIndex = xColumn->addWindow( &maLbResolution ); + xColumn->setMinimumSize( nIndex, aLbMax ); + } + + sal_Int32 nUnit = mnInitialResolutionUnit; + if ( nUnit == UNIT_DEFAULT ) + nUnit = GetDefaultUnit(); + + if ( !mbIsPixelFormat ) + { + maLbSizeX.RemoveEntry( UNIT_PIXEL ); // removing pixel + if ( nUnit >= UNIT_PIXEL ) + nUnit = UNIT_CM; + } + else if ( nUnit > UNIT_MAX_ID ) + nUnit = UNIT_PIXEL; + if ( nUnit < 0 ) + nUnit = UNIT_CM; + maLbSizeX.SelectEntryPos( static_cast< USHORT >( nUnit ) ); + + if ( mbIsPixelFormat ) // TODO: (metafileresolutionsupport) should be supported for vector formats also... this makes + { // sense eg for bitmap fillings in metafiles, to preserve high dpi output + // (atm without special vector support the bitmaps are rendered with 96dpi) + sal_Int32 nResolution = mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolution" ) ), 96 ); + if ( nResolution < 1 ) + nResolution = 96; + maNfResolution.SetValue( nResolution ); + + sal_Int32 nResolutionUnit = mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolutionUnit" ) ), 1 ); + if ( ( nResolutionUnit < 0 ) || ( nResolutionUnit > 2 ) ) + nResolutionUnit = 1; + maLbResolution.SelectEntryPos( static_cast< USHORT >( nResolutionUnit ) ); + } + + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); +} + +void ExportDialog::createColorDepthControls( vcl::RowOrColumn& rLayout ) +{ + // Color Depth + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + long nIndent = aBorder.Width(); + + boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &rLayout, false ) ); + rLayout.addChild( xRow ); + xRow->addWindow( &maFlColorDepth ); + + xRow = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( &rLayout, false ) ); + rLayout.addChild( xRow ); + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + xRow->addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maLbColorDepth ); + + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); +} + +void ExportDialog::createScrollBar( vcl::RowOrColumn& rLayout ) +{ + boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &rLayout, false ) ); + rLayout.addChild( xRow ); + + Size aMinSize( maSbCompression.GetSizePixel() ); + size_t nIndex = xRow->addWindow( &maSbCompression ); + xRow->setMinimumSize( nIndex, aMinSize ); + aMinSize = maNfCompression.GetSizePixel(); + nIndex = xRow->addWindow( &maNfCompression ); + xRow->setMinimumSize( nIndex, aMinSize ); +} + +void ExportDialog::createFilterOptions( vcl::RowOrColumn& rLayout ) +{ + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + long nIndent = aBorder.Width(); + + switch( mnFormat ) + { + case FORMAT_JPG : + { + sal_Int32 nColor = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), 0 ); + if ( nColor == 1 ) + nColor = 0; + else + nColor = 1; + maLbColorDepth.InsertEntry( ms8BitGrayscale ); + maLbColorDepth.InsertEntry( ms24BitColor ); + maLbColorDepth.SelectEntryPos( nColor ); + createColorDepthControls( maLayout ); + + rLayout.addWindow( &maFlJPGQuality ); + + // Quality + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + createScrollBar( *xRows.get() ); + xRows->addWindow( &maFtJPGMin ); + xRows->addWindow( &maFtJPGMax ); + if ( maCbJPGPreview.IsEnabled() ) + xRows->addWindow( &maCbJPGPreview ); + + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + sal_Int32 nQuality = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), 75 ); + if ( ( nQuality < 1 ) || ( nQuality > 100 ) ) + nQuality = 75; + + maSbCompression.SetRangeMin( 1 ); + maSbCompression.SetRangeMax( 100 ); + maNfCompression.SetMin( 1 ); + maNfCompression.SetMax( 100 ); + maNfCompression.SetValue( nQuality ); + maNfCompression.SetStrictFormat( sal_True ); + if ( maCbJPGPreview.IsEnabled() ) + maCbJPGPreview.Check( sal_False ); + } + break; + case FORMAT_PNG : + { + rLayout.addWindow( &maFlCompression ); + + // Compression 1..9 + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + createScrollBar( *xRows.get() ); + xRows->addWindow( &maFtPNGMin ); + xRows->addWindow( &maFtPNGMax ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + // Interlaced + rLayout.addWindow( &maFlMode ); + xIndenter.reset( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + xRows.reset( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbInterlaced ); + + xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + sal_Int32 nCompression = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), 6 ); + if ( ( nCompression < 1 ) || ( nCompression > 9 ) ) + nCompression = 6; + maSbCompression.SetRangeMin( 1 ); + maSbCompression.SetRangeMax( 9 ); + maNfCompression.SetMin( 1 ); + maNfCompression.SetMax( 9 ); + maNfCompression.SetValue( 9 ); + maNfCompression.SetStrictFormat( sal_True ); + + maCbInterlaced.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 0 ) != 0 ); + } + break; + case FORMAT_BMP : + { + sal_Int32 nColor = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ), 0 ); + if ( nColor == 0 ) + nColor = 6; + else + nColor--; + maLbColorDepth.InsertEntry( ms1BitTreshold ); + maLbColorDepth.InsertEntry( ms1BitDithered ); + maLbColorDepth.InsertEntry( ms4BitGrayscale ); + maLbColorDepth.InsertEntry( ms4BitColorPalette ); + maLbColorDepth.InsertEntry( ms8BitGrayscale ); + maLbColorDepth.InsertEntry( ms8BitColorPalette ); + maLbColorDepth.InsertEntry( ms24BitColor ); + maLbColorDepth.SelectEntryPos( nColor ); + createColorDepthControls( maLayout ); + + rLayout.addWindow( &maFlCompression ); + // RLE coding + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbRLEEncoding ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + maCbRLEEncoding.Check( mpFilterOptionsItem->ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "RLE_Coding" ) ), sal_True ) ); + } + break; + case FORMAT_GIF : + { + rLayout.addWindow( &maFlMode ); + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbInterlaced ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + rLayout.addWindow( &maFlGIFDrawingObjects ); + xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbSaveTransparency ); + xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + maCbInterlaced.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 1 ) != 0 ); + maCbSaveTransparency.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Translucent" ) ), 1 ) != 0 ); + } + break; + case FORMAT_PBM : + case FORMAT_PGM : + case FORMAT_PPM : + { + rLayout.addWindow( &maFlJPGQuality ); + + // RB Binary / Text + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maRbBinary ); + xRows->addWindow( &maRbText ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + sal_Int32 nFormat = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), 1 ); + maRbBinary.Check( nFormat == 0 ); + maRbText.Check( nFormat != 0 ); + } + break; + case FORMAT_EPS : + { + boost::shared_ptr< vcl::RowOrColumn > xColumns( new vcl::RowOrColumn( &rLayout, false ) ); + rLayout.addChild( xColumns ); + boost::shared_ptr< vcl::RowOrColumn > xLeft( new vcl::RowOrColumn( &rLayout, true ) ); + xColumns->addChild( xLeft ); + + xLeft->addWindow( &maFlEPSPreview ); + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( xLeft.get(), nIndent ) ); + xLeft->addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( xLeft.get(), true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbEPSPreviewTIFF ); + xRows->addWindow( &maCbEPSPreviewEPSI ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( xLeft.get(), 2 ) ); + xLeft->addChild( xSpacer ); + + xLeft->addWindow( &maFlEPSVersion ); + xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( xLeft.get(), nIndent ) ); + xLeft->addChild( xIndenter ); + xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xLeft.get(), true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maRbEPSLevel1 ); + xRows->addWindow( &maRbEPSLevel2 ); + xSpacer.reset( new vcl::Spacer( xLeft.get(), 2 ) ); + xLeft->addChild( xSpacer ); + + boost::shared_ptr< vcl::RowOrColumn > xRight( new vcl::RowOrColumn( &rLayout, true ) ); + xColumns->addChild( xRight ); + + xRight->addWindow( &maFlEPSColorFormat ); + xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( xRight.get(), nIndent ) ); + xRight->addChild( xIndenter ); + xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xRight.get(), true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maRbEPSColorFormat1 ); + xRows->addWindow( &maRbEPSColorFormat2 ); + xSpacer.reset( new vcl::Spacer( xRight.get(), 2 ) ); + xRight->addChild( xSpacer ); + + xRight->addWindow( &maFlCompression ); + xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( xRight.get(), nIndent ) ); + xRight->addChild( xIndenter ); + xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xRight.get(), true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maRbEPSCompressionLZW ); + xRows->addWindow( &maRbEPSCompressionNone ); + + xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + sal_Int32 nPreview = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ), 0 ); + sal_Int32 nVersion = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), 2 ); + sal_Int32 nColor = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ), 0 ); + sal_Int32 nCompr = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ), 2 ); + + mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "TextMode" ) ), 0 ); + + maCbEPSPreviewTIFF.Check( ( nPreview & 1 ) != 0 ); + maCbEPSPreviewEPSI.Check( ( nPreview & 2 ) != 0 ); + + maRbEPSLevel1.Check( nVersion == 1 ); + maRbEPSLevel2.Check( nVersion == 2 ); + + maRbEPSColorFormat1.Check( nColor == 1 ); + maRbEPSColorFormat2.Check( nColor != 1 ); + + maRbEPSCompressionLZW.Check( nCompr == 1 ); + maRbEPSCompressionNone.Check( nCompr != 1 ); + } + break; + } +} + +void ExportDialog::createButtons( vcl::RowOrColumn& rLayout ) +{ + rLayout.addWindow( &maFlButtons ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + + boost::shared_ptr< vcl::RowOrColumn > xButtons( new vcl::RowOrColumn( &rLayout, false ) ); + size_t nIndex = rLayout.addChild( xButtons ); + rLayout.setBorders( nIndex, aBorder.Width(), 0, aBorder.Width(), aBorder.Width() ); + + Size aMinSize( maBtnCancel.GetSizePixel() ); + // insert help button + xButtons->setMinimumSize( xButtons->addWindow( &maBtnHelp ), aMinSize ); + + // insert a spacer, cancel and OK buttons are right aligned + + xSpacer.reset( new vcl::Spacer( xButtons.get(), 2 ) ); + xButtons->addChild( xSpacer ); + xButtons->setMinimumSize( xButtons->addWindow( &maBtnOK ), aMinSize ); + xButtons->setMinimumSize( xButtons->addWindow( &maBtnCancel ), aMinSize ); +} + +void ExportDialog::setupLayout() +{ + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + maLayout.setParentWindow( this ); + maLayout.setOuterBorder( aBorder.Width() ); + + createSizeControls( maLayout ); + createFilterOptions( maLayout ); + + if ( mnMaxFilesizeForRealtimePreview || mbIsPixelFormat ) + { + maLayout.addWindow( &maFlEstimatedSize ); + maLayout.addWindow( &maFtEstimatedSize ); + } + createButtons( maLayout ); + + maLayout.show(); + maDialogSize = maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ); + maLayout.setManagedArea( Rectangle( Point(), maDialogSize ) ); + SetOutputSizePixel( Size( mbPreview ? maDialogSize.Width() * 2 : maDialogSize.Width(), maDialogSize.Height() ) ); + + maRectFlButtons = Rectangle( maFlButtons.GetPosPixel(), maFlButtons.GetSizePixel() ); + maRectBtnHelp = Rectangle( maBtnHelp.GetPosPixel(), maBtnHelp.GetSizePixel() ); + maRectBtnOK = Rectangle( maBtnOK.GetPosPixel(), maBtnOK.GetSizePixel() ); + maRectBtnCancel = Rectangle( maBtnCancel.GetPosPixel(), maBtnOK.GetSizePixel() ); + + maLbSizeY.Hide(); +} + +static rtl::OUString ImpValueOfInKB( const sal_Int64& rVal ) +{ + double fVal( static_cast<double>( rVal ) ); + fVal /= ( 1 << 10 ); + fVal += 0.05; + rtl::OUStringBuffer aVal( rtl::OUString::valueOf( fVal ) ); + sal_Int32 nX( rtl::OUString( aVal.getStr() ).indexOf( '.', 0 ) ); + if ( nX > 0 ) + aVal.setLength( nX + 2 ); + return aVal.makeStringAndClear(); +} + +sal_Int32 static GetZoomValueFromThumbPos( sal_Int32 nThumbPos ) +{ + sal_Int32 nProz = 0; + if ( nThumbPos <= 50 ) + nProz = nThumbPos * 2; // so a range of 50 represents 100% + else + nProz = ( ( nThumbPos - 50 ) * 60 ) + 100; // we want to scale up to 3000% + return nProz; +} + +void ExportDialog::updatePreview() +{ + // JPG +// maCbJPGPreview.Enable( IsTempExportAvailable() ); + +// if ( maCbJPGPreview.IsEnabled() && maCbJPGPreview.IsChecked() ) + if ( mbPreview ) + { + long nScrollBarSize = Application::GetSettings().GetStyleSettings().GetScrollBarSize(); + + Point aPreviewPos( maDialogSize.Width(), 0 ); + Size aPreviewSize( maDialogSize.Width(), maFlButtons.GetPosPixel().Y() ); + + Point aFixedBitmapPos( aPreviewPos ); + Size aFixedBitmapSize( aPreviewSize ); + + maSbZoom.Show( sal_False ); + maSbZoom.SetPosPixel( Point( aPreviewPos.X(), aPreviewPos.Y() ) ); + maSbZoom.SetSizePixel( Size( aPreviewSize.Width() / 4, nScrollBarSize ) ); + maNfZoom.Show( sal_False ); + maNfZoom.SetPosPixel( Point( aPreviewPos.X() + aPreviewSize.Width() / 4, aPreviewPos.Y() ) ); + maNfZoom.SetSizePixel( Size( aPreviewSize.Width() / 6, nScrollBarSize ) ); + maNfZoom.SetValue( GetZoomValueFromThumbPos( maSbZoom.GetThumbPos() ) ); + maFbJPGPreview.Show( sal_True ); + + sal_Int32 nZoom = GetZoomValueFromThumbPos( maSbZoom.GetThumbPos() ); + double fSizePixelX = static_cast< double >( maSize.Width * nZoom ) / 100.0; + double fSizePixelY = static_cast< double >( maSize.Height * nZoom ) / 100.0; + + double fXRatio = fSizePixelX / maSize.Width; // the size of each pixel + double fYRatio = fSizePixelY / maSize.Height; + + sal_Bool bHorzSb = fSizePixelX > aFixedBitmapSize.Width(); + sal_Bool bVertSb = fSizePixelY > aFixedBitmapSize.Height(); + if ( bHorzSb ) + { + aFixedBitmapSize.Height() -= nScrollBarSize; + + maSbJPGPreviewHorz.Show( sal_True ); + maSbJPGPreviewHorz.SetPosPixel( Point( aFixedBitmapPos.X(), aFixedBitmapPos.Y() + aFixedBitmapSize.Height() ) ); + maSbJPGPreviewHorz.SetSizePixel( Size( aFixedBitmapSize.Width(), nScrollBarSize ) ); + } + else + { + maSbJPGPreviewHorz.Show( sal_False ); + } + + + if ( bVertSb ) + { + aFixedBitmapSize.Width() -= nScrollBarSize; + + maSbJPGPreviewVert.Show( sal_True ); + maSbJPGPreviewVert.SetPosPixel( Point( aFixedBitmapPos.X() + aFixedBitmapSize.Width(), aFixedBitmapPos.Y() ) ); + maSbJPGPreviewVert.SetSizePixel( Size( nScrollBarSize, aFixedBitmapSize.Height() ) ); + } + else + { + maSbJPGPreviewVert.Show( sal_False ); + } + + Point aPos( 0, 0 ); + Size aSize; + if ( fXRatio > 1.0 ) + { + aSize.Width() = maSize.Width > aFixedBitmapSize.Width() ? maSize.Width : aFixedBitmapSize.Width(); + aSize.Width() /= fXRatio; + } + else + { + aSize.Width() = maSize.Width < aFixedBitmapSize.Width() ? maSize.Width : aFixedBitmapSize.Width(); + aSize.Width() /= fXRatio; + } + + if ( fYRatio > 1.0 ) + { + aSize.Height() = maSize.Height > aFixedBitmapSize.Height() ? maSize.Height : aFixedBitmapSize.Height(); + aSize.Height() /= fYRatio; + } + else + { + aSize.Height() = maSize.Height < aFixedBitmapSize.Height() ? maSize.Height : aFixedBitmapSize.Height(); + aSize.Height() /= fYRatio; + } + + if ( aSize.Width() < maSize.Width ) + { + sal_Int32 nXDiff = static_cast< sal_Int32 >( ( ( ( maSize.Width - aSize.Width() ) * maSbJPGPreviewHorz.GetThumbPos() ) / 100.0 ) ); + aPos.X() += nXDiff; + } + if ( aSize.Height() < maSize.Height ) + { + sal_Int32 nYDiff = static_cast< sal_Int32 >( ( ( ( maSize.Height - aSize.Height() ) * maSbJPGPreviewVert.GetThumbPos() ) / 100.0 ) ); + aPos.Y() += nYDiff; + } + + Bitmap aCroppedBitmap( maBitmap ); + aCroppedBitmap.Crop( Rectangle( aPos, aSize ) ); + aSize = aCroppedBitmap.GetSizePixel(); + aSize = Size( aSize.Width() * fXRatio, aSize.Height() * fYRatio ); + aCroppedBitmap.Scale( aSize ); + + if ( aSize.Width() > aFixedBitmapSize.Width() ) + aSize.Width() = aFixedBitmapSize.Width(); + if ( aSize.Height() > aFixedBitmapSize.Height() ) + aSize.Height() = aFixedBitmapSize.Height(); + Point aPoint( aFixedBitmapPos ); + if ( aSize.Width() < aFixedBitmapSize.Width() ) + aPoint.X() += ( aFixedBitmapSize.Width() - aSize.Width() ) / 2; + if ( aSize.Height() < aFixedBitmapSize.Height() ) + aPoint.Y() += ( aFixedBitmapSize.Height() - aSize.Height() ) / 2; + + maFbJPGPreview.SetPosPixel( aPoint ); + maFbJPGPreview.SetSizePixel( aSize ); + maFbJPGPreview.SetBitmap( aCroppedBitmap ); + + SetOutputSizePixel( Size( maDialogSize.Width() * 2, maDialogSize.Height() ) ); + + maFlButtons.SetSizePixel( Size( maRectFlButtons.GetWidth() * 2, maRectFlButtons.GetHeight() ) ); + maBtnHelp.SetPosPixel( Point( maRectBtnHelp.Left() + maDialogSize.Width(), maRectBtnHelp.Top() ) ); + maBtnOK.SetPosPixel( Point( maRectBtnOK.Left() + maDialogSize.Width(), maRectBtnOK.Top() ) ); + maBtnCancel.SetPosPixel( Point( maRectBtnCancel.Left() + maDialogSize.Width(), maRectBtnCancel.Top() ) ); + } + else + { + maSbZoom.Show( sal_False ); + maNfZoom.Show( sal_False ); + maFbJPGPreview.Show( sal_False ); + maSbJPGPreviewHorz.Show( sal_False ); + maSbJPGPreviewVert.Show( sal_False ); + + SetOutputSizePixel( maDialogSize ); + + maFlButtons.SetSizePixel( Size( maRectFlButtons.GetWidth(), maRectFlButtons.GetHeight() ) ); + maBtnHelp.SetPosPixel( Point( maRectBtnHelp.Left(), maRectBtnHelp.Top() ) ); + maBtnOK.SetPosPixel( Point( maRectBtnOK.Left(), maRectBtnOK.Top() ) ); + maBtnCancel.SetPosPixel( Point( maRectBtnCancel.Left(), maRectBtnCancel.Top() ) ); + } +} + +void ExportDialog::updateControls() +{ + GetGraphicStream(); + + // Size Controls + if ( !mbIsPixelFormat ) + { + awt::Size aSize100thmm( maSize ); + Size aSize( LogicToLogic( Size( aSize100thmm.Width * 100, aSize100thmm.Height * 100 ), MAP_100TH_MM, + MapMode( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) ) ); + maMfSizeX.SetValue( aSize.Width() ); + maMfSizeY.SetValue( aSize.Height() ); + } + else + { + MapUnit aMapUnit( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ); + if ( aMapUnit == MAP_PIXEL ) + { // calculating pixel count via resolution and original graphic size + maMfSizeX.SetDecimalDigits( 0 ); + maMfSizeY.SetDecimalDigits( 0 ); + maMfSizeX.SetValue( maSize.Width ); + maMfSizeY.SetValue( maSize.Height ); + } + else + { + maMfSizeX.SetDecimalDigits( 2 ); + maMfSizeY.SetDecimalDigits( 2 ); + double fRatio; + switch( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) + { + case MAP_INCH : fRatio = static_cast< double >( maResolution.Width ) * 0.0254; break; + case MAP_MM : fRatio = static_cast< double >( maResolution.Width ) * 0.001; break; + case MAP_POINT :fRatio = ( static_cast< double >( maResolution.Width ) * 0.0254 ) / 72.0; break; + default: + case MAP_CM : fRatio = static_cast< double >( maResolution.Width ) * 0.01; break; + } + maMfSizeX.SetValue( static_cast< sal_Int32 >( ( static_cast< double >( maSize.Width * 100 ) / fRatio ) + 0.5 ) ); + maMfSizeY.SetValue( static_cast< sal_Int32 >( ( static_cast< double >( maSize.Height * 100 ) / fRatio ) + 0.5 ) ); + } + } + sal_Int32 nResolution = 0; + switch( maLbResolution.GetSelectEntryPos() ) + { + case 0 : nResolution = maResolution.Width / 100; break; // pixels / cm + case 2 : nResolution = maResolution.Width; break; // pixels / meter + default: + case 1 : nResolution = maResolution.Width * 0.0254; break; // pixels / inch + } + maNfResolution.SetValue( nResolution ); + + if ( maSbCompression.IsVisible() ) + maSbCompression.SetThumbPos( maNfCompression.GetValue() ); + + // updating estimated size + sal_Int64 nRealFileSize( mpTempStream->Tell() ); + if ( mbIsPixelFormat ) + { + String aEst( nRealFileSize ? msEstimatedSizePix2 : msEstimatedSizePix1 ); + sal_Int64 nRawFileSize( GetRawFileSize() ); + xub_StrLen nInd = aEst.Search( '%' ); + aEst.Replace( nInd, 2, ImpValueOfInKB( nRawFileSize ) ); + + if ( nRealFileSize ) + { + nInd = aEst.Search( '%', nInd ); + aEst.Replace( nInd, 2, ImpValueOfInKB( nRealFileSize ) ); + } + maFtEstimatedSize.SetText( aEst ); + } + else + { + if ( mnMaxFilesizeForRealtimePreview ) + { + String aEst( msEstimatedSizeVec ); + xub_StrLen nInd = aEst.Search( '%', 0 ); + aEst.Replace( nInd, 2, ImpValueOfInKB( nRealFileSize ) ); + maFtEstimatedSize.SetText( aEst ); + } + } + updatePreview(); + + // EPS + if ( maRbEPSLevel1.IsVisible() ) + { + sal_Bool bEnabled = maRbEPSLevel1.IsChecked() == sal_False; + maRbEPSColorFormat1.Enable( bEnabled ); + maRbEPSColorFormat2.Enable( bEnabled ); + maRbEPSCompressionLZW.Enable( bEnabled ); + maRbEPSCompressionNone.Enable( bEnabled ); + } +} + +ExportDialog::~ExportDialog() +{ + delete mpFilterOptionsItem; + delete mpOptionsItem; +} + + +/************************************************************************* +|* +|* Speichert eingestellte Werte in ini-Datei +|* +\************************************************************************/ +IMPL_LINK( ExportDialog, UpdateHdl, void *, EMPTYARG ) +{ + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, UpdateHdlMtfSizeX, void *, EMPTYARG ) +{ + double fRatio = static_cast< double >( maOriginalSize.Height ) / maOriginalSize.Width; + + if ( mbIsPixelFormat ) + { + switch( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) + { + case MAP_INCH : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * maMfSizeX.GetValue() / 100.0 + 0.5 ); break; + case MAP_CM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.01 * maMfSizeX.GetValue() / 100.0 + 0.5 ); break; + case MAP_MM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.001 * maMfSizeX.GetValue() / 100.0 + 0.5 ); break; + case MAP_POINT : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * maMfSizeX.GetValue() / 100.0 * 72 + 0.5 ); break; + default: + case MAP_PIXEL : maSize.Width = maMfSizeX.GetValue(); break; + } + maSize.Height = static_cast< sal_Int32 >( fRatio * maSize.Width + 0.5 ); + } + else + { + Fraction aFract( 1, 100 ); + sal_Int32 nWidth = maMfSizeX.GetValue(); + sal_Int32 nHeight= static_cast< sal_Int32 >( nWidth * fRatio ); + const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) ); + MapMode aSourceMapMode( GetMapUnit( maLbSizeX.GetSelectEntryPos() ),Point(), aFract, aFract ); + Size aDest( LogicToLogic( aSource, aSourceMapMode, MAP_100TH_MM ) ); + + maSize.Width = aDest.Width(); + if ( mbPreserveAspectRatio ) + maSize.Height = aDest.Height(); + } + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, UpdateHdlMtfSizeY, void *, EMPTYARG ) +{ + double fRatio = static_cast< double >( maOriginalSize.Width ) / maOriginalSize.Height; + + if ( mbIsPixelFormat ) + { + switch( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) + { + case MAP_INCH : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * maMfSizeY.GetValue() / 100.0 + 0.5 ); break; + case MAP_CM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.01 * maMfSizeY.GetValue() / 100.0 + 0.5 ); break; + case MAP_MM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.001 * maMfSizeY.GetValue() / 100.0 + 0.5 ); break; + case MAP_POINT : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * maMfSizeY.GetValue() / 100.0 * 72 + 0.5 ); break; + default: + case MAP_PIXEL : maSize.Height = maMfSizeY.GetValue(); break; + } + maSize.Width = static_cast< sal_Int32 >( fRatio * maSize.Height + 0.5 ); + } + else + { + Fraction aFract( 1, 100 ); + sal_Int32 nHeight= maMfSizeY.GetValue(); + sal_Int32 nWidth = static_cast< sal_Int32 >( nHeight * fRatio ); + const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) ); + MapMode aSourceMapMode( GetMapUnit( maLbSizeX.GetSelectEntryPos() ),Point(), aFract, aFract ); + Size aDest( LogicToLogic( aSource, aSourceMapMode, MAP_100TH_MM ) ); + + maSize.Height = aDest.Height(); + if ( mbPreserveAspectRatio ) + maSize.Width = aDest.Width(); + } + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, UpdateHdlNfResolution, void *, EMPTYARG ) +{ + sal_Int32 nResolution = maNfResolution.GetValue(); + if ( maLbResolution.GetSelectEntryPos() == 0 ) // pixels / cm + nResolution *= 100; + else if ( maLbResolution.GetSelectEntryPos() == 1 ) // pixels / inch + nResolution = static_cast< sal_Int32 >( ( ( static_cast< double >( nResolution ) + 0.5 ) / 0.0254 ) ); + maResolution.Width = nResolution; + maResolution.Height= nResolution; + + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, SbCompressionUpdateHdl, void *, EMPTYARG ) +{ + maNfCompression.SetValue( maSbCompression.GetThumbPos() ); + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, OK, void *, EMPTYARG ) +{ + // writing config parameter + + + mrFltCallPara.aFilterData = GetFilterData( sal_True ); + EndDialog( RET_OK ); + + return 0; +} + diff --git a/svtools/source/filter.vcl/filter/exportdialog.hrc b/svtools/source/filter.vcl/filter/exportdialog.hrc new file mode 100755 index 000000000000..e230bcd2c5c3 --- /dev/null +++ b/svtools/source/filter.vcl/filter/exportdialog.hrc @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <svtools/svtools.hrc> + +#define BTN_OK 1 +#define BTN_CANCEL 1 +#define BTN_HELP 1 + +#define FL_EXPORT_SIZE 1 +#define FL_COLOR_DEPTH 2 +#define FL_JPG_QUALITY 3 +#define FL_COMPRESSION 4 +#define FL_MODE 5 +#define FL_GIF_DRAWING_OBJECTS 6 +#define FL_PBM_OPTIONS 7 +#define FL_EPS_PREVIEW 8 +#define FL_EPS_VERSION 9 +#define FL_EPS_COLOR_FORMAT 10 +#define FL_ESTIMATED_SIZE 11 +#define FL_BUTTONS 12 + +#define FT_SIZEX 1 +#define FT_SIZEY 2 +#define FT_RESOLUTION 3 +#define FT_JPG_MIN 4 +#define FT_JPG_MAX 5 +#define FT_PNG_MIN 6 +#define FT_PNG_MAX 7 +#define FT_ESTIMATED_SIZE 8 + +#define NF_RESOLUTION 1 +#define NF_COMPRESSION 2 +#define NF_ZOOM 3 + +#define MF_SIZEX 1 +#define MF_SIZEY 2 + +#define LB_SIZEX 1 +#define LB_SIZEY 2 +#define LB_RESOLUTION 3 +#define LB_COLOR_DEPTH 4 + +#define RB_BINARY 1 +#define RB_TEXT 2 +#define RB_EPS_LEVEL1 3 +#define RB_EPS_LEVEL2 4 +#define RB_EPS_COLOR_FORMAT1 5 +#define RB_EPS_COLOR_FORMAT2 6 +#define RB_EPS_COMPRESSION_LZW 7 +#define RB_EPS_COMPRESSION_NONE 8 + +#define CB_JPG_PREVIEW 1 +#define CB_INTERLACED 2 +#define CB_RLE_ENCODING 3 +#define CB_SAVE_TRANSPARENCY 4 +#define CB_EPS_PREVIEW_TIFF 5 +#define CB_EPS_PREVIEW_EPSI 6 + +#define FB_JPG_PREVIEW 1 + +#define SB_COMPRESSION 1 +#define SB_JPG_PREVIEW_HORZ 2 +#define SB_JPG_PREVIEW_VERT 3 +#define SB_ZOOM 4 + +#define STR_1BIT_THRESHOLD 1 +#define STR_1BIT_DITHERED 2 +#define STR_4BIT_GRAYSCALE 3 +#define STR_4BIT_COLOR_PALETTE 4 +#define STR_8BIT_GRAYSCALE 5 +#define STR_8BIT_COLOR_PALETTE 6 +#define STR_24BIT_TRUE_COLOR 7 +#define STR_ESTIMATED_SIZE_PIX_1 8 +#define STR_ESTIMATED_SIZE_PIX_2 9 +#define STR_ESTIMATED_SIZE_VEC 10 diff --git a/svtools/source/filter.vcl/filter/exportdialog.hxx b/svtools/source/filter.vcl/filter/exportdialog.hxx new file mode 100755 index 000000000000..20a9ac3ea832 --- /dev/null +++ b/svtools/source/filter.vcl/filter/exportdialog.hxx @@ -0,0 +1,216 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _EXPORTDIALOG_HXX_ +#define _EXPORTDIALOG_HXX_ + +#include <svtools/fltcall.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/arrange.hxx> +#include <vcl/scrbar.hxx> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> + +/************************************************************************* +|* +|* Dialog zum Einstellen von Filteroptionen bei Pixelformaten +|* +\************************************************************************/ + +class FilterConfigItem; +class ExportDialog : public ModalDialog +{ +private: + + FltCallDialogParameter& + mrFltCallPara; + + ResMgr* mpMgr; + + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > + mxMgr; + const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& + mxSourceDocument; + + FixedLine maFlExportSize; + FixedText maFtSizeX; + MetricField maMfSizeX; + ListBox maLbSizeX; + FixedText maFtSizeY; + MetricField maMfSizeY; + ListBox maLbSizeY; + FixedText maFtResolution; + NumericField maNfResolution; + ListBox maLbResolution; + FixedLine maFlColorDepth; + ListBox maLbColorDepth; + FixedLine maFlJPGQuality; + FixedLine maFlMode; + FixedLine maFlPBMOptions; + ScrollBar maSbCompression; + NumericField maNfCompression; + FixedText maFtJPGMin; + FixedText maFtJPGMax; + FixedText maFtPNGMin; + FixedText maFtPNGMax; + CheckBox maCbJPGPreview; + CheckBox maCbInterlaced; + CheckBox maCbRLEEncoding; + FixedLine maFlGIFDrawingObjects; + CheckBox maCbSaveTransparency; + RadioButton maRbBinary; + RadioButton maRbText; + FixedLine maFlEPSPreview; + CheckBox maCbEPSPreviewTIFF; + CheckBox maCbEPSPreviewEPSI; + FixedLine maFlEPSVersion; + RadioButton maRbEPSLevel1; + RadioButton maRbEPSLevel2; + FixedLine maFlEPSColorFormat; + RadioButton maRbEPSColorFormat1; + RadioButton maRbEPSColorFormat2; + FixedLine maFlCompression; + RadioButton maRbEPSCompressionLZW; + RadioButton maRbEPSCompressionNone; + FixedLine maFlEstimatedSize; + FixedText maFtEstimatedSize; + String msEstimatedSizePix1; + String msEstimatedSizePix2; + String msEstimatedSizeVec; + FixedLine maFlButtons; + FixedBitmap maFbJPGPreview; + ScrollBar maSbZoom; + NumericField maNfZoom; + ScrollBar maSbJPGPreviewHorz; + ScrollBar maSbJPGPreviewVert; + OKButton maBtnOK; + CancelButton maBtnCancel; + HelpButton maBtnHelp; + + String ms1BitTreshold; + String ms1BitDithered; + String ms4BitGrayscale; + String ms4BitColorPalette; + String ms8BitGrayscale; + String ms8BitColorPalette; + String ms24BitColor; + + vcl::RowOrColumn maLayout; + Size maDialogSize; + + FilterConfigItem* mpOptionsItem; + FilterConfigItem* mpFilterOptionsItem; + + String maExt; + String maEstimatedSizeText; + sal_Int16 mnFormat; + sal_Int32 mnMaxFilesizeForRealtimePreview; + + Rectangle maRectFlButtons; + Rectangle maRectBtnHelp; + Rectangle maRectBtnOK; + Rectangle maRectBtnCancel; + + SvStream* mpTempStream; + Bitmap maBitmap; + + com::sun::star::awt::Size + maOriginalSize; // the original graphic size in 1/100mm + com::sun::star::awt::Size + maSize; // for vector graphics it always contains the logical size in 1/100mm + + sal_Bool mbPreview; + sal_Bool mbIsPixelFormat; + sal_Bool mbExportSelection; + sal_Bool mbPreserveAspectRatio; + + sal_Int32 mnInitialResolutionUnit; + + // for pixel graphics it always contains the pixel count + com::sun::star::awt::Size + maResolution; // it always contains the number of pixels per meter + + com::sun::star::uno::Reference< com::sun::star::drawing::XShape > + mxShape; + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > + mxShapes; + com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > + mxPage; + + + DECL_LINK( UpdateHdl,void* p ); + DECL_LINK( UpdateHdlMtfSizeX,void* p ); + DECL_LINK( UpdateHdlMtfSizeY,void* p ); + DECL_LINK( UpdateHdlNfResolution,void* p ); + DECL_LINK( SbCompressionUpdateHdl,void* p ); + DECL_LINK( NfCompressionUpdateHdlX,void* p ); + + DECL_LINK( OK, void* p ); + + void createSizeControls( vcl::RowOrColumn& ); + void createColorDepthControls( vcl::RowOrColumn& ); + void createFilterOptions( vcl::RowOrColumn& ); + void createButtons( vcl::RowOrColumn& ); + void createScrollBar( vcl::RowOrColumn& ); + void setupLayout(); + void updatePreview(); + void updateControls(); + + void GetGraphicSource(); + sal_Bool GetGraphicStream(); + Bitmap GetGraphicBitmap( SvStream& rStream ); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > + GetFilterData( sal_Bool bUpdateConfig ); + + sal_uInt32 GetRawFileSize() const; + sal_Bool IsTempExportAvailable() const; + + com::sun::star::awt::Size + GetOriginalSize(); + + sal_Int32 GetDefaultUnit(); + +public: + ExportDialog( FltCallDialogParameter& rPara, + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > rxMgr, + const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxSourceDocument, + sal_Bool bExportSelection, sal_Bool bIsExportVectorFormat ); + ~ExportDialog(); +}; + + + +#endif // _EXPORTDIALOG_HXX_ + diff --git a/svtools/source/filter.vcl/filter/exportdialog.src b/svtools/source/filter.vcl/filter/exportdialog.src new file mode 100755 index 000000000000..065fcee6ba18 --- /dev/null +++ b/svtools/source/filter.vcl/filter/exportdialog.src @@ -0,0 +1,505 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "exportdialog.hrc" + +String DLG_EXPORT_TITLE +{ + Text [ en-US ] = " Options" ; +}; + +ModalDialog DLG_EXPORT +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 178 , 135 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + + FixedLine FL_EXPORT_SIZE + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Size" ; + }; + FixedText FT_SIZEX + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Width:" ; + }; + MetricField MF_SIZEX + { + Hide = TRUE; + Border = TRUE; + Size = MAP_APPFONT ( 30, 12 ) ; + TabStop = TRUE; + Repeat = TRUE; + Spin = FALSE; + StrictFormat = TRUE; + DecimalDigits = 2; + Unit = FUNIT_NONE; + Maximum = 99999; + Last = 255; + }; + ListBox LB_SIZEX + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 60, 80 ) ; + DropDown = TRUE ; + Sort = FALSE ; + StringList [ en-US ] = + { + < "inches" ; > ; + < "cm" ; Default ; > ; + < "mm" ; > ; + < "points" ; > ; + < "pixels" ; > ; + }; + }; + FixedText FT_SIZEY + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Height:" ; + }; + MetricField MF_SIZEY + { + Hide = TRUE; + Border = TRUE; + Size = MAP_APPFONT ( 30, 12 ); + TabStop = TRUE; + Repeat = TRUE; + Spin = FALSE; + StrictFormat = TRUE; + DecimalDigits = 2; + Unit = FUNIT_NONE; + Maximum = 99999; + Last = 255 ; + }; + ListBox LB_SIZEY + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 60, 80 ) ; + DropDown = TRUE ; + Sort = FALSE ; + StringList [ en-US ] = + { + < "inches" ; > ; + < "cm" ; Default ; > ; + < "mm" ; > ; + < "points" ; > ; + < "pixels" ; > ; + }; + }; + FixedText FT_RESOLUTION + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Resolution:" ; + }; + NumericField NF_RESOLUTION + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 30, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = FALSE ; + Maximum = 99999; + Last = 255 ; + }; + ListBox LB_RESOLUTION + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 60, 80 ) ; + DropDown = TRUE ; + Sort = FALSE ; + StringList [ en-US ] = + { + < "pixels/cm" ; > ; + < "pixels/inch" ; Default ; > ; + < "pixels/meter" ; > ; + }; + }; + FixedLine FL_COLOR_DEPTH + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Color Depth" ; + }; + ListBox LB_COLOR_DEPTH + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 60, 80 ) ; + DropDown = TRUE ; + Sort = FALSE ; + }; + String STR_1BIT_THRESHOLD + { + Text [ en-US ] = "1 bit threshold"; + }; + String STR_1BIT_DITHERED + { + Text [ en-US ] = "1 bit dithered"; + }; + String STR_4BIT_GRAYSCALE + { + Text [ en-US ] = "4 bit grayscale"; + }; + String STR_4BIT_COLOR_PALETTE + { + Text [ en-US ] = "4 bit color"; + }; + String STR_8BIT_GRAYSCALE + { + Text [ en-US ] = "8 bit grayscale"; + }; + String STR_8BIT_COLOR_PALETTE + { + Text [ en-US ] = "8 bit color"; + }; + String STR_24BIT_TRUE_COLOR + { + Text [ en-US ] = "24 bit true color"; + }; + FixedLine FL_JPG_QUALITY + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Quality" ; + }; + FixedLine FL_COMPRESSION + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Compression" ; + }; + FixedLine FL_MODE + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Mode" ; + }; + FixedLine FL_PBM_OPTIONS + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "File Format" ; + }; + ScrollBar SB_COMPRESSION + { + Hide = TRUE; + Size = MAP_APPFONT ( 48, 10 ) ; + VScroll = FALSE ; + HScroll = TRUE; + Drag = TRUE ; + }; + NumericField NF_COMPRESSION + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 30, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = FALSE ; + Maximum = 99999; + Last = 255 ; + }; + FixedText FT_JPG_MIN + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "1 is minimum Quality and smallest file size." ; + }; + FixedText FT_JPG_MAX + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "100 is maximum Quality and biggest file size." ; + }; + FixedText FT_PNG_MIN + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "0 is biggest file size and fastest loading." ; + }; + FixedText FT_PNG_MAX + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "9 is smallest file size and slowest loading." ; + }; + CheckBox CB_JPG_PREVIEW + { + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Preview" ; + }; + CheckBox CB_INTERLACED + { + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Interlaced" ; + }; + CheckBox CB_RLE_ENCODING + { + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "RLE encoding" ; + }; + FixedLine FL_GIF_DRAWING_OBJECTS + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Drawing Objects" ; + }; + CheckBox CB_SAVE_TRANSPARENCY + { + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Save transparency" ; + }; + RadioButton RB_BINARY + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Binary" ; + }; + RadioButton RB_TEXT + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Text" ; + }; + FixedLine FL_EPS_PREVIEW + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Preview" ; + }; + CheckBox CB_EPS_PREVIEW_TIFF + { + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Image Preview (TIFF)" ; + }; + CheckBox CB_EPS_PREVIEW_EPSI + { + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Interchange (EPSI)" ; + }; + FixedLine FL_EPS_VERSION + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Version" ; + }; + RadioButton RB_EPS_LEVEL1 + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Level 1" ; + }; + RadioButton RB_EPS_LEVEL2 + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Level 2" ; + }; + FixedLine FL_EPS_COLOR_FORMAT + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Color format" ; + }; + RadioButton RB_EPS_COLOR_FORMAT1 + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Color" ; + }; + RadioButton RB_EPS_COLOR_FORMAT2 + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Grayscale" ; + }; + RadioButton RB_EPS_COMPRESSION_LZW + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "LZW encoding" ; + }; + RadioButton RB_EPS_COMPRESSION_NONE + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "None" ; + }; + FixedLine FL_ESTIMATED_SIZE + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + }; + FixedText FT_ESTIMATED_SIZE + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + }; + String STR_ESTIMATED_SIZE_PIX_1 + { + Text [ en-US ] = "The picture needs about %1 KB of memory."; + }; + String STR_ESTIMATED_SIZE_PIX_2 + { + Text [ en-US ] = "The picture needs about %1 KB of memory,\n the file size is %2 KB."; + }; + String STR_ESTIMATED_SIZE_VEC + { + Text [ en-US ] = "The file size is %1 KB."; + }; + FixedLine FL_BUTTONS + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + }; + FixedBitmap FB_JPG_PREVIEW + { + Hide = TRUE; + OutputSize = TRUE ; + Scale = TRUE; + Border = TRUE; + }; + ScrollBar SB_ZOOM + { + Hide = TRUE; + Size = MAP_APPFONT ( 48, 10 ); + VScroll = FALSE; + HScroll = TRUE; + Drag = TRUE; + MinPos = 5; + MaxPos = 100; + ThumbPos = 50; + }; + NumericField NF_ZOOM + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 30, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = FALSE ; + Maximum = 3000; + Last = 255 ; + }; + ScrollBar SB_JPG_PREVIEW_HORZ + { + Hide = TRUE; + Size = MAP_APPFONT ( 48, 10 ); + VScroll = FALSE; + HScroll = TRUE; + Drag = TRUE; + MinPos = 0; + MaxPos = 100; + ThumbPos = 50; + }; + ScrollBar SB_JPG_PREVIEW_VERT + { + Hide = TRUE; + Size = MAP_APPFONT ( 48, 10 ); + VScroll = TRUE; + HScroll = FALSE; + Drag = TRUE; + MinPos = 0; + MaxPos = 100; + ThumbPos = 50; + }; + OKButton BTN_OK + { + Hide = TRUE; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Hide = TRUE; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Hide = TRUE; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx index db1f4c11cf94..65f51ce212f4 100644 --- a/svtools/source/filter.vcl/filter/filter.cxx +++ b/svtools/source/filter.vcl/filter/filter.cxx @@ -52,7 +52,7 @@ #include "xbmread.hxx" #include "xpmread.hxx" #include <svl/solar.hrc> -#include "strings.hrc" +#include <svtools/svtools.hrc> #include "sgffilt.hxx" #include "osl/module.hxx" #include <com/sun/star/uno/Reference.h> @@ -752,7 +752,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r if ( rGraphic.GetType() != GRAPHIC_NONE ) { - sal_Int32 nMode = rConfigItem.ReadInt32( String( ResId( KEY_MODE, *pResMgr ) ), -1 ); + sal_Int32 nMode = rConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ExportMode" ) ), -1 ); if ( nMode == -1 ) // the property is not there, this is possible, if the graphic filter { // is called via UnoGraphicExporter and not from a graphic export Dialog @@ -782,7 +782,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r Bitmap aBitmap( rGraphic.GetBitmap() ); MapMode aMap( MAP_100TH_INCH ); - sal_Int32 nDPI = rConfigItem.ReadInt32( String( ResId( KEY_RES, *pResMgr ) ), 75 ); + sal_Int32 nDPI = rConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Resolution" ) ), 75 ); Fraction aFrac( 1, Min( Max( nDPI, sal_Int32( 75 ) ), sal_Int32( 600 ) ) ); aMap.SetScaleX( aFrac ); @@ -806,7 +806,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r else aGraphic = rGraphic; - sal_Int32 nColors = rConfigItem.ReadInt32( String( ResId( KEY_COLORS, *pResMgr ) ), 0 ); // #92767# + sal_Int32 nColors = rConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ), 0 ); // #92767# if ( nColors ) // graphic conversion necessary ? { BitmapEx aBmpEx( aGraphic.GetBitmapEx() ); @@ -1771,7 +1771,7 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat aBmp = aGraphic.GetBitmap(); } ResMgr* pResMgr = CREATERESMGR( svt ); - sal_Bool bRleCoding = aConfigItem.ReadBool( String( ResId( KEY_RLE_CODING, *pResMgr ) ), sal_True ); + sal_Bool bRleCoding = aConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "RLE_Coding" ) ), sal_True ); // Wollen wir RLE-Kodiert speichern? aBmp.Write( rOStm, bRleCoding ); delete pResMgr; diff --git a/svtools/source/filter.vcl/filter/makefile.mk b/svtools/source/filter.vcl/filter/makefile.mk index 272bb9a76b03..11d35150bda8 100644 --- a/svtools/source/filter.vcl/filter/makefile.mk +++ b/svtools/source/filter.vcl/filter/makefile.mk @@ -41,16 +41,11 @@ SOLARINC+=-I../../inc # --- Files -------------------------------------------------------- SRS1NAME=$(TARGET) -SRC1FILES= strings.src \ - dlgexpor.src \ - dlgepng.src \ - dlgejpg.src +SRC1FILES=exportdialog.src SLOFILES= $(SLO)$/filter.obj \ $(SLO)$/filter2.obj \ - $(SLO)$/dlgexpor.obj \ - $(SLO)$/dlgejpg.obj \ - $(SLO)$/dlgepng.obj \ + $(SLO)$/exportdialog.obj \ $(SLO)$/sgfbram.obj \ $(SLO)$/sgvmain.obj \ $(SLO)$/sgvtext.obj \ @@ -59,28 +54,26 @@ SLOFILES= $(SLO)$/filter.obj \ $(SLO)$/FilterConfigCache.obj \ $(SLO)$/SvFilterOptionsDialog.obj +EXCEPTIONSFILES= $(SLO)$/exportdialog.obj + EXCEPTIONSNOOPTFILES= $(SLO)$/filter.obj \ $(SLO)$/FilterConfigItem.obj \ $(SLO)$/FilterConfigCache.obj \ $(SLO)$/SvFilterOptionsDialog.obj LIB1TARGET= $(SLB)$/$(TARGET).uno.lib -LIB1OBJFILES= \ - $(SLO)$/dlgexpor.obj \ - $(SLO)$/dlgejpg.obj \ - $(SLO)$/dlgepng.obj \ - $(SLO)$/SvFilterOptionsDialog.obj +LIB1OBJFILES= $(SLO)$/exportdialog.obj \ + $(SLO)$/SvFilterOptionsDialog.obj LIB2TARGET= $(SLB)$/$(TARGET).lib -LIB2OBJFILES= \ - $(SLO)$/filter.obj \ - $(SLO)$/filter2.obj \ - $(SLO)$/sgfbram.obj \ - $(SLO)$/sgvmain.obj \ - $(SLO)$/sgvtext.obj \ - $(SLO)$/sgvspln.obj \ - $(SLO)$/FilterConfigItem.obj \ - $(SLO)$/FilterConfigCache.obj +LIB2OBJFILES= $(SLO)$/filter.obj \ + $(SLO)$/filter2.obj \ + $(SLO)$/sgfbram.obj \ + $(SLO)$/sgvmain.obj \ + $(SLO)$/sgvtext.obj \ + $(SLO)$/sgvspln.obj \ + $(SLO)$/FilterConfigItem.obj \ + $(SLO)$/FilterConfigCache.obj # --- Targets ------------------------------------------------------- diff --git a/svtools/source/filter.vcl/filter/strings.hrc b/svtools/source/filter.vcl/filter/strings.hrc deleted file mode 100644 index 0eea67fb2338..000000000000 --- a/svtools/source/filter.vcl/filter/strings.hrc +++ /dev/null @@ -1,27 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svtools/svtools.hrc> diff --git a/svtools/source/filter.vcl/filter/strings.src b/svtools/source/filter.vcl/filter/strings.src deleted file mode 100644 index 60e628ee0b5c..000000000000 --- a/svtools/source/filter.vcl/filter/strings.src +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "strings.hrc" - -String EXPORT_DIALOG_TITLE -{ - Text [ en-US ] = " Options" ; -}; - -String KEY_MODE -{ - Text = "ExportMode" ; -}; - -String KEY_RES -{ - Text = "Resolution" ; -}; - -String KEY_SIZE -{ - Text = "Size" ; -}; - -String KEY_COLORS -{ - Text = "Color" ; -}; - -String KEY_RLE_CODING -{ - Text = "RLE_Coding" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index fbf95406a63a..f1674dcd7d4a 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -231,19 +231,19 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadStandardImage( co if( ( 0 == rResourceURL.getToken( 0, '/', nIndex ).compareToAscii( "private:standardimage" ) ) ) { rtl::OUString sImageName( rResourceURL.copy( nIndex ) ); - if ( sImageName.compareToAscii( "info" ) ) + if ( sImageName.equalsAscii( "info" ) ) { xRet = InfoBox::GetStandardImage().GetXGraphic(); } - else if ( sImageName.compareToAscii( "warning" ) ) + else if ( sImageName.equalsAscii( "warning" ) ) { xRet = WarningBox::GetStandardImage().GetXGraphic(); } - else if ( sImageName.compareToAscii( "error" ) ) + else if ( sImageName.equalsAscii( "error" ) ) { xRet = ErrorBox::GetStandardImage().GetXGraphic(); } - else if ( sImageName.compareToAscii( "query" ) ) + else if ( sImageName.equalsAscii( "query" ) ) { xRet = QueryBox::GetStandardImage().GetXGraphic(); } diff --git a/svtools/source/table/defaultinputhandler.cxx b/svtools/source/table/defaultinputhandler.cxx index ad8f7a7562d3..f6a58ad17efe 100644 --- a/svtools/source/table/defaultinputhandler.cxx +++ b/svtools/source/table/defaultinputhandler.cxx @@ -173,6 +173,7 @@ namespace svt { namespace table if ( ( pActions->nKeyCode == nKeyCode ) && ( pActions->nKeyModifier == rKeyCode.GetAllModifier() ) ) { bHandled = _rControl.dispatchAction( pActions->eAction ); + bHandled = true; // always handled issue #i114340 break; } } diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index e2e1ce5353fe..bbd7f6829369 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -45,7 +45,6 @@ namespace svt { namespace table TableDataWindow::TableDataWindow( TableControl_Impl& _rTableControl ) :Window( &_rTableControl.getAntiImpl() ) ,m_rTableControl ( _rTableControl ) - ,m_nRowAlreadySelected( -1 ) { // by default, use the background as determined by the style settings const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() ); @@ -110,15 +109,17 @@ namespace svt { namespace table { Point aPoint = rMEvt.GetPosPixel(); RowPos nCurRow = m_rTableControl.getCurrentRow(aPoint); + std::vector<RowPos> selectedRows(m_rTableControl.getSelectedRows()); if ( !m_rTableControl.getInputHandler()->MouseButtonDown( m_rTableControl, rMEvt ) ) Window::MouseButtonDown( rMEvt ); else { if(nCurRow >= 0 && m_rTableControl.getSelEngine()->GetSelectionMode() != NO_SELECTION) { - if( m_nRowAlreadySelected != nCurRow ) + bool found = std::find(selectedRows.begin(),selectedRows.end(), nCurRow) != selectedRows.end(); + + if( !found ) { - m_nRowAlreadySelected = nCurRow; m_aSelectHdl.Call( NULL ); } } diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index 7fb1a007960f..d1ea854cce61 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -1322,6 +1322,21 @@ void TreeControlPeer::setProperty( const ::rtl::OUString& PropertyName, const An switch( GetPropertyId( PropertyName ) ) { + case BASEPROPERTY_HIDEINACTIVESELECTION: + { + sal_Bool bEnabled = sal_False; + if ( aValue >>= bEnabled ) + { + WinBits nStyle = rTree.GetWindowBits(); + if ( bEnabled ) + nStyle |= WB_HIDESELECTION; + else + nStyle &= ~WB_HIDESELECTION; + rTree.SetWindowBits( nStyle ); + } + } + break; + case BASEPROPERTY_TREE_SELECTIONTYPE: { SelectionType eSelectionType; @@ -1412,6 +1427,9 @@ Any TreeControlPeer::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); switch(nPropId) { + case BASEPROPERTY_HIDEINACTIVESELECTION: + return Any( ( rTree.GetWindowBits() & WB_HIDESELECTION ) != 0 ? sal_True : sal_False ); + case BASEPROPERTY_TREE_SELECTIONTYPE: { SelectionType eSelectionType; diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index 9440c0e69f26..147b11aceb11 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -414,7 +414,7 @@ namespace svt { namespace uno ::osl::MutexGuard aGuard( m_aMutex ); WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); - ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!" ); + ENSURE_OR_RETURN( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!", Reference< XWizardPage >() ); return pWizardImpl->getCurrentWizardPage(); } diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx index 80e3a37279d3..fb110cb74391 100644 --- a/toolkit/inc/toolkit/awt/vclxwindows.hxx +++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx @@ -747,8 +747,10 @@ public: // ---------------------------------------------------- // class VCLXComboBox // ---------------------------------------------------- -class VCLXComboBox : public ::com::sun::star::awt::XComboBox, - public VCLXEdit +typedef ::cppu::ImplInheritanceHelper2 < VCLXEdit + , ::com::sun::star::awt::XComboBox + , ::com::sun::star::awt::XItemListListener > VCLXComboBox_Base; +class VCLXComboBox : public VCLXComboBox_Base { private: ActionListenerMultiplexer maActionListeners; @@ -763,15 +765,6 @@ public: VCLXComboBox(); ~VCLXComboBox(); - // ::com::sun::star::uno::XInterface - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - void SAL_CALL release() throw() { OWeakObject::release(); } - - // ::com::sun::star::lang::XTypeProvider - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - // ::com::sun::star::lang::XComponent void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); @@ -802,6 +795,15 @@ public: void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); + // XItemListListener + virtual void SAL_CALL listItemInserted( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL listItemRemoved( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL listItemModified( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL allItemsRemoved( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_rEvent ) throw (::com::sun::star::uno::RuntimeException); + static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); } }; diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx index 6223e47a6871..01ff047ee3de 100644 --- a/toolkit/inc/toolkit/controls/unocontrols.hxx +++ b/toolkit/inc/toolkit/controls/unocontrols.hxx @@ -727,6 +727,8 @@ typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel > UnoControlListBoxModel_Base; class TOOLKIT_DLLPUBLIC UnoControlListBoxModel :public UnoControlListBoxModel_Base { +protected: + UnoControlListBoxModel(bool asComboBox); public: UnoControlListBoxModel(); UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource ); @@ -748,7 +750,9 @@ public: ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoControlListBoxModel, UnoControlModel, szServiceName2_UnoControlListBoxModel ) + //DECLIMPL_SERVICEINFO_DERIVED( UnoControlListBoxModel, UnoControlModel, szServiceName2_UnoControlListBoxModel ) + ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::awt::XItemList virtual ::sal_Int32 SAL_CALL getItemCount() throw (::com::sun::star::uno::RuntimeException); @@ -806,7 +810,7 @@ private: void impl_getStringItemList( ::std::vector< ::rtl::OUString >& o_rStringItems ) const; void impl_setStringItemList_nolck( const ::std::vector< ::rtl::OUString >& i_rStringItems ); -private: +protected: ::boost::scoped_ptr< UnoControlListBoxModel_Data > m_pData; ::cppu::OInterfaceContainerHelper m_aItemListListeners; }; @@ -878,7 +882,9 @@ public: virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoListBoxControl, UnoControlBase, szServiceName2_UnoControlListBox ) + // DECLIMPL_SERVICEINFO_DERIVED( UnoListBoxControl, UnoControlBase, szServiceName2_UnoControlListBox ) + ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); protected: void ImplUpdateSelectedItemsProperty(); @@ -895,7 +901,7 @@ private: // ---------------------------------------------------- // class UnoControlComboBoxModel // ---------------------------------------------------- -class UnoControlComboBoxModel : public UnoControlModel +class UnoControlComboBoxModel : public UnoControlListBoxModel { protected: ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; @@ -903,7 +909,7 @@ protected: public: UnoControlComboBoxModel(); - UnoControlComboBoxModel( const UnoControlComboBoxModel& rModel ) : UnoControlModel( rModel ) {;} + UnoControlComboBoxModel( const UnoControlComboBoxModel& rModel ) : UnoControlListBoxModel( rModel ) {;} UnoControlModel* Clone() const { return new UnoControlComboBoxModel( *this ); } @@ -912,17 +918,23 @@ public: // ::com::sun::star::beans::XMultiPropertySet ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // OPropertySetHelper + void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoControlComboBoxModel, UnoControlModel, szServiceName2_UnoControlComboBoxModel ) + ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + // DECLIMPL_SERVICEINFO_DERIVED( UnoControlComboBoxModel, UnoControlModel, szServiceName2_UnoControlComboBoxModel ) }; // ---------------------------------------------------- // class UnoComboBoxControl // ---------------------------------------------------- -class UnoComboBoxControl : public UnoEditControl, - public ::com::sun::star::awt::XComboBox +class UnoComboBoxControl : public UnoEditControl + , public ::com::sun::star::awt::XComboBox + , public ::com::sun::star::awt::XItemListener + , public ::com::sun::star::awt::XItemListListener { private: ActionListenerMultiplexer maActionListeners; @@ -933,12 +945,15 @@ public: UnoComboBoxControl(); ::rtl::OUString GetComponentServiceName(); + void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoEditControl::disposing( Source ); } + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); } ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); } void SAL_CALL release() throw() { OWeakAggObject::release(); } - void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::lang::XTypeProvider ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); @@ -958,8 +973,28 @@ public: sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException); + // XUnoControl + virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException ); + + // XItemListListener + virtual void SAL_CALL listItemInserted( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL listItemRemoved( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL listItemModified( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL allItemsRemoved( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); + + // XItemListener + virtual void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + // ::com::sun::star::lang::XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoComboBoxControl, UnoEditControl, szServiceName2_UnoControlComboBox ) + ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + //DECLIMPL_SERVICEINFO_DERIVED( UnoComboBoxControl, UnoEditControl, szServiceName2_UnoControlComboBox ) +protected: + virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ); + virtual void updateFromModel(); + ActionListenerMultiplexer& getActionListeners(); + ItemListenerMultiplexer& getItemListeners(); }; diff --git a/toolkit/inc/toolkit/helper/solarrelease.hxx b/toolkit/inc/toolkit/helper/solarrelease.hxx index d8938b41c220..e45a1b6ee2c3 100644 --- a/toolkit/inc/toolkit/helper/solarrelease.hxx +++ b/toolkit/inc/toolkit/helper/solarrelease.hxx @@ -41,15 +41,36 @@ namespace toolkit class ReleaseSolarMutex { sal_uInt32 mnLockCount; + const bool mbRescheduleDuringAcquire; + public: - ReleaseSolarMutex() + enum { - mnLockCount = Application::ReleaseSolarMutex(); + RescheduleDuringAcquire = true + }; + + public: + ReleaseSolarMutex( const bool i_rescheduleDuringAcquire = false ) + :mnLockCount( Application::ReleaseSolarMutex() ) + ,mbRescheduleDuringAcquire( i_rescheduleDuringAcquire ) + { + } ~ReleaseSolarMutex() { - Application::AcquireSolarMutex( mnLockCount ); + if ( mnLockCount > 0 ) + { + if ( mbRescheduleDuringAcquire ) + { + while ( !Application::GetSolarMutex().tryToAcquire() ) + { + Application::Reschedule(); + } + --mnLockCount; + } + Application::AcquireSolarMutex( mnLockCount ); + } } }; diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index efc2c40c6baa..1022d78a43ed 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -92,6 +92,7 @@ using ::com::sun::star::style::VerticalAlignment_MAKE_FIXED_SIZE; namespace WritingMode2 = ::com::sun::star::text::WritingMode2; namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior; +using ::toolkit::ReleaseSolarMutex; //==================================================================== //= misc helpers @@ -339,7 +340,7 @@ IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG ) } { - ::toolkit::ReleaseSolarMutex aReleaseSolar; + ReleaseSolarMutex aReleaseSolar( ReleaseSolarMutex::RescheduleDuringAcquire ); for ( CallbackArray::const_iterator loop = aCallbacksCopy.begin(); loop != aCallbacksCopy.end(); ++loop diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 4a68b4c80e3f..db34c840f8eb 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -2363,15 +2363,23 @@ sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException) Dialog* pDlg = (Dialog*) GetWindow(); Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP ); Window* pOldParent = NULL; + Window* pSetParent = NULL; if ( pParent && !pParent->IsReallyVisible() ) { pOldParent = pDlg->GetParent(); Window* pFrame = pDlg->GetWindow( WINDOW_FRAME ); if( pFrame != pDlg ) + { pDlg->SetParent( pFrame ); + pSetParent = pFrame; + } } + nRet = pDlg->Execute(); - if ( pOldParent ) + + // set the parent back only in case no new parent was set from outside + // in other words, revert only own changes + if ( pOldParent && pDlg->GetParent() == pSetParent ) pDlg->SetParent( pOldParent ); } return nRet; @@ -3896,20 +3904,6 @@ VCLXComboBox::~VCLXComboBox() #endif } -// ::com::sun::star::uno::XInterface -::com::sun::star::uno::Any VCLXComboBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( ::com::sun::star::awt::XComboBox*, this ) ); - return (aRet.hasValue() ? aRet : VCLXEdit::queryInterface( rType )); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXComboBox ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XComboBox>* ) NULL ), - VCLXEdit::getTypes() -IMPL_XTYPEPROVIDER_END - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXComboBox::CreateAccessibleContext() { ::vos::OGuard aGuard( GetMutex() ); @@ -3973,8 +3967,12 @@ void VCLXComboBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUStr for ( sal_uInt16 n = 0; n < aItems.getLength(); n++ ) { pBox->InsertEntry( aItems.getConstArray()[n], nP ); - if ( (sal_uInt16)nPos < 0xFFFF ) // Nicht wenn 0xFFFF, weil LIST_APPEND - nP++; + if ( nP == 0xFFFF ) + { + OSL_ENSURE( false, "VCLXComboBox::addItems: too many entries!" ); + // skip remaining entries, list cannot hold them, anyway + break; + } } } } @@ -4078,14 +4076,8 @@ void VCLXComboBox::setProperty( const ::rtl::OUString& PropertyName, const ::com ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems; if ( Value >>= aItems ) { - sal_Bool bUpdate = pComboBox->IsUpdateMode(); - pComboBox->SetUpdateMode( sal_False ); pComboBox->Clear(); - const ::rtl::OUString* pStrings = aItems.getConstArray(); - sal_Int32 nItems = aItems.getLength(); - for ( sal_Int32 n = 0; n < nItems; n++ ) - pComboBox->InsertEntry( pStrings[n], LISTBOX_APPEND ); - pComboBox->SetUpdateMode( bUpdate ); + addItems( aItems, 0 ); } } break; @@ -4255,6 +4247,104 @@ void VCLXComboBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) thr nLines = nL; } } +void SAL_CALL VCLXComboBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); + + ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemInserted: no ComboBox?!" ); + ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pComboBox->GetEntryCount() ) ), + "VCLXComboBox::listItemInserted: illegal (inconsistent) item position!" ); + pComboBox->InsertEntry( + i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(), + i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(), + i_rEvent.ItemPosition ); +} + +void SAL_CALL VCLXComboBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); + + ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemRemoved: no ComboBox?!" ); + ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ), + "VCLXComboBox::listItemRemoved: illegal (inconsistent) item position!" ); + + pComboBox->RemoveEntry( i_rEvent.ItemPosition ); +} + +void SAL_CALL VCLXComboBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); + + ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" ); + ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ), + "VCLXComboBox::listItemModified: illegal (inconsistent) item position!" ); + + // VCL's ComboBox does not support changing an entry's text or image, so remove and re-insert + + const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pComboBox->GetEntry( i_rEvent.ItemPosition ) ); + const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pComboBox->GetEntryImage( i_rEvent.ItemPosition ) ); + + pComboBox->RemoveEntry( i_rEvent.ItemPosition ); + pComboBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition ); +} + +void SAL_CALL VCLXComboBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); + ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" ); + + pComboBox->Clear(); + + (void)i_rEvent; +} + +void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() ); + ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" ); + + pComboBox->Clear(); + + uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW ); + // bool localize = xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ); + uno::Reference< resource::XStringResourceResolver > xStringResourceResolver; + if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ) ) + { + xStringResourceResolver.set( + xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ), + uno::UNO_QUERY + ); + } + + + Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW ); + uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems(); + for ( sal_Int32 i=0; i<aItems.getLength(); ++i ) + { + ::rtl::OUString aLocalizationKey( aItems[i].First ); + if ( xStringResourceResolver.is() && aLocalizationKey.getLength() != 0 && aLocalizationKey[0] == '&' ) + { + aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 )); + } + pComboBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) ); + } +} +void SAL_CALL VCLXComboBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException) +{ + // just disambiguate + VCLXEdit::disposing( i_rEvent ); +} // ---------------------------------------------------- // class VCLXFormattedSpinField diff --git a/toolkit/source/controls/tree/treecontrol.cxx b/toolkit/source/controls/tree/treecontrol.cxx index 8606792fdf2f..d56ca82bb845 100644 --- a/toolkit/source/controls/tree/treecontrol.cxx +++ b/toolkit/source/controls/tree/treecontrol.cxx @@ -76,6 +76,7 @@ UnoTreeModel::UnoTreeModel() ImplRegisterProperty( BASEPROPERTY_TREE_SHOWSROOTHANDLES ); ImplRegisterProperty( BASEPROPERTY_TREE_ROWHEIGHT ); ImplRegisterProperty( BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING ); + ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION ); } UnoTreeModel::UnoTreeModel( const UnoTreeModel& rModel ) diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index 6599b039600f..d0961188d06c 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -80,6 +80,18 @@ using ::com::sun::star::graphic::XGraphic; using ::com::sun::star::uno::Reference; using namespace ::toolkit; +#define IMPL_SERVICEINFO_DERIVED( ImplName, BaseClass, ServiceName ) \ + ::rtl::OUString SAL_CALL ImplName::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii( "stardiv.Toolkit." #ImplName ); } \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ImplName::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) \ + { \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames = BaseClass::getSupportedServiceNames( ); \ + aNames.realloc( aNames.getLength() + 1 ); \ + aNames[ aNames.getLength() - 1 ] = ::rtl::OUString::createFromAscii( ServiceName ); \ + return aNames; \ + } \ + + + // ---------------------------------------------------- // class UnoControlEditModel // ---------------------------------------------------- @@ -1826,6 +1838,13 @@ UnoControlListBoxModel::UnoControlListBoxModel() { UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXListBox ); } +// --------------------------------------------------------------------------------------------------------------------- +UnoControlListBoxModel::UnoControlListBoxModel(bool) + :UnoControlListBoxModel_Base() + ,m_pData( new UnoControlListBoxModel_Data( *this ) ) + ,m_aItemListListeners( GetMutex() ) +{ +} // --------------------------------------------------------------------------------------------------------------------- UnoControlListBoxModel::UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource ) @@ -1837,12 +1856,12 @@ UnoControlListBoxModel::UnoControlListBoxModel( const UnoControlListBoxModel& i_ UnoControlListBoxModel::~UnoControlListBoxModel() { } +IMPL_SERVICEINFO_DERIVED( UnoControlListBoxModel, UnoControlModel, szServiceName2_UnoControlListBoxModel ) // --------------------------------------------------------------------------------------------------------------------- ::rtl::OUString UnoControlListBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel ); } - // --------------------------------------------------------------------------------------------------------------------- uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const { @@ -2270,6 +2289,7 @@ UnoListBoxControl::UnoListBoxControl() { return ::rtl::OUString::createFromAscii( "listbox" ); } +IMPL_SERVICEINFO_DERIVED( UnoListBoxControl, UnoControlBase, szServiceName2_UnoControlListBox ) void UnoListBoxControl::dispose() throw(uno::RuntimeException) { @@ -2687,28 +2707,19 @@ ItemListenerMultiplexer& UnoListBoxControl::getItemListeners() // ---------------------------------------------------- // class UnoControlComboBoxModel // ---------------------------------------------------- -UnoControlComboBoxModel::UnoControlComboBoxModel() +UnoControlComboBoxModel::UnoControlComboBoxModel() : UnoControlListBoxModel(true) { UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXComboBox ); } -::rtl::OUString UnoControlComboBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException) -{ - return ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBoxModel ); -} +IMPL_SERVICEINFO_DERIVED( UnoControlComboBoxModel, UnoControlModel, szServiceName2_UnoControlComboBoxModel ) -uno::Any UnoControlComboBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +uno::Reference< beans::XPropertySetInfo > UnoControlComboBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException) { - if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) - { - uno::Any aAny; - aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBox ); - return aAny; - } - return UnoControlModel::ImplGetDefaultValue( nPropId ); + static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; } - - +// --------------------------------------------------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper& UnoControlComboBoxModel::getInfoHelper() { static UnoPropertyArrayHelper* pHelper = NULL; @@ -2720,14 +2731,53 @@ uno::Any UnoControlComboBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) cons return *pHelper; } -// beans::XMultiPropertySet -uno::Reference< beans::XPropertySetInfo > UnoControlComboBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException) + +::rtl::OUString UnoControlComboBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException) { - static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; + return ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBoxModel ); } +void SAL_CALL UnoControlComboBoxModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) throw (uno::Exception) +{ + UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue ); + if ( nHandle == BASEPROPERTY_STRINGITEMLIST && !m_pData->m_bSettingLegacyProperty) + { + // synchronize the legacy StringItemList property with our list items + Sequence< ::rtl::OUString > aStringItemList; + Any aPropValue; + getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST ); + OSL_VERIFY( aPropValue >>= aStringItemList ); + + ::std::vector< ListItem > aItems( aStringItemList.getLength() ); + ::std::transform( + aStringItemList.getConstArray(), + aStringItemList.getConstArray() + aStringItemList.getLength(), + aItems.begin(), + CreateListItem() + ); + m_pData->setAllItems( aItems ); + + // since an XItemListListener does not have a "all items modified" or some such method, + // we simulate this by notifying removal of all items, followed by insertion of all new + // items + lang::EventObject aEvent; + aEvent.Source = *this; + m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent ); + // TODO: OPropertySetHelper calls into this method with the mutex locked ... + // which is wrong for the above notifications ... + } +} +uno::Any UnoControlComboBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBox ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} // ---------------------------------------------------- // class UnoComboBoxControl @@ -2739,35 +2789,65 @@ UnoComboBoxControl::UnoComboBoxControl() maComponentInfos.nWidth = 100; maComponentInfos.nHeight = 12; } +IMPL_SERVICEINFO_DERIVED( UnoComboBoxControl, UnoEditControl, szServiceName2_UnoControlComboBox ) ::rtl::OUString UnoComboBoxControl::GetComponentServiceName() { return ::rtl::OUString::createFromAscii( "combobox" ); } -// uno::XInterface +void UnoComboBoxControl::dispose() throw(uno::RuntimeException) +{ + lang::EventObject aEvt; + aEvt.Source = (::cppu::OWeakObject*)this; + maActionListeners.disposeAndClear( aEvt ); + maItemListeners.disposeAndClear( aEvt ); + UnoControl::dispose(); +} uno::Any UnoComboBoxControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException) { uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XComboBox*, this ) ); + if ( !aRet.hasValue() ) + { + aRet = ::cppu::queryInterface( rType, + SAL_STATIC_CAST( awt::XItemListener*, this ) ); + if ( !aRet.hasValue() ) + { + aRet = ::cppu::queryInterface( rType, + SAL_STATIC_CAST( awt::XItemListListener*, this ) ); + } + } return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType )); } - // lang::XTypeProvider IMPL_XTYPEPROVIDER_START( UnoComboBoxControl ) getCppuType( ( uno::Reference< awt::XComboBox>* ) NULL ), + getCppuType( ( uno::Reference< awt::XItemListener>* ) NULL ), + getCppuType( ( uno::Reference< awt::XItemListListener>* ) NULL ), UnoEditControl::getTypes() IMPL_XTYPEPROVIDER_END -void UnoComboBoxControl::dispose() throw(uno::RuntimeException) +void UnoComboBoxControl::updateFromModel() { - lang::EventObject aEvt; - aEvt.Source = (::cppu::OWeakObject*)this; - maActionListeners.disposeAndClear( aEvt ); - maItemListeners.disposeAndClear( aEvt ); - UnoControl::dispose(); + UnoEditControl::updateFromModel(); + + Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY ); + ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoComboBoxControl::updateFromModel: a peer which is no ItemListListener?!" ); + + EventObject aEvent( getModel() ); + xItemListListener->itemListChanged( aEvent ); } +void UnoComboBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal ) +{ + if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ) + // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item + // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes + // will be forwarded to the peer, which will update itself accordingly. + return; + UnoEditControl::ImplSetPeerProperty( rPropName, rVal ); +} void UnoComboBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException) { UnoEditControl::createPeer( rxToolkit, rParentPeer ); @@ -2818,6 +2898,93 @@ void UnoComboBoxControl::removeItemListener(const uno::Reference < awt::XItemLis } maItemListeners.removeInterface( l ); } +void UnoComboBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException) +{ + if ( maItemListeners.getLength() ) + { + try + { + maItemListeners.itemStateChanged( rEvent ); + } + catch( const Exception& e ) + { +#if OSL_DEBUG_LEVEL == 0 + (void) e; // suppress warning +#else + ::rtl::OString sMessage( "UnoComboBoxControl::itemStateChanged: caught an exception:\n" ); + sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US ); + OSL_ENSURE( sal_False, sMessage.getStr() ); +#endif + } + } +} +sal_Bool SAL_CALL UnoComboBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( GetMutex() ); + + const Reference< XItemList > xOldItems( getModel(), UNO_QUERY ); + OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoComboBoxControl::setModel: illegal old model!" ); + const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY ); + OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoComboBoxControl::setModel: illegal new model!" ); + + if ( !UnoEditControl::setModel( i_rModel ) ) + return sal_False; + + if ( xOldItems.is() ) + xOldItems->removeItemListListener( this ); + if ( xNewItems.is() ) + xNewItems->addItemListListener( this ); + + return sal_True; +} + +void SAL_CALL UnoComboBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException) +{ + const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); + OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemInserted: invalid peer!" ); + if ( xPeerListener.is() ) + xPeerListener->listItemInserted( i_rEvent ); +} + +void SAL_CALL UnoComboBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException) +{ + const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); + OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemRemoved: invalid peer!" ); + if ( xPeerListener.is() ) + xPeerListener->listItemRemoved( i_rEvent ); +} + +void SAL_CALL UnoComboBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException) +{ + const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); + OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemModified: invalid peer!" ); + if ( xPeerListener.is() ) + xPeerListener->listItemModified( i_rEvent ); +} + +void SAL_CALL UnoComboBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException) +{ + const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); + OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::allItemsRemoved: invalid peer!" ); + if ( xPeerListener.is() ) + xPeerListener->allItemsRemoved( i_rEvent ); +} + +void SAL_CALL UnoComboBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException) +{ + const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); + OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::itemListChanged: invalid peer!" ); + if ( xPeerListener.is() ) + xPeerListener->itemListChanged( i_rEvent ); +} +ActionListenerMultiplexer& UnoComboBoxControl::getActionListeners() +{ + return maActionListeners; +} +ItemListenerMultiplexer& UnoComboBoxControl::getItemListeners() +{ + return maItemListeners; +} void UnoComboBoxControl::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(uno::RuntimeException) { diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index d7cec7c17354..c36ae29d4531 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -318,12 +318,17 @@ void UnoWrapper::WindowDestroyed( Window* pWindow ) Window* pTopWindowChild = pWindow->GetWindow( WINDOW_FIRSTTOPWINDOWCHILD ); while ( pTopWindowChild ) { - OSL_ENSURE( pTopWindowChild->GetParent() == pWindow, "UnoWrapper::WindowDestroyed: inconsistency in the SystemWindow relationship!" ); + OSL_ENSURE( pTopWindowChild->GetParent() == pWindow, + "UnoWrapper::WindowDestroyed: inconsistency in the SystemWindow relationship!" ); - uno::Reference< lang::XComponent > xComp( pTopWindowChild->GetComponentInterface( FALSE ), uno::UNO_QUERY ); - pTopWindowChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING ); - if ( xComp.is() ) - xComp->dispose(); + Window* pNextTopChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING ); + + //the window still could be on the stack, so we have to + // use lazy delete ( it will automatically + // disconnect from the currently destroyed parent window ) + pTopWindowChild->doLazyDelete(); + + pTopWindowChild = pNextTopChild; } } } diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 2290cfdbe7c2..e9f98b07adbd 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -243,6 +243,11 @@ void ImplPolygon::ImplSetSize( USHORT nNewSize, BOOL bResize ) void ImplPolygon::ImplSplit( USHORT nPos, USHORT nSpace, ImplPolygon* pInitPoly ) { const ULONG nSpaceSize = nSpace * sizeof( Point ); + + //Can't fit this in :-(, throw ? + if (mnPoints + nSpace > USHRT_MAX) + return; + const USHORT nNewSize = mnPoints + nSpace; if( nPos >= mnPoints ) diff --git a/unotools/inc/unotools/ucbhelper.hxx b/unotools/inc/unotools/ucbhelper.hxx index 687868adbdb4..38b355439c2b 100644 --- a/unotools/inc/unotools/ucbhelper.hxx +++ b/unotools/inc/unotools/ucbhelper.hxx @@ -80,6 +80,7 @@ namespace utl static sal_Bool FindInPath( const String& rPath, const String& rName, String& rFile, char cDelim = ';', BOOL bAllowWildCards = TRUE ); static sal_Bool Find( const String& rFolder, const String& rName, String& rFile, BOOL bAllowWildCards = FALSE ); static sal_Bool IsSubPath( const ::rtl::OUString& rPath, const ::rtl::OUString& rChildCandidate, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProvider >& xContentProvider = ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProvider >() ); + static sal_Bool EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL ); }; } diff --git a/unotools/source/config/menuoptions.cxx b/unotools/source/config/menuoptions.cxx deleted file mode 100644 index 2c5756c2140c..000000000000 --- a/unotools/source/config/menuoptions.cxx +++ /dev/null @@ -1,561 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_unotools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include <unotools/menuoptions.hxx> -#include <unotools/configmgr.hxx> -#include <unotools/configitem.hxx> -#include <tools/debug.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <vcl/svapp.hxx> - -#include <rtl/logfile.hxx> -#include "itemholder1.hxx" - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_MENU OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/View/Menu" )) -#define DEFAULT_DONTHIDEDISABLEDENTRIES sal_False -#define DEFAULT_FOLLOWMOUSE sal_True -#define DEFAULT_MENUICONS 2 - -#define PROPERTYNAME_DONTHIDEDISABLEDENTRIES OUString(RTL_CONSTASCII_USTRINGPARAM("DontHideDisabledEntry" )) -#define PROPERTYNAME_FOLLOWMOUSE OUString(RTL_CONSTASCII_USTRINGPARAM("FollowMouse" )) -#define PROPERTYNAME_SHOWICONSINMENUES OUString(RTL_CONSTASCII_USTRINGPARAM("ShowIconsInMenues" )) -#define PROPERTYNAME_SYSTEMICONSINMENUES OUString(RTL_CONSTASCII_USTRINGPARAM("IsSystemIconsInMenus" )) - -#define PROPERTYHANDLE_DONTHIDEDISABLEDENTRIES 0 -#define PROPERTYHANDLE_FOLLOWMOUSE 1 -#define PROPERTYHANDLE_SHOWICONSINMENUES 2 -#define PROPERTYHANDLE_SYSTEMICONSINMENUES 3 - -#define PROPERTYCOUNT 4 - -#include <tools/link.hxx> -#include <tools/list.hxx> -DECLARE_LIST( LinkList, Link * ) - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -class SvtMenuOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - LinkList aList; - sal_Bool m_bDontHideDisabledEntries ; /// cache "DontHideDisabledEntries" of Menu section - sal_Bool m_bFollowMouse ; /// cache "FollowMouse" of Menu section - sal_Int16 m_nMenuIcons ; /// cache "MenuIcons" of Menu section - - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtMenuOptions_Impl(); - ~SvtMenuOptions_Impl(); - - void AddListener( const Link& rLink ); - void RemoveListener( const Link& rLink ); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @seealso baseclass ConfigItem - - @param "seqPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& seqPropertyNames ); - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short access method to get internal values - @descr These method give us a chance to regulate acces to ouer internal values. - It's not used in the moment - but it's possible for the feature! - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - sal_Bool IsEntryHidingEnabled() const - { return m_bDontHideDisabledEntries; } - - sal_Bool IsFollowMouseEnabled() const - { return m_bFollowMouse; } - - sal_Int16 GetMenuIconsState() const - { return m_nMenuIcons; } - - void SetEntryHidingState ( sal_Bool bState ) - { - m_bDontHideDisabledEntries = bState; - SetModified(); - for ( USHORT n=0; n<aList.Count(); n++ ) - aList.GetObject(n)->Call( this ); - Commit(); - } - - void SetFollowMouseState ( sal_Bool bState ) - { - m_bFollowMouse = bState; - SetModified(); - for ( USHORT n=0; n<aList.Count(); n++ ) - aList.GetObject(n)->Call( this ); - Commit(); - } - - void SetMenuIconsState ( sal_Int16 bState ) - { - m_nMenuIcons = bState; - SetModified(); - for ( USHORT n=0; n<aList.Count(); n++ ) - aList.GetObject(n)->Call( this ); - Commit(); - } - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of fix key names of ouer configuration management which represent oue module tree - @descr These methods return a static const list of key names. We need it to get needed values from our - configuration management. - - @seealso - - - @param - - @return A list of needed configuration keys is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - static Sequence< OUString > impl_GetPropertyNames(); -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtMenuOptions_Impl::SvtMenuOptions_Impl() - // Init baseclasses first - : ConfigItem ( ROOTNODE_MENU ) - // Init member then. - , m_bDontHideDisabledEntries ( DEFAULT_DONTHIDEDISABLEDENTRIES ) - , m_bFollowMouse ( DEFAULT_FOLLOWMOUSE ) - , m_nMenuIcons ( DEFAULT_MENUICONS ) -{ - // Use our static list of configuration keys to get his values. - Sequence< OUString > seqNames = impl_GetPropertyNames(); - Sequence< Any > seqValues = GetProperties( seqNames ) ; - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nI miss some values of configuration keys!\n" ); - - sal_Bool bMenuIcons = true; - sal_Bool bSystemMenuIcons = true; - - // Copy values from list in right order to ouer internal member. - sal_Int32 nPropertyCount = seqValues.getLength() ; - sal_Int32 nProperty = 0 ; - for( nProperty=0; nProperty<nPropertyCount; ++nProperty ) - { - // Safe impossible cases. - // Check any for valid value. - DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nInvalid property value for property detected!\n" ); - switch( nProperty ) - { - case PROPERTYHANDLE_DONTHIDEDISABLEDENTRIES : { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\DontHideDisabledEntry\"?" ); - seqValues[nProperty] >>= m_bDontHideDisabledEntries; - } - break; - - case PROPERTYHANDLE_FOLLOWMOUSE : { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\FollowMouse\"?" ); - seqValues[nProperty] >>= m_bFollowMouse; - } - break; - case PROPERTYHANDLE_SHOWICONSINMENUES : { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\ShowIconsInMenues\"?" ); - seqValues[nProperty] >>= bMenuIcons; - } - break; - case PROPERTYHANDLE_SYSTEMICONSINMENUES : { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\IsSystemIconsInMenus\"?" ); - seqValues[nProperty] >>= bSystemMenuIcons; - } - break; - } - } - - m_nMenuIcons = bSystemMenuIcons ? 2 : bMenuIcons; - - EnableNotification( seqNames ); -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtMenuOptions_Impl::~SvtMenuOptions_Impl() -{ - // Flush data to configuration! - // User has no chance to do that. - if( IsModified() == sal_True ) - { - Commit(); - } - - for ( USHORT n=0; n<aList.Count(); ) - delete aList.Remove(n); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtMenuOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) -{ - // Use given list of updated properties to get his values from configuration directly! - Sequence< Any > seqValues = GetProperties( seqPropertyNames ); - // Safe impossible cases. - // We need values from ALL notified configuration keys. - DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtMenuOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); - - sal_Bool bMenuIcons = true; - sal_Bool bSystemMenuIcons = true; - - // Step over list of property names and get right value from coreesponding value list to set it on internal members! - sal_Int32 nCount = seqPropertyNames.getLength(); - for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty ) - { - if( seqPropertyNames[nProperty] == PROPERTYNAME_DONTHIDEDISABLEDENTRIES ) - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\View\\Menu\\DontHideDisabledEntry\"?" ); - seqValues[nProperty] >>= m_bDontHideDisabledEntries; - } - else if( seqPropertyNames[nProperty] == PROPERTYNAME_FOLLOWMOUSE ) - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\View\\Menu\\FollowMouse\"?" ); - seqValues[nProperty] >>= m_bFollowMouse; - } - else if( seqPropertyNames[nProperty] == PROPERTYNAME_SHOWICONSINMENUES ) - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\ShowIconsInMenues\"?" ); - seqValues[nProperty] >>= bMenuIcons; - } - else if( seqPropertyNames[nProperty] == PROPERTYNAME_SYSTEMICONSINMENUES ) - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\IsSystemIconsInMenus\"?" ); - seqValues[nProperty] >>= bSystemMenuIcons; - } - - #if OSL_DEBUG_LEVEL > 1 - else DBG_ASSERT( sal_False, "SvtMenuOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); - #endif - } - - m_nMenuIcons = bSystemMenuIcons ? 2 : bMenuIcons; - - for ( USHORT n=0; n<aList.Count(); n++ ) - aList.GetObject(n)->Call( this ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtMenuOptions_Impl::Commit() -{ - // Get names of supported properties, create a list for values and copy current values to it. - Sequence< OUString > seqNames = impl_GetPropertyNames(); - sal_Int32 nCount = seqNames.getLength(); - Sequence< Any > seqValues ( nCount ); - for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty ) - { - switch( nProperty ) - { - case PROPERTYHANDLE_DONTHIDEDISABLEDENTRIES : { - seqValues[nProperty] <<= m_bDontHideDisabledEntries; - } - break; - - case PROPERTYHANDLE_FOLLOWMOUSE : { - seqValues[nProperty] <<= m_bFollowMouse; - } - break; - //Output cache of current setting as possibly modified by System Theme for older version - case PROPERTYHANDLE_SHOWICONSINMENUES : { - seqValues[nProperty] <<=(sal_Bool)(Application::GetSettings().GetStyleSettings().GetUseImagesInMenus()); - } - break; - case PROPERTYHANDLE_SYSTEMICONSINMENUES : { - seqValues[nProperty] <<= (m_nMenuIcons == 2 ? sal_True : sal_False) ; - } - break; - } - } - // Set properties in configuration. - PutProperties( seqNames, seqValues ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtMenuOptions_Impl::impl_GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_DONTHIDEDISABLEDENTRIES , - PROPERTYNAME_FOLLOWMOUSE , - PROPERTYNAME_SHOWICONSINMENUES , - PROPERTYNAME_SYSTEMICONSINMENUES - }; - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - // ... and return it. - return seqPropertyNames; -} - -void SvtMenuOptions_Impl::AddListener( const Link& rLink ) -{ - aList.Insert( new Link( rLink ) ); -} - -void SvtMenuOptions_Impl::RemoveListener( const Link& rLink ) -{ - for ( USHORT n=0; n<aList.Count(); n++ ) - { - if ( (*aList.GetObject(n) ) == rLink ) - { - delete aList.Remove(n); - break; - } - } -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtMenuOptions_Impl* SvtMenuOptions::m_pDataContainer = NULL ; -sal_Int32 SvtMenuOptions::m_nRefCount = 0 ; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtMenuOptions::SvtMenuOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already! - if( m_pDataContainer == NULL ) - { - RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtMenuOptions_Impl::ctor()"); - m_pDataContainer = new SvtMenuOptions_Impl(); - - ItemHolder1::holdConfigItem(E_MENUOPTIONS); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtMenuOptions::~SvtMenuOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtMenuOptions::IsEntryHidingEnabled() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsEntryHidingEnabled(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtMenuOptions::IsFollowMouseEnabled() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsFollowMouseEnabled(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtMenuOptions::SetEntryHidingState( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetEntryHidingState( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtMenuOptions::SetFollowMouseState( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetFollowMouseState( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int16 SvtMenuOptions::GetMenuIconsState() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetMenuIconsState(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtMenuOptions::SetMenuIconsState( sal_Int16 bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMenuIconsState( bState ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtMenuOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} - -void SvtMenuOptions::AddListener( const Link& rLink ) -{ - m_pDataContainer->AddListener( rLink ); -} - -void SvtMenuOptions::RemoveListener( const Link& rLink ) -{ - m_pDataContainer->RemoveListener( rLink ); -} diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx index 4160f2f2f443..8befb8a0f209 100644 --- a/unotools/source/ucbhelper/ucbhelper.cxx +++ b/unotools/source/ucbhelper/ucbhelper.cxx @@ -872,5 +872,54 @@ sal_Bool UCBContentHelper::IsSubPath( const ::rtl::OUString& rPath, const ::rtl: return bResult; } +// ----------------------------------------------------------------------- +sal_Bool UCBContentHelper::EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL ) +{ + sal_Bool bResult = sal_False; + + if ( aFirstURL.getLength() && aSecondURL.getLength() ) + { + INetURLObject aFirst( aFirstURL ); + INetURLObject aSecond( aSecondURL ); + + if ( aFirst.GetProtocol() != INET_PROT_NOT_VALID && aSecond.GetProtocol() != INET_PROT_NOT_VALID ) + { + try + { + ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get(); + if ( !pBroker ) + throw uno::RuntimeException(); + + uno::Reference< ::com::sun::star::ucb::XContentIdentifierFactory > xIdFac + = pBroker->getContentIdentifierFactoryInterface(); + if ( !xIdFac.is() ) + throw uno::RuntimeException(); + + uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdFirst + = xIdFac->createContentIdentifier( aFirst.GetMainURL( INetURLObject::NO_DECODE ) ); + uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdSecond + = xIdFac->createContentIdentifier( aSecond.GetMainURL( INetURLObject::NO_DECODE ) ); + + if ( xIdFirst.is() && xIdSecond.is() ) + { + uno::Reference< ::com::sun::star::ucb::XContentProvider > xProvider = + pBroker->getContentProviderInterface(); + if ( !xProvider.is() ) + throw uno::RuntimeException(); + bResult = !xProvider->compareContentIds( xIdFirst, xIdSecond ); + } + } + catch( uno::Exception& ) + { + OSL_ENSURE( sal_False, "Can't compare URL's, treat as different!\n" ); + } + } + } + + return bResult; +} + + + } // namespace utl diff --git a/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm b/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm index 53ab6dd36128..804cf108dba8 100644 --- a/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm +++ b/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm @@ -40,20 +40,23 @@ using namespace ::com::sun::star::uno; +(id)selectedChildrenAttributeForElement:(AquaA11yWrapper *)wrapper { Reference< XAccessibleSelection > xAccessibleSelection = [ wrapper accessibleSelection ]; - NSMutableArray * children = [ [ NSMutableArray alloc ] init ]; - - try { - sal_Int32 n = xAccessibleSelection -> getSelectedAccessibleChildCount(); - for ( sal_Int32 i=0 ; i < n ; ++i ) { - [ children addObject: [ AquaA11yFactory wrapperForAccessible: xAccessibleSelection -> getSelectedAccessibleChild( i ) ] ]; + if( xAccessibleSelection.is() ) + { + NSMutableArray * children = [ [ NSMutableArray alloc ] init ]; + try { + sal_Int32 n = xAccessibleSelection -> getSelectedAccessibleChildCount(); + for ( sal_Int32 i=0 ; i < n ; ++i ) { + [ children addObject: [ AquaA11yFactory wrapperForAccessible: xAccessibleSelection -> getSelectedAccessibleChild( i ) ] ]; + } + + return children; + + } catch ( Exception& e) + { } - - return children; - - } catch ( Exception& e) { - return nil; } + return nil; } diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 96569aa80120..b04fd9c75af7 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -1453,16 +1453,24 @@ BOOL AquaSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, // prepare the target context NSGraphicsContext* pOrigNSCtx = [NSGraphicsContext currentContext]; + [pOrigNSCtx retain]; + + // create new context NSGraphicsContext* pDrawNSCtx = [NSGraphicsContext graphicsContextWithGraphicsPort: mrContext flipped: IsFlipped()]; + // set it, setCurrentContext also releases the prviously set one [NSGraphicsContext setCurrentContext: pDrawNSCtx]; + // draw the EPS const NSRect aDstRect = {{nX,nY},{nWidth,nHeight}}; const BOOL bOK = [xEpsImage drawInRect: aDstRect]; + + // restore the NSGraphicsContext + [NSGraphicsContext setCurrentContext: pOrigNSCtx]; + [pOrigNSCtx release]; // restore the original retain count + CGContextRestoreGState( mrContext ); // mark the destination rectangle as updated RefreshRect( aDstRect ); - // restore the NSGraphicsContext, TODO: do we need this? - [NSGraphicsContext setCurrentContext: pOrigNSCtx]; return bOK; } diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index 6e206977b5c4..9ce2b8a5a518 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -1366,10 +1366,12 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa w = aCtrlBoundRect.GetWidth(); if( w < 3+2*FOCUS_RING_WIDTH ) w = 3+2*FOCUS_RING_WIDTH; - h = TEXT_EDIT_HEIGHT_NORMAL; + h = TEXT_EDIT_HEIGHT_NORMAL+2*FOCUS_RING_WIDTH; + if( h < aCtrlBoundRect.GetHeight() ) + h = aCtrlBoundRect.GetHeight(); - rNativeContentRegion = Rectangle( Point( x+FOCUS_RING_WIDTH, y+FOCUS_RING_WIDTH ), Size( w-2*FOCUS_RING_WIDTH-2, h-2 ) ); - rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h+2*FOCUS_RING_WIDTH ) ); + rNativeContentRegion = Rectangle( Point( x+FOCUS_RING_WIDTH, y+FOCUS_RING_WIDTH ), Size( w-2*(FOCUS_RING_WIDTH+1), h-2*(FOCUS_RING_WIDTH+1) ) ); + rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h ) ); toReturn = TRUE; } diff --git a/vcl/inc/vcl/arrange.hxx b/vcl/inc/vcl/arrange.hxx index 8846d9bbe948..83568609f87b 100644 --- a/vcl/inc/vcl/arrange.hxx +++ b/vcl/inc/vcl/arrange.hxx @@ -48,7 +48,7 @@ namespace vcl or a child WindowArranger (a node in the hierarchy), but never both */ - class WindowArranger + class VCL_DLLPUBLIC WindowArranger { protected: struct Element @@ -189,7 +189,7 @@ namespace vcl } }; - class RowOrColumn : public WindowArranger + class VCL_DLLPUBLIC RowOrColumn : public WindowArranger { long m_nBorderWidth; bool m_bColumn; @@ -230,7 +230,7 @@ namespace vcl long getBorderWidth() const { return m_nBorderWidth; } }; - class LabeledElement : public WindowArranger + class VCL_DLLPUBLIC LabeledElement : public WindowArranger { WindowArranger::Element m_aLabel; WindowArranger::Element m_aElement; @@ -274,7 +274,7 @@ namespace vcl { return m_aElement.getOptimalSize( i_eType ); } }; - class LabelColumn : public RowOrColumn + class VCL_DLLPUBLIC LabelColumn : public RowOrColumn { long getLabelWidth() const; public: @@ -291,7 +291,7 @@ namespace vcl size_t addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent = 0 ); }; - class Indenter : public WindowArranger + class VCL_DLLPUBLIC Indenter : public WindowArranger { long m_nIndent; WindowArranger::Element m_aElement; @@ -325,7 +325,7 @@ namespace vcl { setChild( boost::shared_ptr<WindowArranger>( i_pChild ), i_nExpandPrio ); } }; - class Spacer : public WindowArranger + class VCL_DLLPUBLIC Spacer : public WindowArranger { WindowArranger::Element m_aElement; Size m_aSize; @@ -351,7 +351,7 @@ namespace vcl virtual bool isVisible() const { return true; } }; - class MatrixArranger : public WindowArranger + class VCL_DLLPUBLIC MatrixArranger : public WindowArranger { long m_nBorderX; long m_nBorderY; diff --git a/vcl/inc/vcl/combobox.hxx b/vcl/inc/vcl/combobox.hxx index e35474a84d53..640c70e7116f 100644 --- a/vcl/inc/vcl/combobox.hxx +++ b/vcl/inc/vcl/combobox.hxx @@ -138,6 +138,7 @@ public: USHORT GetEntryPos( const XubString& rStr ) const; USHORT GetEntryPos( const void* pData ) const; + Image GetEntryImage( USHORT nPos ) const; XubString GetEntry( USHORT nPos ) const; USHORT GetEntryCount() const; diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index 38c025b5a5af..d0baec53b720 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -17,6 +17,7 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\inc\vcl\alpha.hxx %_DEST%\inc%_EXT%\vcl\alpha.hxx ..\inc\vcl\animate.hxx %_DEST%\inc%_EXT%\vcl\animate.hxx ..\inc\vcl\apptypes.hxx %_DEST%\inc%_EXT%\vcl\apptypes.hxx +..\inc\vcl\arrange.hxx %_DEST%\inc%_EXT%\vcl\arrange.hxx ..\inc\vcl\bitmap.hxx %_DEST%\inc%_EXT%\vcl\bitmap.hxx ..\inc\vcl\bitmapex.hxx %_DEST%\inc%_EXT%\vcl\bitmapex.hxx ..\inc\vcl\bmpacc.hxx %_DEST%\inc%_EXT%\vcl\bmpacc.hxx diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 8efa3404a44a..5b2e8755e5c8 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1010,6 +1010,14 @@ void ComboBox::Clear() mpImplLB->Clear(); CallEventListeners( VCLEVENT_COMBOBOX_ITEMREMOVED, (void*) sal_IntPtr(-1) ); } +// ----------------------------------------------------------------------- + +Image ComboBox::GetEntryImage( USHORT nPos ) const +{ + if ( mpImplLB->GetEntryList()->HasEntryImage( nPos ) ) + return mpImplLB->GetEntryList()->GetEntryImage( nPos ); + return Image(); +} // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 818a31a10c0f..d36a18a1afba 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -873,8 +873,8 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY ) { aOffset = aMapVDev.LogicToPixel( aBaseOffset, GetPrefMapMode() ); MapMode aMap( aMapVDev.GetMapMode() ); - aOffset.Width() = aOffset.Width() * (double)aMap.GetScaleX(); - aOffset.Height() = aOffset.Height() * (double)aMap.GetScaleY(); + aOffset.Width() = static_cast<long>(aOffset.Width() * (double)aMap.GetScaleX()); + aOffset.Height() = static_cast<long>(aOffset.Height() * (double)aMap.GetScaleY()); } else aOffset = aMapVDev.LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev.GetMapMode() ); diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 8b4bf5163839..d8581cc3fa7a 100755 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -175,6 +175,7 @@ public: // if set, pages are centered and trimmed onto the fixed page Size maFixedPageSize; sal_Int32 mnDefaultPaperBin; + sal_Int32 mnFixedPaperBin; ImplPrinterControllerData() : mbFirstPage( sal_True ), @@ -182,7 +183,8 @@ public: mbReversePageOrder( sal_False ), meJobState( view::PrintableState_JOB_STARTED ), mpProgress( NULL ), - mnDefaultPaperBin( -1 ) + mnDefaultPaperBin( -1 ), + mnFixedPaperBin( -1 ) {} ~ImplPrinterControllerData() { delete mpProgress; } @@ -728,6 +730,7 @@ void PrinterController::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), makeAny( rtl::OUString( i_rPrinter->GetName() ) ) ); mpImplData->mnDefaultPaperBin = mpImplData->mpPrinter->GetPaperBin(); + mpImplData->mnFixedPaperBin = -1; } bool PrinterController::setupPrinter( Window* i_pParent ) @@ -735,15 +738,20 @@ bool PrinterController::setupPrinter( Window* i_pParent ) bool bRet = false; if( mpImplData->mpPrinter.get() ) { + // get old data Size aPaperSize( mpImplData->mpPrinter->PixelToLogic( mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); + USHORT nPaperBin = mpImplData->mpPrinter->GetPaperBin(); + + // call driver setup bRet = mpImplData->mpPrinter->Setup( i_pParent ); if( bRet ) { - // was the papersize overridden ? if so we need to take action + // was papersize or bin overridden ? if so we need to take action Size aNewPaperSize( mpImplData->mpPrinter->PixelToLogic( mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); - if( aNewPaperSize != aPaperSize ) + USHORT nNewPaperBin = mpImplData->mpPrinter->GetPaperBin(); + if( aNewPaperSize != aPaperSize || nNewPaperBin != nPaperBin ) { mpImplData->maFixedPageSize = aNewPaperSize; mpImplData->maPageCache.invalidate(); @@ -752,6 +760,7 @@ bool PrinterController::setupPrinter( Window* i_pParent ) aOverrideSize.Height = aNewPaperSize.Height(); setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OverridePageSize" ) ), makeAny( aOverrideSize ) ); + mpImplData->mnFixedPaperBin = nNewPaperBin; } } } @@ -1149,8 +1158,13 @@ void PrinterController::printFilteredPage( int i_nPage ) mpImplData->mpPrinter->SetMapMode( MAP_100TH_MM ); // aPageSize was filtered through mpImplData->getRealPaperSize already by getFilteredPageFile() mpImplData->mpPrinter->SetPaperSizeUser( aPageSize.aSize, ! mpImplData->isFixedPageSize() ); + if( mpImplData->mnFixedPaperBin != -1 && + mpImplData->mpPrinter->GetPaperBin() != mpImplData->mnFixedPaperBin ) + { + mpImplData->mpPrinter->SetPaperBin( mpImplData->mnFixedPaperBin ); + } - // if full paper are is meant, move the output to accomodate for pageoffset + // if full paper is meant to be used, move the output to accomodate for pageoffset if( aPageSize.bFullPaper ) { Point aPageOffset( mpImplData->mpPrinter->GetPageOffset() ); diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx index d4ee01c26d61..322b2937b5c9 100644 --- a/vcl/source/window/seleng.cxx +++ b/vcl/source/window/seleng.cxx @@ -218,8 +218,15 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) Point aPos = rMEvt.GetPosPixel(); aLastMove = rMEvt; - pWin->CaptureMouse(); - nFlags |= SELENG_IN_SEL; + if( !rMEvt.IsRight() ) + { + pWin->CaptureMouse(); + nFlags |= SELENG_IN_SEL; + } + else + { + nModifier = 0; + } switch ( nModifier ) { @@ -327,7 +334,7 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) |* *************************************************************************/ -BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& /* rMEvt */ ) +BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt ) { aWTimer.Stop(); //DbgOut("Up"); @@ -336,7 +343,11 @@ BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& /* rMEvt */ ) nFlags &= ~(SELENG_CMDEVT | SELENG_WAIT_UPEVT | SELENG_IN_SEL); return FALSE; } - pWin->ReleaseMouse(); + + if( !rMEvt.IsRight() ) + { + pWin->ReleaseMouse(); + } if( (nFlags & SELENG_WAIT_UPEVT) && !(nFlags & SELENG_CMDEVT) && eSelMode != SINGLE_SELECTION) diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index f3624ef56f59..f6a37658b79f 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -773,7 +773,7 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData ) BOOL bWrapped = FALSE; while( pWin ) { - if( !pWin->ImplIsRealParentPath( this ) && + if( !pWin->ImplIsRealParentPath( this ) && ( pWin != this ) && pWin->ImplGetWindow()->IsTopWindow() && pWin->mpWindowImpl->mbReallyVisible ) { SalFrameGeometry g = pWin->mpWindowImpl->mpFrame->GetGeometry(); diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index ad33cdf67de6..076e36291ae6 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -91,7 +91,7 @@ atk_wrapper_focus_idle_handler (gpointer data) // also emit state-changed:focused event under the same condition. { AtkObjectWrapper* wrapper_obj = ATK_OBJECT_WRAPPER (atk_obj); - if( !wrapper_obj->mpText && wrapper_obj->mpContext ) + if( wrapper_obj && !wrapper_obj->mpText && wrapper_obj->mpContext ) { uno::Any any = wrapper_obj->mpContext->queryInterface( accessibility::XAccessibleText::static_type(NULL) ); if ( typelib_TypeClass_INTERFACE == any.pType->eTypeClass && diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index b8a3ac773a8f..447a970f6bcd 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -1047,8 +1047,9 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, GtkRequisition aReq; gtk_widget_size_request( widget, &aReq ); Rectangle aEditRect = rControlRegion; + long nHeight = (aEditRect.GetHeight() > aReq.height+1) ? aEditRect.GetHeight() : aReq.height+1; aEditRect = Rectangle( aEditRect.TopLeft(), - Size( aEditRect.GetWidth(), aReq.height+1 ) ); + Size( aEditRect.GetWidth(), nHeight ) ); rNativeBoundingRegion = aEditRect; rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index c6ff16f8395b..e8b55ebfa895 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -1452,12 +1452,6 @@ void GtkSalFrame::setMinMaxSize() aHints |= GDK_HINT_MAX_SIZE; } } - if( m_bFullscreen ) - { - aGeo.max_width = m_aMaxSize.Width(); - aGeo.max_height = m_aMaxSize.Height(); - aHints |= GDK_HINT_MAX_SIZE; - } if( aHints ) gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow), NULL, @@ -1832,7 +1826,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) // workaround different legacy version window managers have different opinions about // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin) if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + { + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) ); + } if( bVisible ) Show( TRUE ); } @@ -1863,11 +1861,8 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) { if( bFullScreen ) { - if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) - { - if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); - } + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); gtk_window_fullscreen( GTK_WINDOW(m_pWindow) ); moveToScreen( nScreen ); Size aScreenSize = pDisp->GetScreenSize( m_nScreen ); @@ -1879,11 +1874,8 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) else { gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) ); - if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) - { - if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE ); - } + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE ); moveToScreen( nScreen ); } } @@ -2849,12 +2841,52 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f return FALSE; } +IMPL_LINK( GtkSalFrame, ImplDelayedFullScreenHdl, void*, EMPTYARG ) +{ + Atom nStateAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE); + Atom nFSAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE_FULLSCREEN ); + if( nStateAtom && nFSAtom ) + { + /* #i110881# workaround a gtk issue (see https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8) + gtk_window_fullscreen can fail due to a race condition, request an additional status change + to fullscreen to be safe + */ + XEvent aEvent; + aEvent.type = ClientMessage; + aEvent.xclient.display = getDisplay()->GetDisplay(); + aEvent.xclient.window = GDK_WINDOW_XWINDOW(m_pWindow->window); + aEvent.xclient.message_type = nStateAtom; + aEvent.xclient.format = 32; + aEvent.xclient.data.l[0] = 1; + aEvent.xclient.data.l[1] = nFSAtom; + aEvent.xclient.data.l[2] = 0; + aEvent.xclient.data.l[3] = 0; + aEvent.xclient.data.l[4] = 0; + XSendEvent( getDisplay()->GetDisplay(), + getDisplay()->GetRootWindow( m_nScreen ), + False, + SubstructureNotifyMask | SubstructureRedirectMask, + &aEvent + ); + } + + return 0; +} + gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame ) { GtkSalFrame* pThis = (GtkSalFrame*)frame; GTK_YIELD_GRAB(); + if( pThis->m_bFullscreen ) + { + /* #i110881# workaorund a gtk issue (see https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8) + gtk_window_fullscreen can run into a race condition with the window's showstate + */ + Application::PostUserEvent( LINK( pThis, GtkSalFrame, ImplDelayedFullScreenHdl ) ); + } + bool bSetFocus = pThis->m_bSetFocusOnMap; pThis->m_bSetFocusOnMap = false; if( ImplGetSVData()->mbIsTestTool ) diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx index 18dd476fc2c4..d47e5fb50fca 100644 --- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx @@ -38,6 +38,8 @@ #include <vcl/salframe.hxx> #include <vcl/sysdata.hxx> +#include "tools/link.hxx" + #include <list> #include <vector> @@ -265,6 +267,8 @@ class GtkSalFrame : public SalFrame void setMinMaxSize(); void createNewWindow( XLIB_Window aParent, bool bXEmbed, int nScreen ); void askForXEmbedFocus( sal_Int32 nTimecode ); + + DECL_LINK( ImplDelayedFullScreenHdl, void* ); public: GtkSalFrame( SalFrame* pParent, ULONG nStyle ); GtkSalFrame( SystemParentData* pSysData ); diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx index 1a116fcbe8d6..aa2e4c84ef24 100644 --- a/vcl/unx/source/app/wmadaptor.cxx +++ b/vcl/unx/source/app/wmadaptor.cxx @@ -2180,6 +2180,15 @@ void NetWMAdaptor::showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const if( m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ] ) { pFrame->mbFullScreen = bFullScreen; + if( bFullScreen ) + { + if( m_aWMAtoms[ MOTIF_WM_HINTS ] ) + { + XDeleteProperty( m_pDisplay, + pFrame->GetShellWindow(), + m_aWMAtoms[ MOTIF_WM_HINTS ] ); + } + } if( pFrame->bMapped_ ) { // window already mapped, send WM a message diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index 04bc3f13ce4d..b864b7cb2685 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -391,7 +391,7 @@ SHL4STDLIBS+= $(XRANDR_LIBS) .ENDIF .ENDIF -.IF "$(OS)$(CPU)" == "LINUXX" +.IF "$(OS)$(CPU)" == "LINUXX" && "$(LIBRARY_PATH)" != "" EXTRALIBPATHS+=-L$(LIBRARY_PATH) .ENDIF # "$(OS)$(CPU)" == "LINUXX" .ENDIF # "$(ENABLE_GTK)" != "" diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 806d3b420b33..bc80cbf94fb8 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -2203,7 +2203,9 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ ) const int k = mpGlyphs2Chars[ i ]; mpGlyphs2Chars[ j ] = k; const int nRelGlyphPos = (j++) - rVI.mnMinGlyphPos; - mpLogClusters[ k ] = static_cast<WORD>(nRelGlyphPos); + if( k < 0) // extra glyphs are already mapped + continue; + mpLogClusters[ k ] = static_cast<WORD>(nRelGlyphPos); } rVI.mnEndGlyphPos = j; |