import libreoffice-6.4.7.2-6.el8
This commit is contained in:
parent
2cd2f03381
commit
4f82457441
@ -0,0 +1,72 @@
|
|||||||
|
From 5c705fbd9e4d231fed87b7e8ac06d8b7d4c6891f Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
||||||
|
Date: Thu, 12 Aug 2021 12:55:30 +0100
|
||||||
|
Subject: [PATCH] Resolves: tdf#132739 two style tags where there should be
|
||||||
|
just one
|
||||||
|
|
||||||
|
Change-Id: Id9c8c8cc8c5ffdd21ba79ff39a6279cf2ddc8025
|
||||||
|
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120360
|
||||||
|
Tested-by: Jenkins
|
||||||
|
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
|
||||||
|
---
|
||||||
|
sw/source/filter/html/css1atr.cxx | 4 +++-
|
||||||
|
sw/source/filter/html/htmltabw.cxx | 9 ++++++---
|
||||||
|
sw/source/filter/html/wrthtml.hxx | 2 +-
|
||||||
|
3 files changed, 10 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
|
||||||
|
index 7b1a5cc19be3..c401d95a788f 100644
|
||||||
|
--- a/sw/source/filter/html/css1atr.cxx
|
||||||
|
+++ b/sw/source/filter/html/css1atr.cxx
|
||||||
|
@@ -2113,10 +2113,12 @@ void SwHTMLWriter::OutCSS1_TableFrameFormatOptions( const SwFrameFormat& rFrameF
|
||||||
|
Strm().WriteChar( '\"' );
|
||||||
|
}
|
||||||
|
|
||||||
|
-void SwHTMLWriter::OutCSS1_TableCellBorderHack(SwFrameFormat const& rFrameFormat)
|
||||||
|
+void SwHTMLWriter::OutCSS1_TableCellBordersAndBG(SwFrameFormat const& rFrameFormat, const SvxBrushItem *pBrushItem)
|
||||||
|
{
|
||||||
|
SwCSS1OutMode const aMode( *this,
|
||||||
|
CSS1_OUTMODE_STYLE_OPT_ON|CSS1_OUTMODE_ENCODE|CSS1_OUTMODE_TABLEBOX, nullptr );
|
||||||
|
+ if (pBrushItem)
|
||||||
|
+ OutCSS1_SvxBrush(*this, *pBrushItem, Css1Background::Table, nullptr);
|
||||||
|
OutCSS1_SvxBox(*this, rFrameFormat.GetBox());
|
||||||
|
if (!m_bFirstCSS1Property)
|
||||||
|
{
|
||||||
|
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
|
||||||
|
index 4c83319747b7..63812a9b3ef6 100644
|
||||||
|
--- a/sw/source/filter/html/htmltabw.cxx
|
||||||
|
+++ b/sw/source/filter/html/htmltabw.cxx
|
||||||
|
@@ -424,11 +424,14 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt,
|
||||||
|
// Avoid non-CSS version in the ReqIF case.
|
||||||
|
rWrt.OutBackground( pBrushItem, false );
|
||||||
|
|
||||||
|
- if( rWrt.m_bCfgOutStyles )
|
||||||
|
- OutCSS1_TableBGStyleOpt( rWrt, *pBrushItem );
|
||||||
|
+ if (!rWrt.m_bCfgOutStyles)
|
||||||
|
+ pBrushItem = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
- rWrt.OutCSS1_TableCellBorderHack(*pBox->GetFrameFormat());
|
||||||
|
+ // tdf#132739 with rWrt.m_bCfgOutStyles of true bundle the brush item css
|
||||||
|
+ // properties into the same "style" tag as the borders so there is only one
|
||||||
|
+ // style tag
|
||||||
|
+ rWrt.OutCSS1_TableCellBordersAndBG(*pBox->GetFrameFormat(), pBrushItem);
|
||||||
|
|
||||||
|
sal_uInt32 nNumFormat = 0;
|
||||||
|
double nValue = 0.0;
|
||||||
|
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
|
||||||
|
index ab282ba652ff..f82325ee50ae 100644
|
||||||
|
--- a/sw/source/filter/html/wrthtml.hxx
|
||||||
|
+++ b/sw/source/filter/html/wrthtml.hxx
|
||||||
|
@@ -484,7 +484,7 @@ public:
|
||||||
|
void writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameFormat& rFrameFormat, const OUString& rAltText, HtmlFrmOpts nFrameOpts);
|
||||||
|
|
||||||
|
void OutCSS1_TableFrameFormatOptions( const SwFrameFormat& rFrameFormat );
|
||||||
|
- void OutCSS1_TableCellBorderHack(const SwFrameFormat& rFrameFormat);
|
||||||
|
+ void OutCSS1_TableCellBordersAndBG(const SwFrameFormat& rFrameFormat, const SvxBrushItem *pBrushItem);
|
||||||
|
void OutCSS1_SectionFormatOptions( const SwFrameFormat& rFrameFormat, const SwFormatCol *pCol );
|
||||||
|
void OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat, HtmlFrmOpts nFrameOpts,
|
||||||
|
const SdrObject *pSdrObj=nullptr,
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,472 @@
|
|||||||
|
From c5a9fb7f00fe4d701d98c4058ad0f506c8dd146f Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
||||||
|
Date: Tue, 13 Jul 2021 12:38:07 +0100
|
||||||
|
Subject: [PATCH] rhbz#1980800 allow --convert-to csv to write each sheet to a
|
||||||
|
separate file
|
||||||
|
|
||||||
|
Related: tdf#135762 except only currently implemented for command line use
|
||||||
|
|
||||||
|
sample usage:
|
||||||
|
soffice --convert-to csv:"Text - txt - csv (StarCalc)":44,34,UTF8,1,,0,false,true,false,false,false,-1 sample.ods
|
||||||
|
where the new (11th!) final token ("-1") enables writing each sheet to a
|
||||||
|
new file based on the suggested target name so output in this example
|
||||||
|
is files sample-Sheet1.csv and sample-Sheet2.csv
|
||||||
|
|
||||||
|
Only -1 for 'all sheets' vs 0 for existing 'current sheet only' (which
|
||||||
|
is always sheet 0 from the command line) are currently options but the
|
||||||
|
token could be expanded in the future to select specific sheets to
|
||||||
|
export.
|
||||||
|
|
||||||
|
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118850
|
||||||
|
Tested-by: Jenkins
|
||||||
|
Reviewed-by: Eike Rathke <erack@redhat.com>
|
||||||
|
(cherry picked from commit b8903bc106dad036acb3d117e5c4fc955697fe02)
|
||||||
|
|
||||||
|
Related: tdf#135762 Allow --convert-to csv to specify 1-based sheet number
|
||||||
|
|
||||||
|
Same multifile mechanism as for -1 all sheets is used, so
|
||||||
|
|
||||||
|
soffice --convert-to csv:"Text - txt - csv (StarCalc)":44,34,UTF8,1,,0,false,true,false,false,false,2 sample.ods
|
||||||
|
|
||||||
|
writes a file sample-Sheet2.csv
|
||||||
|
|
||||||
|
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118971
|
||||||
|
Reviewed-by: Eike Rathke <erack@redhat.com>
|
||||||
|
Tested-by: Jenkins
|
||||||
|
(cherry picked from commit fda91f8be16ba760e360940ebafd6244c648cb8c)
|
||||||
|
|
||||||
|
Related: tdf#135762 Suppress cout if not command line
|
||||||
|
|
||||||
|
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119294
|
||||||
|
Reviewed-by: Eike Rathke <erack@redhat.com>
|
||||||
|
Tested-by: Jenkins
|
||||||
|
(cherry picked from commit 0cda081c9aa3b3dcb363f97bac60c845ce9a13e0)
|
||||||
|
|
||||||
|
Change-Id: Ib99a120f1a2c8d1008a7a3c59a6b39f572fb346e
|
||||||
|
b9248c9561e4e340c88458ac5dfd159e443a4cfd
|
||||||
|
9431221aadf97739bb197871f25fa151ef4c391c
|
||||||
|
---
|
||||||
|
desktop/source/app/dispatchwatcher.cxx | 50 +++++++--
|
||||||
|
include/sfx2/docfile.hxx | 1 +
|
||||||
|
sc/source/ui/dbgui/imoptdlg.cxx | 16 ++-
|
||||||
|
sc/source/ui/docshell/docsh.cxx | 141 +++++++++++++++++++++----
|
||||||
|
sc/source/ui/inc/docsh.hxx | 2 +-
|
||||||
|
sc/source/ui/inc/imoptdlg.hxx | 6 +-
|
||||||
|
sfx2/source/doc/docfile.cxx | 4 +
|
||||||
|
7 files changed, 184 insertions(+), 36 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
|
||||||
|
index 04140173c6d1..a5365da618e8 100644
|
||||||
|
--- a/desktop/source/app/dispatchwatcher.cxx
|
||||||
|
+++ b/desktop/source/app/dispatchwatcher.cxx
|
||||||
|
@@ -30,6 +30,7 @@
|
||||||
|
#include "dispatchwatcher.hxx"
|
||||||
|
#include <rtl/ustring.hxx>
|
||||||
|
#include <comphelper/processfactory.hxx>
|
||||||
|
+#include <comphelper/string.hxx>
|
||||||
|
#include <comphelper/synchronousdispatch.hxx>
|
||||||
|
#include <com/sun/star/io/IOException.hpp>
|
||||||
|
#include <com/sun/star/util/XCloseable.hpp>
|
||||||
|
@@ -604,6 +605,8 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
|
||||||
|
aFilter = impl_GuessFilter( aOutFile, aDocService );
|
||||||
|
}
|
||||||
|
|
||||||
|
+ bool bMultiFileTarget = false;
|
||||||
|
+
|
||||||
|
if (aFilter.isEmpty())
|
||||||
|
{
|
||||||
|
std::cerr << "Error: no export filter" << std::endl;
|
||||||
|
@@ -611,29 +614,54 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sal_Int32 nFilterOptionsIndex = aFilter.indexOf(':');
|
||||||
|
- sal_Int32 nProps = ( 0 < nFilterOptionsIndex ) ? 3 : 2;
|
||||||
|
+ sal_Int32 nProps = ( 0 < nFilterOptionsIndex ) ? 4 : 3;
|
||||||
|
|
||||||
|
if ( !aImgOut.isEmpty() )
|
||||||
|
nProps +=1;
|
||||||
|
Sequence<PropertyValue> conversionProperties( nProps );
|
||||||
|
- conversionProperties[0].Name = "Overwrite";
|
||||||
|
- conversionProperties[0].Value <<= true;
|
||||||
|
+ conversionProperties[0].Name = "ConversionRequestOrigin";
|
||||||
|
+ conversionProperties[0].Value <<= OUString("CommandLine");
|
||||||
|
+ conversionProperties[1].Name = "Overwrite";
|
||||||
|
+ conversionProperties[1].Value <<= true;
|
||||||
|
|
||||||
|
- conversionProperties[1].Name = "FilterName";
|
||||||
|
+ conversionProperties[2].Name = "FilterName";
|
||||||
|
if( 0 < nFilterOptionsIndex )
|
||||||
|
{
|
||||||
|
- conversionProperties[1].Value <<= aFilter.copy(0, nFilterOptionsIndex);
|
||||||
|
+ OUString sFilterName = aFilter.copy(0, nFilterOptionsIndex);
|
||||||
|
+ OUString sFilterOptions = aFilter.copy(nFilterOptionsIndex + 1);
|
||||||
|
+
|
||||||
|
+ if (sFilterName == "Text - txt - csv (StarCalc)")
|
||||||
|
+ {
|
||||||
|
+ sal_Int32 nIdx(0);
|
||||||
|
+ // If the 11th token is '-1' then we export a file
|
||||||
|
+ // per sheet where the file name is based on the suggested
|
||||||
|
+ // output filename concatenated with the sheet name, so adjust
|
||||||
|
+ // the output and overwrite messages
|
||||||
|
+ // If the 11th token is not present or numeric 0 then the
|
||||||
|
+ // default sheet is exported with the output filename. If it
|
||||||
|
+ // is numeric >0 then that sheet (1-based) with the output
|
||||||
|
+ // filename concatenated with the sheet name. So even if
|
||||||
|
+ // that is a single file, the multi file target mechanism is
|
||||||
|
+ // used.
|
||||||
|
+ const OUString aTok(sFilterOptions.getToken(11, ',', nIdx));
|
||||||
|
+ // Actual validity is checked in Calc, here just check for
|
||||||
|
+ // presence of numeric value at start.
|
||||||
|
+ bMultiFileTarget = (!aTok.isEmpty() && aTok.toInt32() != 0);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ conversionProperties[2].Value <<= sFilterName;
|
||||||
|
|
||||||
|
- conversionProperties[2].Name = "FilterOptions";
|
||||||
|
- conversionProperties[2].Value <<= aFilter.copy(nFilterOptionsIndex + 1);
|
||||||
|
+ conversionProperties[3].Name = "FilterOptions";
|
||||||
|
+ conversionProperties[3].Value <<= sFilterOptions;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- conversionProperties[1].Value <<= aFilter;
|
||||||
|
+ conversionProperties[2].Value <<= aFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !aImgOut.isEmpty() )
|
||||||
|
{
|
||||||
|
+ assert(conversionProperties[nProps-1].Name.isEmpty());
|
||||||
|
conversionProperties[nProps-1].Name = "ImageFilter";
|
||||||
|
conversionProperties[nProps-1].Value <<= aImgOut;
|
||||||
|
}
|
||||||
|
@@ -645,9 +673,11 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
|
||||||
|
OString aTargetURL8 = OUStringToOString(aTempName, osl_getThreadTextEncoding());
|
||||||
|
if (aDispatchRequest.aRequestType != REQUEST_CAT)
|
||||||
|
{
|
||||||
|
- std::cout << "convert " << aSource8 << " -> " << aTargetURL8;
|
||||||
|
+ std::cout << "convert " << aSource8;
|
||||||
|
+ if (!bMultiFileTarget)
|
||||||
|
+ std::cout << " -> " << aTargetURL8;
|
||||||
|
std::cout << " using filter : " << OUStringToOString(aFilter, osl_getThreadTextEncoding()) << std::endl;
|
||||||
|
- if (FStatHelper::IsDocument(aOutFile))
|
||||||
|
+ if (!bMultiFileTarget && FStatHelper::IsDocument(aOutFile))
|
||||||
|
std::cout << "Overwriting: " << OUStringToOString(aTempName, osl_getThreadTextEncoding()) << std::endl ;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx
|
||||||
|
index 2019b5738c01..09aae02b1976 100644
|
||||||
|
--- a/include/sfx2/docfile.hxx
|
||||||
|
+++ b/include/sfx2/docfile.hxx
|
||||||
|
@@ -108,6 +108,7 @@ public:
|
||||||
|
const OUString& GetOrigURL() const;
|
||||||
|
|
||||||
|
SfxItemSet * GetItemSet() const;
|
||||||
|
+ css::uno::Sequence<css::beans::PropertyValue> GetArgs() const;
|
||||||
|
void Close(bool bInDestruction = false);
|
||||||
|
void CloseAndRelease();
|
||||||
|
void ReOpen();
|
||||||
|
diff --git a/sc/source/ui/dbgui/imoptdlg.cxx b/sc/source/ui/dbgui/imoptdlg.cxx
|
||||||
|
index 26781924baac..7aa8c8acb061 100644
|
||||||
|
--- a/sc/source/ui/dbgui/imoptdlg.cxx
|
||||||
|
+++ b/sc/source/ui/dbgui/imoptdlg.cxx
|
||||||
|
@@ -20,6 +20,7 @@
|
||||||
|
#include <imoptdlg.hxx>
|
||||||
|
#include <asciiopt.hxx>
|
||||||
|
#include <comphelper/string.hxx>
|
||||||
|
+#include <unotools/charclass.hxx>
|
||||||
|
#include <osl/thread.h>
|
||||||
|
#include <global.hxx>
|
||||||
|
|
||||||
|
@@ -43,6 +44,7 @@ ScImportOptions::ScImportOptions( const OUString& rStr )
|
||||||
|
bSaveNumberAsSuch = true;
|
||||||
|
bSaveFormulas = false;
|
||||||
|
bRemoveSpace = false;
|
||||||
|
+ nSheetToExport = 0;
|
||||||
|
sal_Int32 nTokenCount = comphelper::string::getTokenCount(rStr, ',');
|
||||||
|
if ( nTokenCount >= 3 )
|
||||||
|
{
|
||||||
|
@@ -76,6 +78,16 @@ ScImportOptions::ScImportOptions( const OUString& rStr )
|
||||||
|
bSaveFormulas = rStr.getToken(0, ',', nIdx) == "true";
|
||||||
|
if ( nTokenCount >= 11 )
|
||||||
|
bRemoveSpace = rStr.getToken(0, ',', nIdx) == "true";
|
||||||
|
+ if ( nTokenCount >= 12 )
|
||||||
|
+ {
|
||||||
|
+ const OUString aTok(rStr.getToken(0, ',', nIdx));
|
||||||
|
+ if (aTok == "-1")
|
||||||
|
+ nSheetToExport = -1; // all
|
||||||
|
+ else if (aTok.isEmpty() || CharClass::isAsciiNumeric(aTok))
|
||||||
|
+ nSheetToExport = aTok.toInt32();
|
||||||
|
+ else
|
||||||
|
+ nSheetToExport = -23; // invalid, force error
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -99,7 +111,9 @@ OUString ScImportOptions::BuildString() const
|
||||||
|
"," +
|
||||||
|
OUString::boolean( bSaveFormulas ) + // "save formulas": not in ScAsciiOptions
|
||||||
|
"," +
|
||||||
|
- OUString::boolean( bRemoveSpace ); // same as "Remove space" in ScAsciiOptions
|
||||||
|
+ OUString::boolean( bRemoveSpace ) + // same as "Remove space" in ScAsciiOptions
|
||||||
|
+ "," +
|
||||||
|
+ OUString::number(nSheetToExport) ; // Only available for command line --convert-to
|
||||||
|
|
||||||
|
return aResult;
|
||||||
|
}
|
||||||
|
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
|
||||||
|
index bd7402231333..1c544fb6fa1a 100644
|
||||||
|
--- a/sc/source/ui/docshell/docsh.cxx
|
||||||
|
+++ b/sc/source/ui/docshell/docsh.cxx
|
||||||
|
@@ -45,6 +45,7 @@
|
||||||
|
#include <sfx2/objface.hxx>
|
||||||
|
#include <sfx2/viewfrm.hxx>
|
||||||
|
#include <svl/documentlockfile.hxx>
|
||||||
|
+#include <svl/fstathelper.hxx>
|
||||||
|
#include <svl/sharecontrolfile.hxx>
|
||||||
|
#include <svl/urihelper.hxx>
|
||||||
|
#include <osl/file.hxx>
|
||||||
|
@@ -120,6 +121,7 @@
|
||||||
|
#include <comphelper/processfactory.hxx>
|
||||||
|
#include <comphelper/string.hxx>
|
||||||
|
#include <unotools/configmgr.hxx>
|
||||||
|
+#include <unotools/ucbstreamhelper.hxx>
|
||||||
|
#include <uiitems.hxx>
|
||||||
|
#include <dpobject.hxx>
|
||||||
|
#include <markdata.hxx>
|
||||||
|
@@ -1920,7 +1922,7 @@ void escapeTextSep(sal_Int32 nPos, const StrT& rStrDelim, StrT& rStr)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt )
|
||||||
|
+void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt, SCTAB nTab )
|
||||||
|
{
|
||||||
|
sal_Unicode cDelim = rAsciiOpt.nFieldSepCode;
|
||||||
|
sal_Unicode cStrDelim = rAsciiOpt.nTextSepCode;
|
||||||
|
@@ -1966,7 +1968,6 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
|
||||||
|
|
||||||
|
SCCOL nStartCol = 0;
|
||||||
|
SCROW nStartRow = 0;
|
||||||
|
- SCTAB nTab = GetSaveTab();
|
||||||
|
SCCOL nEndCol;
|
||||||
|
SCROW nEndRow;
|
||||||
|
m_aDocument.GetCellArea( nTab, nEndCol, nEndRow );
|
||||||
|
@@ -2384,35 +2385,129 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
|
||||||
|
}
|
||||||
|
else if (aFltName == pFilterAscii)
|
||||||
|
{
|
||||||
|
- SvStream* pStream = rMed.GetOutStream();
|
||||||
|
- if (pStream)
|
||||||
|
+ OUString sItStr;
|
||||||
|
+ SfxItemSet* pSet = rMed.GetItemSet();
|
||||||
|
+ const SfxPoolItem* pItem;
|
||||||
|
+ if ( pSet && SfxItemState::SET ==
|
||||||
|
+ pSet->GetItemState( SID_FILE_FILTEROPTIONS, true, &pItem ) )
|
||||||
|
{
|
||||||
|
- OUString sItStr;
|
||||||
|
- SfxItemSet* pSet = rMed.GetItemSet();
|
||||||
|
- const SfxPoolItem* pItem;
|
||||||
|
- if ( pSet && SfxItemState::SET ==
|
||||||
|
- pSet->GetItemState( SID_FILE_FILTEROPTIONS, true, &pItem ) )
|
||||||
|
+ sItStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if ( sItStr.isEmpty() )
|
||||||
|
+ {
|
||||||
|
+ // default for ascii export (from API without options):
|
||||||
|
+ // ISO8859-1/MS_1252 encoding, comma, double quotes
|
||||||
|
+
|
||||||
|
+ ScImportOptions aDefOptions( ',', '"', RTL_TEXTENCODING_MS_1252 );
|
||||||
|
+ sItStr = aDefOptions.BuildString();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ weld::WaitObject aWait( GetActiveDialogParent() );
|
||||||
|
+ ScImportOptions aOptions( sItStr );
|
||||||
|
+
|
||||||
|
+ if (aOptions.nSheetToExport)
|
||||||
|
+ {
|
||||||
|
+ // Only from command line --convert-to
|
||||||
|
+ bRet = true;
|
||||||
|
+
|
||||||
|
+ // Verbose only from command line, not UI (in case we actually
|
||||||
|
+ // implement that) nor macro filter options.
|
||||||
|
+ bool bVerbose = false;
|
||||||
|
+ const css::uno::Sequence<css::beans::PropertyValue> & rArgs = rMed.GetArgs();
|
||||||
|
+ const auto pProp = std::find_if( rArgs.begin(), rArgs.end(),
|
||||||
|
+ [](const css::beans::PropertyValue& rProp) { return rProp.Name == "ConversionRequestOrigin"; });
|
||||||
|
+ if (pProp != rArgs.end())
|
||||||
|
{
|
||||||
|
- sItStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
|
||||||
|
+ OUString aOrigin;
|
||||||
|
+ pProp->Value >>= aOrigin;
|
||||||
|
+ bVerbose = (aOrigin == "CommandLine");
|
||||||
|
}
|
||||||
|
|
||||||
|
- if ( sItStr.isEmpty() )
|
||||||
|
+ SCTAB nStartTab;
|
||||||
|
+ SCTAB nCount = m_aDocument.GetTableCount();
|
||||||
|
+ if (aOptions.nSheetToExport == -1)
|
||||||
|
{
|
||||||
|
- // default for ascii export (from API without options):
|
||||||
|
- // ISO8859-1/MS_1252 encoding, comma, double quotes
|
||||||
|
-
|
||||||
|
- ScImportOptions aDefOptions( ',', '"', RTL_TEXTENCODING_MS_1252 );
|
||||||
|
- sItStr = aDefOptions.BuildString();
|
||||||
|
+ // All sheets.
|
||||||
|
+ nStartTab = 0;
|
||||||
|
+ }
|
||||||
|
+ else if (0 < aOptions.nSheetToExport && aOptions.nSheetToExport <= nCount)
|
||||||
|
+ {
|
||||||
|
+ // One sheet, 1-based.
|
||||||
|
+ nCount = aOptions.nSheetToExport;
|
||||||
|
+ nStartTab = nCount - 1;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ // Usage error, no export but log.
|
||||||
|
+ if (bVerbose)
|
||||||
|
+ {
|
||||||
|
+ if (aOptions.nSheetToExport < 0)
|
||||||
|
+ std::cout << "Bad sheet number string given." << std::endl;
|
||||||
|
+ else
|
||||||
|
+ std::cout << "No sheet number " << aOptions.nSheetToExport
|
||||||
|
+ << ", number of sheets is " << nCount << std::endl;
|
||||||
|
+ }
|
||||||
|
+ nStartTab = 0;
|
||||||
|
+ nCount = 0;
|
||||||
|
+ SetError(SCERR_EXPORT_DATA);
|
||||||
|
+ bRet = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
- weld::WaitObject aWait( GetActiveDialogParent() );
|
||||||
|
- ScImportOptions aOptions( sItStr );
|
||||||
|
- AsciiSave( *pStream, aOptions );
|
||||||
|
- bRet = true;
|
||||||
|
+ INetURLObject aURLObject(rMed.GetURLObject());
|
||||||
|
+ OUString sExt = aURLObject.CutExtension();
|
||||||
|
+ OUString sBaseName = aURLObject.GetLastName();
|
||||||
|
+ aURLObject.CutLastName();
|
||||||
|
|
||||||
|
- if (m_aDocument.GetTableCount() > 1)
|
||||||
|
- if (!rMed.GetError())
|
||||||
|
- rMed.SetError(SCWARN_EXPORT_ASCII);
|
||||||
|
+ for (SCTAB i = nStartTab; i < nCount; ++i)
|
||||||
|
+ {
|
||||||
|
+ OUString sTabName;
|
||||||
|
+ if (!m_aDocument.GetName(i, sTabName))
|
||||||
|
+ sTabName = OUString::number(i);
|
||||||
|
+ INetURLObject aSheetURLObject(aURLObject);
|
||||||
|
+ OUString sFileName = sBaseName + "-" + sTabName;
|
||||||
|
+ if (!sExt.isEmpty())
|
||||||
|
+ sFileName = sFileName + "." + sExt;
|
||||||
|
+ aSheetURLObject.Append(sFileName);
|
||||||
|
+
|
||||||
|
+ // log similar to DispatchWatcher::executeDispatchRequests
|
||||||
|
+ OUString aOutFile = aSheetURLObject.GetMainURL(INetURLObject::DecodeMechanism::NONE);
|
||||||
|
+ if (bVerbose)
|
||||||
|
+ {
|
||||||
|
+ OUString aDisplayedName;
|
||||||
|
+ if (osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(aOutFile, aDisplayedName))
|
||||||
|
+ aDisplayedName = aOutFile;
|
||||||
|
+ std::cout << "Writing sheet " << OUStringToOString(sTabName, osl_getThreadTextEncoding()) << " -> "
|
||||||
|
+ << OUStringToOString(aDisplayedName, osl_getThreadTextEncoding())
|
||||||
|
+ << std::endl;
|
||||||
|
+
|
||||||
|
+ if (FStatHelper::IsDocument(aOutFile))
|
||||||
|
+ std::cout << "Overwriting: " << OUStringToOString(aDisplayedName, osl_getThreadTextEncoding())
|
||||||
|
+ << std::endl ;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ std::unique_ptr<SvStream> xStm = ::utl::UcbStreamHelper::CreateStream(aOutFile, StreamMode::TRUNC | StreamMode::WRITE);
|
||||||
|
+ if (!xStm)
|
||||||
|
+ {
|
||||||
|
+ SetError(ERRCODE_IO_CANTCREATE);
|
||||||
|
+ bRet = false;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ AsciiSave(*xStm, aOptions, i);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ SvStream* pStream = rMed.GetOutStream();
|
||||||
|
+ if (pStream)
|
||||||
|
+ {
|
||||||
|
+ AsciiSave(*pStream, aOptions, GetSaveTab());
|
||||||
|
+ bRet = true;
|
||||||
|
+
|
||||||
|
+ if (m_aDocument.GetTableCount() > 1)
|
||||||
|
+ if (!rMed.GetError())
|
||||||
|
+ rMed.SetError(SCWARN_EXPORT_ASCII);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (aFltName == pFilterDBase)
|
||||||
|
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
|
||||||
|
index a519f4c87d04..6a075ff6dade 100644
|
||||||
|
--- a/sc/source/ui/inc/docsh.hxx
|
||||||
|
+++ b/sc/source/ui/inc/docsh.hxx
|
||||||
|
@@ -230,7 +230,7 @@ public:
|
||||||
|
|
||||||
|
ScDrawLayer* MakeDrawLayer();
|
||||||
|
|
||||||
|
- void AsciiSave( SvStream& rStream, const ScImportOptions& rOpt );
|
||||||
|
+ void AsciiSave( SvStream& rStream, const ScImportOptions& rOpt, SCTAB nTab );
|
||||||
|
|
||||||
|
void Execute( SfxRequest& rReq );
|
||||||
|
void GetState( SfxItemSet &rSet );
|
||||||
|
diff --git a/sc/source/ui/inc/imoptdlg.hxx b/sc/source/ui/inc/imoptdlg.hxx
|
||||||
|
index bac941c2a377..382067d67813 100644
|
||||||
|
--- a/sc/source/ui/inc/imoptdlg.hxx
|
||||||
|
+++ b/sc/source/ui/inc/imoptdlg.hxx
|
||||||
|
@@ -32,7 +32,8 @@ public:
|
||||||
|
ScImportOptions( sal_Unicode nFieldSep, sal_Unicode nTextSep, rtl_TextEncoding nEnc )
|
||||||
|
: nFieldSepCode(nFieldSep), nTextSepCode(nTextSep),
|
||||||
|
bFixedWidth(false), bSaveAsShown(false), bQuoteAllText(false),
|
||||||
|
- bSaveNumberAsSuch(true), bSaveFormulas(false), bRemoveSpace(false)
|
||||||
|
+ bSaveNumberAsSuch(true), bSaveFormulas(false), bRemoveSpace(false),
|
||||||
|
+ nSheetToExport(0)
|
||||||
|
{ SetTextEncoding( nEnc ); }
|
||||||
|
|
||||||
|
ScImportOptions& operator=( const ScImportOptions& rCpy ) = default;
|
||||||
|
@@ -51,6 +52,9 @@ public:
|
||||||
|
bool bSaveNumberAsSuch;
|
||||||
|
bool bSaveFormulas;
|
||||||
|
bool bRemoveSpace;
|
||||||
|
+ // "0" for 'current sheet', "-1" for all sheets (each to a separate file),
|
||||||
|
+ // or 1-based specific sheet number (to a separate file).
|
||||||
|
+ sal_Int32 nSheetToExport;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INCLUDED_SC_SOURCE_UI_INC_IMOPTDLG_HXX
|
||||||
|
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
|
||||||
|
index 5d00d39bd837..ccdd3632e6e5 100644
|
||||||
|
--- a/sfx2/source/doc/docfile.cxx
|
||||||
|
+++ b/sfx2/source/doc/docfile.cxx
|
||||||
|
@@ -328,6 +328,8 @@ public:
|
||||||
|
|
||||||
|
util::DateTime m_aDateTime;
|
||||||
|
|
||||||
|
+ uno::Sequence<beans::PropertyValue> m_aArgs;
|
||||||
|
+
|
||||||
|
explicit SfxMedium_Impl();
|
||||||
|
~SfxMedium_Impl();
|
||||||
|
SfxMedium_Impl(const SfxMedium_Impl&) = delete;
|
||||||
|
@@ -3240,6 +3242,7 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) :
|
||||||
|
SfxAllItemSet *pParams = new SfxAllItemSet( SfxGetpApp()->GetPool() );
|
||||||
|
pImpl->m_pSet.reset( pParams );
|
||||||
|
TransformParameters( SID_OPENDOC, aArgs, *pParams );
|
||||||
|
+ pImpl->m_aArgs = aArgs;
|
||||||
|
|
||||||
|
OUString aFilterProvider, aFilterName;
|
||||||
|
{
|
||||||
|
@@ -3301,6 +3304,7 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) :
|
||||||
|
Init_Impl();
|
||||||
|
}
|
||||||
|
|
||||||
|
+uno::Sequence<beans::PropertyValue> SfxMedium::GetArgs() const { return pImpl->m_aArgs; }
|
||||||
|
|
||||||
|
SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const OUString& rBaseURL, const std::shared_ptr<SfxItemSet>& p ) :
|
||||||
|
pImpl(new SfxMedium_Impl)
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -54,7 +54,7 @@ Summary: Free Software Productivity Suite
|
|||||||
Name: libreoffice
|
Name: libreoffice
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: %{libo_version}.2
|
Version: %{libo_version}.2
|
||||||
Release: 5%{?libo_prerelease}%{?dist}
|
Release: 6%{?libo_prerelease}%{?dist}
|
||||||
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and MPLv2.0 and CC0
|
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and MPLv2.0 and CC0
|
||||||
URL: http://www.libreoffice.org/
|
URL: http://www.libreoffice.org/
|
||||||
|
|
||||||
@ -267,6 +267,8 @@ Patch23: 0006-tdf-137897-scRetypePassInputDlg-re-allow-password-re.patch
|
|||||||
Patch24: 0007-tdf-137982-m_xFrame-is-already-disposed.patch
|
Patch24: 0007-tdf-137982-m_xFrame-is-already-disposed.patch
|
||||||
Patch25: 0008-Resolves-tdf-137215-restore-original-modality-before.patch
|
Patch25: 0008-Resolves-tdf-137215-restore-original-modality-before.patch
|
||||||
Patch26: 0001-rhbz-1882616-move-cursor-one-step-at-a-time-in-the-d.patch
|
Patch26: 0001-rhbz-1882616-move-cursor-one-step-at-a-time-in-the-d.patch
|
||||||
|
Patch27: 0001-rhbz-1980800-allow-convert-to-csv-to-write-each-shee.patch
|
||||||
|
Patch28: 0001-Resolves-tdf-132739-two-style-tags-where-there-shoul.patch
|
||||||
|
|
||||||
%if 0%{?rhel}
|
%if 0%{?rhel}
|
||||||
# not upstreamed
|
# not upstreamed
|
||||||
@ -2251,6 +2253,11 @@ done
|
|||||||
%{_includedir}/LibreOfficeKit
|
%{_includedir}/LibreOfficeKit
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Sep 06 2021 Caolán McNamara <caolanm@redhat.com> - 1:6.4.7.2-6
|
||||||
|
- Resolves: rhbz#1980800 allow convert to csv to write each sheet to
|
||||||
|
separate file
|
||||||
|
- Resolves: rhbz#1992695 two style tags where there should be one
|
||||||
|
|
||||||
* Wed Feb 03 2021 Caolán McNamara <caolanm@redhat.com> - 1:6.4.7.2-5
|
* Wed Feb 03 2021 Caolán McNamara <caolanm@redhat.com> - 1:6.4.7.2-5
|
||||||
- Resolves: rhbz#1924619 bad insertion of emoji
|
- Resolves: rhbz#1924619 bad insertion of emoji
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user