summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2017-09-01 00:04:09 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-09-05 16:09:06 +0200
commita897c5ed86c6d8981305bf725e83c76e4e3a36d0 (patch)
tree138df502db98ac6b5a14ffc5dfbc7e0ab1309fc2
parentada87712ebc00b547e29fe31052e56f3495ea226 (diff)
tdf#109202: pass arg of --convert-images-to to (f)odt filter
Tunelling 1 piece of information through 20 layers of abstraction Advanced tunelling all the way to sfx2 Exhausted beyond recognition arrived to [Flat]ODF filter Change-Id: I0597c20c28f5cf8e2c60c4398622b36bda83abd0 Reviewed-on: https://gerrit.libreoffice.org/41777 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--desktop/source/app/dispatchwatcher.cxx26
-rw-r--r--desktop/source/app/officeipcthread.cxx7
-rw-r--r--include/sfx2/docfile.hxx1
-rw-r--r--include/sfx2/sfxsids.hrc1
-rw-r--r--include/xmloff/xmlexp.hxx1
-rw-r--r--sfx2/source/appl/appuno.cxx18
-rw-r--r--sfx2/source/doc/docfile.cxx6
-rw-r--r--xmloff/source/core/xmlexp.cxx5
8 files changed, 62 insertions, 3 deletions
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index 4f31d226b4bf..c33dcaf61c8d 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -583,9 +583,12 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
OUString aParam = aDispatchRequest.aPrinterName;
sal_Int32 nPathIndex = aParam.lastIndexOf( ';' );
sal_Int32 nFilterIndex = aParam.indexOf( ':' );
+ sal_Int32 nImgFilterIndex = aParam.lastIndexOf( '|' );
if( nPathIndex < nFilterIndex )
nFilterIndex = -1;
- OUString aFilterOut=aParam.copy( nPathIndex+1 );
+
+ OUString aFilterOut;
+ OUString aImgOut;
OUString aFilter;
OUString aFilterExt;
bool bGuess = false;
@@ -601,6 +604,15 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
bGuess = true;
aFilterExt = aParam.copy( 0, nPathIndex );
}
+
+ if( nImgFilterIndex >= 0 )
+ {
+ aImgOut = aParam.copy( nImgFilterIndex+1 );
+ aFilterOut = aParam.copy( nPathIndex+1, nImgFilterIndex-nPathIndex-1 );
+ }
+ else
+ aFilterOut = aParam.copy( nPathIndex+1 );
+
INetURLObject aOutFilename( aObj );
aOutFilename.SetExtension( aFilterExt );
FileBase::getFileURLFromSystemPath( aFilterOut, aFilterOut );
@@ -633,7 +645,11 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
else
{
sal_Int32 nFilterOptionsIndex = aFilter.indexOf(':');
- Sequence<PropertyValue> conversionProperties( 0 < nFilterOptionsIndex ? 3 : 2 );
+ sal_Int32 nProps = ( 0 < nFilterOptionsIndex ) ? 3 : 2;
+
+ if ( !aImgOut.isEmpty() )
+ nProps +=1;
+ Sequence<PropertyValue> conversionProperties( nProps );
conversionProperties[0].Name = "Overwrite";
conversionProperties[0].Value <<= true;
@@ -650,6 +666,12 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
conversionProperties[1].Value <<= aFilter;
}
+ if ( !aImgOut.isEmpty() )
+ {
+ conversionProperties[nProps-1].Name = "ImageFilter";
+ conversionProperties[nProps-1].Value <<= aImgOut;
+ }
+
OUString aTempName;
FileBase::getSystemPathFromFileURL(aName, aTempName);
OString aSource8 = OUStringToOString(aTempName, osl_getThreadTextEncoding());
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index 4abd35437868..01abf03b9a6f 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -1291,6 +1291,7 @@ static void AddConversionsToDispatchList(
const OUString& rPrinterName,
const OUString& rFactory,
const OUString& rParamOut,
+ const OUString& rImgOut,
const bool isTextCat,
const bool isScriptCat )
{
@@ -1317,6 +1318,7 @@ static void AddConversionsToDispatchList(
}
OUString aOutDir( rParamOut.trim() );
+ OUString aImgOut( rImgOut.trim() );
OUString aPWD;
if (cwdUrl)
{
@@ -1341,6 +1343,9 @@ static void AddConversionsToDispatchList(
aParam += ";" + aPWD;
}
+ if( !rImgOut.trim().isEmpty() )
+ aParam += "|" + aImgOut;
+
for (std::vector< OUString >::const_iterator i(rRequestList.begin());
i != rRequestList.end(); ++i)
{
@@ -1366,7 +1371,7 @@ bool RequestHandler::ExecuteCmdLineRequests(
AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aPrintToList, DispatchWatcher::REQUEST_PRINTTO, aRequest.aPrinterName, aRequest.aModule );
AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aForceOpenList, DispatchWatcher::REQUEST_FORCEOPEN, "", aRequest.aModule );
AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aForceNewList, DispatchWatcher::REQUEST_FORCENEW, "", aRequest.aModule );
- AddConversionsToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aConversionList, aRequest.aConversionParams, aRequest.aPrinterName, aRequest.aModule, aRequest.aConversionOut, aRequest.bTextCat, aRequest.bScriptCat );
+ AddConversionsToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aConversionList, aRequest.aConversionParams, aRequest.aPrinterName, aRequest.aModule, aRequest.aConversionOut, aRequest.aImageConversionType, aRequest.bTextCat, aRequest.bScriptCat );
bool bShutdown( false );
if ( pGlobal.is() )
diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx
index fc44f2d9ce86..9fd18fda2782 100644
--- a/include/sfx2/docfile.hxx
+++ b/include/sfx2/docfile.hxx
@@ -202,6 +202,7 @@ public:
void SetInCheckIn( bool bInCheckIn );
bool IsInCheckIn( );
bool IsSkipImages( );
+ OUString GetConvertImagesFilter();
SAL_DLLPRIVATE bool HasStorage_Impl() const;
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 6fdd02c4caf6..7ed7e1e0c728 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -102,6 +102,7 @@
#define SID_SIGNPDF (SID_SFX_START + 519)
#define SID_SAVEACOPY (SID_SFX_START + 999)
#define SID_SAVEACOPYITEM (SID_SFX_START + 998)
+#define SID_CONVERT_IMAGES (SID_SFX_START + 997)
#define SID_CLOSING (SID_SFX_START +1539)
#define SID_CLOSEDOC (SID_SFX_START + 503)
#define SID_CLOSEDOCS (SID_SFX_START + 595)
diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
index e4a390a5ef6a..f981929b3fe7 100644
--- a/include/xmloff/xmlexp.hxx
+++ b/include/xmloff/xmlexp.hxx
@@ -138,6 +138,7 @@ class XMLOFF_DLLPUBLIC SvXMLExport : public cppu::WeakImplHelper<
OUString msGraphicObjectProtocol;
OUString msEmbeddedObjectProtocol;
OUString msFilterName;
+ OUString msImgFilterName;
SvXMLNamespaceMap *mpNamespaceMap; // the namepspace map
SvXMLUnitConverter maUnitConv; // the unit converter
SvXMLNumFmtExport *mpNumExport;
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 352dbcfb5511..8739f8f656a0 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -162,6 +162,7 @@ static char const sEncryptionData[] = "EncryptionData";
static char const sFailOnWarning[] = "FailOnWarning";
static char const sDocumentService[] = "DocumentService";
static char const sFilterProvider[] = "FilterProvider";
+static char const sImageFilter[] = "ImageFilter";
static bool isMediaDescriptor( sal_uInt16 nSlotId )
{
@@ -733,6 +734,14 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert
if (bOK)
rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) );
}
+ else if ( aName == sImageFilter )
+ {
+ OUString sVal;
+ bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
+ DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
+ if (bOK)
+ rSet.Put( SfxStringItem( SID_CONVERT_IMAGES, sVal ) );
+ }
else if ( aName == sMacroExecMode )
{
sal_Int16 nVal =-1;
@@ -1055,6 +1064,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
nAdditional++;
if (rSet.HasItem(SID_FILTER_PROVIDER))
++nAdditional;
+ if ( rSet.GetItemState( SID_CONVERT_IMAGES ) == SfxItemState::SET )
+ nAdditional++;
// consider additional arguments
nProps += nAdditional;
@@ -1196,6 +1207,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
continue;
if (nId == SID_FILTER_PROVIDER)
continue;
+ if ( nId == SID_CONVERT_IMAGES )
+ continue;
// used only internally
if ( nId == SID_SAVETO )
@@ -1597,6 +1610,11 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
pValue[nActProp].Name = sFilterProvider;
pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
}
+ if (rSet.HasItem(SID_CONVERT_IMAGES, &pItem))
+ {
+ pValue[nActProp].Name = sImageFilter;
+ pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
+ }
}
rArgs = aSequ;
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 7930427925cf..f37a6c62746d 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -473,6 +473,12 @@ bool SfxMedium::IsSkipImages()
return pSkipImagesItem && pSkipImagesItem->GetValue() == "SkipImages";
}
+OUString SfxMedium::GetConvertImagesFilter()
+{
+ const SfxStringItem* pConvertItem = GetItemSet()->GetItem<SfxStringItem>(SID_CONVERT_IMAGES);
+ return ( pConvertItem ? pConvertItem->GetValue() : OUString() );
+}
+
SvStream* SfxMedium::GetInStream()
{
if ( pImpl->m_pInStream )
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 874a330882b3..cd8442d08fa1 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -816,6 +816,11 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue
if (!(rValue >>= mpImpl->maDestShellID))
return false;
}
+ else if( rPropName == "ImageFilter")
+ {
+ if (!(rValue >>= msImgFilterName))
+ return false;
+ }
}