summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorThorsten Behrens <thorsten.behrens@allotropia.de>2023-01-16 23:59:06 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2023-11-19 18:17:47 +0100
commit346e9d3c363046a645e55d736f372d2127b9d52c (patch)
tree5927daf3e4deb6c116f6c32d5bef003ca85835df /sfx2
parent882679502f83e3933d722876e19e6b990b754228 (diff)
Revert "WASM pdf conversion through emscripten and qt5"
This reverts commit f814cc609f37d94075c32bddea97d7ba5b4fea32.
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx7
-rw-r--r--sfx2/source/doc/guisaveas.cxx47
-rw-r--r--sfx2/source/doc/objstor.cxx73
-rw-r--r--sfx2/source/doc/objxtor.cxx2
4 files changed, 4 insertions, 125 deletions
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 9a8b938aab23..96955837c8a6 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1628,12 +1628,7 @@ void FileDialogHelper_Impl::getRealFilter( OUString& _rFilter ) const
_rFilter = getCurrentFilterUIName();
if ( _rFilter.isEmpty() )
- {
- if (isShowFilterExtensionEnabled())
- _rFilter = getFilterName(maCurFilter);
- else
- _rFilter = maCurFilter;
- }
+ _rFilter = maCurFilter;
if ( !_rFilter.isEmpty() && mpMatcher )
{
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 5b17b2a1b029..1c013c4a382b 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1641,53 +1641,10 @@ bool SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
if ( aDenyListIter != aModelData.GetMediaDescr().end() )
aDenyListIter->second >>= aDenyList;
- bool bWasmPdfExport = false;
-#ifdef EMSCRIPTEN
- // Do not create file dialoge for direct pdf export, (just a workaround for WASM pdf export now)
- // because that is still buggy on the Qt side
- if ( nStoreMode & PDFDIRECTEXPORT_REQUESTED )
- {
- // preselect a filter for the storing process
- ::comphelper::SequenceAsHashMap aFilterPropsHM( aFilterProps );
-
- // this is a WASM direct pdf export
- const OUString aFilterUIName = aFilterPropsHM.getUnpackedValueOrDefault( "UIName", OUString() );
- if (aFilterUIName == "PDF - Portable Document Format")
- {
- OUString realfiltername;
- const OUString aDocServiceName{ aModelData.GetDocServiceName() };
- if ( aDocServiceName == "com.sun.star.drawing.DrawingDocument" )
- realfiltername = "draw_pdf_Export";
- else if ( aDocServiceName == "com.sun.star.presentation.PresentationDocument" )
- realfiltername = "impress_pdf_Export";
- else if ( aDocServiceName == "com.sun.star.text.TextDocument" )
- realfiltername = "writer_pdf_Export";
- else if ( aDocServiceName == "com.sun.star.sheet.SpreadsheetDocument" )
- realfiltername = "calc_pdf_Export";
-
- if (realfiltername.endsWith("pdf_Export"))
- {
- const OUString aRecommendedDir {aModelData.GetRecommendedDir( aSuggestedDir )};
- OUString aAdjustToType = aFilterPropsHM.getUnpackedValueOrDefault( "Type", OUString() );
- const OUString aRecommendedName {aModelData.GetRecommendedName( aSuggestedName, aAdjustToType )};
- OUString aTempURL = aRecommendedDir + aRecommendedName;
- INetURLObject aURL2(aTempURL);
- aModelData.GetMediaDescr()[OUString("URL")] <<= aURL2.GetMainURL( INetURLObject::DecodeMechanism::NONE );
- aModelData.GetMediaDescr()[sFilterNameString] <<= realfiltername;
- bWasmPdfExport = true;
- }
- }
- }
-#endif // EMSCRIPTEN
-
for (;;)
{
// in case the dialog is opened a second time the folder should be the same as previously navigated to by the user, not what was handed over by initial parameters
- if (!bWasmPdfExport)
- bUseFilterOptions = aModelData.OutputFileDialog( nStoreMode, aFilterProps, bSetStandardName, aSuggestedName, bPreselectPassword, aSuggestedDir, nDialog, sStandardDir, aDenyList );
- else
- bUseFilterOptions = true;
-
+ bUseFilterOptions = aModelData.OutputFileDialog( nStoreMode, aFilterProps, bSetStandardName, aSuggestedName, bPreselectPassword, aSuggestedDir, nDialog, sStandardDir, aDenyList );
if ( nStoreMode == SAVEAS_REQUESTED )
{
// in case of saving check filter for possible alien warning
@@ -1708,7 +1665,7 @@ bool SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
break;
}
- bDialogUsed = !bWasmPdfExport;
+ bDialogUsed = true;
aFileNameIter = aModelData.GetMediaDescr().find( OUString("URL") );
}
else
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 4bfb92111037..b39b5d14ee38 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -3006,39 +3006,6 @@ bool SfxObjectShell::PreDoSaveAs_Impl(const OUString& rFileName, const OUString&
if( bOk )
{
-#ifdef EMSCRIPTEN
- if (aFilterName.endsWith("pdf_Export"))
- {
- try
- {
- sal_Int32 nRead;
- Reference<io::XInputStream> aTempInput = pNewFile->GetInputStream();
- sal_Int32 nBufferSize = 32767;
- Sequence<sal_Int8> aSequence(nBufferSize);
- emscripten::val contentArray = emscripten::val::array();
-
- do
- {
- nRead = aTempInput->readBytes(aSequence, nBufferSize);
- if (nRead < nBufferSize)
- {
- Sequence<sal_Int8> aTempBuf(aSequence.getConstArray(), nRead);
- ReadWASMFile(contentArray, nRead, aTempBuf);
- }
- else
- {
- ReadWASMFile(contentArray, nRead, aSequence);
- }
- } while (nRead == nBufferSize);
-
- WriteWASMFile(contentArray, pNewFile->GetName());
- }
- catch (const Exception&)
- {
- }
- }
-#endif
-
if( !bCopyTo )
SetModified( false );
}
@@ -3083,46 +3050,6 @@ bool SfxObjectShell::PreDoSaveAs_Impl(const OUString& rFileName, const OUString&
return bOk;
}
-#ifdef EMSCRIPTEN
-void SfxObjectShell::ReadWASMFile(emscripten::val& contentArray, sal_Int32 nRead, css::uno::Sequence<sal_Int8>& aContent)
-{
- emscripten::val fileContentView = emscripten::val(emscripten::typed_memory_view(
- nRead,
- reinterpret_cast<const char*>(aContent.getConstArray())));
- emscripten::val fileContentCopy = emscripten::val::global("ArrayBuffer").new_(nRead);
- emscripten::val fileContentCopyView = emscripten::val::global("Uint8Array").new_(fileContentCopy);
- fileContentCopyView.call<void>("set", fileContentView);
- contentArray.call<void>("push", fileContentCopyView);
-}
-
-
-void SfxObjectShell::WriteWASMFile(emscripten::val& contentArray, const OUString& rFileName)
-{
- INetURLObject aURL(rFileName);
- OUString aNewname = aURL.GetLastName(INetURLObject::DecodeMechanism::WithCharset);
-
- emscripten::val document = emscripten::val::global("document");
- emscripten::val window = emscripten::val::global("window");
-
- emscripten::val type = emscripten::val::object();
- type.set("type","application/octet-stream");
- emscripten::val contentBlob = emscripten::val::global("Blob").new_(contentArray, type);
-
- emscripten::val contentUrl = window["URL"].call<emscripten::val>("createObjectURL", contentBlob);
- emscripten::val contentLink = document.call<emscripten::val>("createElement", std::string("a"));
- contentLink.set("href", contentUrl);
- contentLink.set("download", aNewname.toUtf8().getStr());
- contentLink.set("style", "display:none");
-
- emscripten::val body = document["body"];
- body.call<void>("appendChild", contentLink);
- contentLink.call<void>("click");
- body.call<void>("removeChild", contentLink);
-
- window["URL"].call<emscripten::val>("revokeObjectURL", contentUrl);
-}
-#endif
-
bool SfxObjectShell::LoadFrom( SfxMedium& /*rMedium*/ )
{
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 5ee43348d0b2..2fd5df242fcc 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -877,7 +877,6 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
if ( _rxComponent == xOldCurrentComp )
// nothing to do
return;
- rTheCurrentComponent = _rxComponent;
// note that "_rxComponent.get() == s_xCurrentComponent.get().get()" is /sufficient/, but not
// /required/ for "_rxComponent == s_xCurrentComponent.get()".
// In other words, it's still possible that we here do something which is not necessary,
@@ -885,6 +884,7 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
#if HAVE_FEATURE_SCRIPTING
BasicManager* pAppMgr = SfxApplication::GetBasicManager();
+ rTheCurrentComponent = _rxComponent;
if ( !pAppMgr )
return;