Kaydet (Commit) a897c5ed authored tarafından Katarina Behrens's avatar Katarina Behrens Kaydeden (comit) Thorsten Behrens

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/41777Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst ada87712
......@@ -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());
......
......@@ -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() )
......
......@@ -202,6 +202,7 @@ public:
void SetInCheckIn( bool bInCheckIn );
bool IsInCheckIn( );
bool IsSkipImages( );
OUString GetConvertImagesFilter();
SAL_DLLPRIVATE bool HasStorage_Impl() const;
......
......@@ -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)
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 )
......
......@@ -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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment