24#include <config_features.h>
38#include <rtl/bootstrap.hxx>
39#include <rtl/tencinfo.h>
55#include <osl/file.hxx>
58#include <com/sun/star/awt/Key.hpp>
59#include <com/sun/star/awt/KeyModifier.hpp>
60#include <com/sun/star/container/XContentEnumerationAccess.hpp>
61#include <com/sun/star/document/UpdateDocMode.hpp>
62#include <com/sun/star/script/vba/VBAEventId.hpp>
63#include <com/sun/star/script/vba/VBAScriptEventId.hpp>
64#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
65#include <com/sun/star/script/vba/XVBAScriptListener.hpp>
66#include <com/sun/star/script/vba/XVBACompatibility.hpp>
67#include <com/sun/star/sheet/XSpreadsheetView.hpp>
68#include <com/sun/star/task/XJob.hpp>
69#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
70#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
71#include <com/sun/star/util/VetoException.hpp>
72#include <com/sun/star/lang/XSingleComponentFactory.hpp>
73#include <ooo/vba/excel/XWorkbook.hpp>
76#include <config_folders.h>
81#include <svx/dialogs.hrc>
100#include <progress.hxx>
116#include <compiler.hxx>
125#include <undomanager.hxx>
128#include <officecfg/Office/Calc.hxx>
134#include <uiitems.hxx>
151using ::com::sun::star::uno::Reference;
152using ::com::sun::star::lang::XMultiServiceFactory;
153using std::shared_ptr;
177#define ShellClass_ScDocShell
178#include <scslots.hxx>
192 OUString* pFullTypeName,
193 sal_Int32 nFileFormat,
194 bool bTemplate )
const
199 *pFormat = SotClipboardFormatId::STARCALC_60;
200 *pFullTypeName =
ScResId( SCSTR_LONG_SCDOC_NAME_60 );
205 *pFormat = bTemplate ? SotClipboardFormatId::STARCALC_8_TEMPLATE : SotClipboardFormatId::STARCALC_8;
206 *pFullTypeName =
ScResId( SCSTR_LONG_SCDOC_NAME_80 );
210 OSL_FAIL(
"Which version?");
223 SC_MOD()->InputEnterHandler();
243 if ( nStates & HiddenInformation::RECORDEDCHANGES )
246 nState |= HiddenInformation::RECORDEDCHANGES;
248 if ( nStates & HiddenInformation::NOTES )
252 for (
SCTAB nTab = 0; nTab < nTableCount && !bFound; ++nTab)
259 nState |= HiddenInformation::NOTES;
270 OSL_ENSURE(
m_pModificator ==
nullptr,
"The Modificator should not exist");
295 for (
SCTAB i = 0;
i < nTabCount; ++
i)
302 sal_Int32 nLinkTabNameLength = aLinkTabName.getLength();
303 sal_Int32 nNameLength =
aName.getLength();
304 if (nLinkTabNameLength < nNameLength)
309 if ( *pNameBuffer ==
'\'' &&
312 OUStringBuffer aDocURLBuffer;
315 while ( bQuote && *pNameBuffer )
317 if ( *pNameBuffer ==
'\'' && *(pNameBuffer-1) !=
'\\' )
319 else if( *pNameBuffer !=
'\\' || *(pNameBuffer+1) !=
'\'' )
320 aDocURLBuffer.append(*pNameBuffer);
326 sal_Int32
nIndex = nNameLength - nLinkTabNameLength;
350 size_t nDPCount = pDPCollection->
GetCount();
351 for (
size_t nDP=0; nDP<nDPCount; ++nDP)
354 if (rDPObj.
GetName().isEmpty())
381 OSL_FAIL(
"The Modificator should exist");
395 mpDoc->SetLoadingMedium(
true);
400 mpDoc->SetLoadingMedium(
false);
441 MessageWithCheck(
weld::Window *pParent,
const OUString& rUIFile,
const OString& rDialogId)
442 : MessageDialogController(pParent, rUIFile, rDialogId,
"ask")
450#if HAVE_FEATURE_SCRIPTING
451class VBAScriptListener :
public ::cppu::WeakImplHelper< css::script::vba::XVBAScriptListener >
456 VBAScriptListener(
ScDocShell* pDocSh) : m_pDocSh(pDocSh)
461 virtual void SAL_CALL notifyVBAScriptEvent( const ::css::script::vba::VBAScriptEvent& aEvent )
override
463 if (
aEvent.Identifier == script::vba::VBAScriptEventId::SCRIPT_STOPPED &&
466 m_pDocSh->
SetClipData(uno::Reference<datatransfer::XTransferable2>());
471 virtual void SAL_CALL disposing( const ::css::lang::EventObject& )
override
510 static_cast<ScRecalcOptions>(officecfg::Office::Calc::Formula::Load::ODFRecalcMode::get());
512 bool bHardRecalc =
false;
516 if (
m_pDocument->IsUserInteractionEnabled() && xDocProps->getGenerator().indexOf(sProductName) == -1)
521 "modules/scalc/ui/recalcquerydialog.ui",
"RecalcQueryDialog");
522 aQueryBox.set_primary_text(
ScResId(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS));
523 aQueryBox.set_default_response(
RET_YES);
525 if ( officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::isReadOnly() )
526 aQueryBox.hide_ask();
528 bHardRecalc = aQueryBox.run() ==
RET_YES;
530 if (aQueryBox.get_active())
534 officecfg::Office::Calc::Formula::Load::ODFRecalcMode::set(sal_Int32(0), batch);
539 SC_MOD()->SetFormulaOptions(aOpt);
569 bRet = aImport.
Export(
false);
571 bRet = aImport.
Export(
true);
593 pDrawLayer->SetCompatibilityFlag(SdrCompatibilityFlag::AnchoredTextOverflowLegacy,
595 pDrawLayer->SetCompatibilityFlag(SdrCompatibilityFlag::LegacySingleLineFontwork,
611 m_pDocument->GetStyleSheetPool()->CreateStandardStyles();
616 OUString
aURL(
"$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER
"/calc/styles.xml");
617 rtl::Bootstrap::expandMacros(
aURL);
620 osl::FileBase::getSystemPathFromFileURL(
aURL, aPath);
627 m_pDocument->GetStyleSheetPool()->setAllParaStandard();
630 bRet =
LoadXML( &rMedium,
nullptr );
659 uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents =
m_pDocument->GetVbaEventProcessor();
660 if ( xVbaEvents.is() )
try
663 xVbaEvents->processVbaEvent( script::vba::VBAEventId::WORKBOOK_NEWSHEET, aArgs );
665 catch( uno::Exception& )
673 else if (
auto pStlHint =
dynamic_cast<const ScAutoStyleHint*
>(&rHint) )
681 const ScRange& aRange = pStlHint->GetRange();
682 const OUString& aName1 = pStlHint->GetStyle1();
683 const OUString& aName2 = pStlHint->GetStyle2();
684 sal_uInt32 nTimeout = pStlHint->GetTimeout();
690 else if (
auto pEventHint =
dynamic_cast<const SfxEventHint*
>(&rHint) )
696 case SfxEventHintId::LoadFinished:
698#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
721 case SfxEventHintId::ViewCreated:
723 #if HAVE_FEATURE_SCRIPTING
724 uno::Reference<script::vba::XVBACompatibility> xVBACompat(
GetBasicContainer(), uno::UNO_QUERY);
732#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
740 "modules/scalc/ui/sharedwarningdialog.ui",
"SharedWarningDialog");
743 bool bChecked = aWarningBox.get_active();
747 SC_MOD()->SetAppOptions( aAppOptions );
754 uno::Reference< uno::XComponentContext > xContext(
756 uno::Reference< lang::XMultiServiceFactory > xServiceManager(
757 xContext->getServiceManager(),
758 uno::UNO_QUERY_THROW );
759 uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xServiceManager, uno::UNO_QUERY_THROW );
760 uno::Reference< container::XEnumeration> xEnum = xEnumAccess->createContentEnumeration(
761 "com.sun.star.sheet.SpreadsheetDocumentJob" );
764 while ( xEnum->hasMoreElements() )
766 uno::Any aAny = xEnum->nextElement();
767 uno::Reference< lang::XSingleComponentFactory >
xFactory;
771 uno::Reference< task::XJob > xJob(
xFactory->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW );
777 uno::Reference< sheet::XSpreadsheetView > xSpreadsheetView(
xController, uno::UNO_QUERY_THROW );
778 uno::Sequence< beans::NamedValue > aArgsForJob { {
"SpreadsheetView",
uno::Any( xSpreadsheetView ) } };
779 xJob->execute( aArgsForJob );
784 catch ( uno::Exception & )
789 case SfxEventHintId::SaveDoc:
791#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
794 bool bSuccess =
false;
799 uno::Reference< frame::XModel >
xModel;
804 uno::Reference< util::XCloseable > xCloseable(
xModel, uno::UNO_QUERY_THROW );
807 bool bShared =
false;
810 if ( pSharedDocShell )
816 bool bOwnEntry =
false;
817 bool bEntriesNotAccessible =
false;
823 catch ( uno::Exception& )
825 bEntriesNotAccessible =
true;
828 if ( bShared && bOwnEntry )
830 uno::Reference< frame::XStorable > xStorable(
xModel, uno::UNO_QUERY_THROW );
832 if ( xStorable->isReadonly() )
834 xCloseable->close(
true );
836 OUString aUserName(
ScResId( STR_UNKNOWN_USER ) );
837 bool bNoLockAccess =
false;
842 if ( !
aData[LockFileComponent::OOOUSERNAME].isEmpty() )
844 aUserName =
aData[LockFileComponent::OOOUSERNAME];
846 else if ( !
aData[LockFileComponent::SYSUSERNAME].isEmpty() )
848 aUserName =
aData[LockFileComponent::SYSUSERNAME];
851 catch ( uno::Exception& )
853 bNoLockAccess =
true;
863 OUString aMessage(
ScResId( STR_FILE_LOCKED_SAVE_LATER ) );
864 aMessage = aMessage.replaceFirst(
"%1", aUserName );
867 VclMessageType::Warning, VclButtonsType::NONE,
881 bool bSaveToShared =
false;
882 if ( pSharedDocShell )
888 xCloseable->close(
true );
895 bool bChangedViewSettings =
false;
897 if ( pChangeViewSet && pChangeViewSet->
ShowChanges() )
901 m_pDocument->SetChangeViewSettings( *pChangeViewSet );
902 bChangedViewSettings =
true;
906 uno::Sequence< beans::PropertyValue > aValues{
909 GetMedium()->GetFilter()->GetFilterName())
913 if ( pPasswordItem && !pPasswordItem->
GetValue().isEmpty() )
915 aValues.realloc( 2 );
916 auto pValues = aValues.getArray();
923 aValues.realloc(aValues.getLength() + 1);
924 auto pValues = aValues.getArray();
925 pValues[aValues.getLength() - 1].Name =
"EncryptionData";
929 SC_MOD()->SetInSharedDocSaving(
true );
931 SC_MOD()->SetInSharedDocSaving(
false );
933 if ( bChangedViewSettings )
937 m_pDocument->SetChangeViewSettings( *pChangeViewSet );
947 xCloseable->close(
true );
949 if ( bEntriesNotAccessible )
957 VclMessageType::Warning, VclButtonsType::Ok,
958 ScResId(STR_DOC_NOLONGERSHARED)));
969 catch ( uno::Exception& )
972 SC_MOD()->SetInSharedDocSaving(
false );
976 uno::Reference< util::XCloseable > xClose(
xModel, uno::UNO_QUERY_THROW );
977 xClose->close(
true );
979 catch ( uno::Exception& )
994 case SfxEventHintId::SaveAsDoc:
996 if (
GetDocument().GetExternalRefManager()->containsUnsavedReferences() )
999 VclMessageType::Warning, VclButtonsType::YesNo,
1000 ScResId(STR_UNSAVED_EXT_REF)));
1001 if (
RET_NO == xWarn->run())
1008 case SfxEventHintId::SaveToDoc:
1015 case SfxEventHintId::SaveDocDone:
1016 case SfxEventHintId::SaveAsDocDone:
1022 case SfxEventHintId::SaveToDocDone:
1033 else if (rHint.
GetId() == SfxHintId::TitleChanged)
1039 else if (rHint.
GetId() == SfxHintId::Deinitializing)
1042#if HAVE_FEATURE_SCRIPTING
1043 uno::Reference<script::vba::XVBACompatibility> xVBACompat(
GetBasicContainer(), uno::UNO_QUERY);
1069 case SfxEventHintId::CreateDoc:
1073 uno::Sequence< uno::Any > aArgs{ aWorkbook };
1074 SC_MOD()->CallAutomationApplicationEventSinks(
"NewWorkbook", aArgs );
1077 case SfxEventHintId::OpenDoc:
1081 uno::Sequence< uno::Any > aArgs{ aWorkbook };
1082 SC_MOD()->CallAutomationApplicationEventSinks(
"WorkbookOpen", aArgs );
1104 bRet =
LoadXML( &rMedium,
nullptr );
1114 OUStringBuffer
aBuf;
1115 std::vector< OUString > aTokens;
1116 sal_Int32
n = rOption.getLength();
1118 for (sal_Int32
i = 0;
i <
n; ++
i)
1123 if (!
aBuf.isEmpty())
1124 aTokens.push_back(
aBuf.makeStringAndClear() );
1130 if (!
aBuf.isEmpty())
1131 aTokens.push_back(
aBuf.makeStringAndClear() );
1134 rDateConvert =
false;
1136 if (!aTokens.empty())
1137 rLang =
static_cast<LanguageType>(aTokens[0].toInt32());
1138 if (aTokens.size() > 1)
1139 rDateConvert =
static_cast<bool>(aTokens[1].
toInt32());
1154 bool bSetColWidths =
false;
1155 bool bSetSimpleTextColWidths =
false;
1156 std::map<SCCOL, ScColWidthParam> aColWidthParam;
1159 bool bSetRowHeights =
false;
1161 vector<ScDocRowHeightUpdater::TabRanges> aRecalcRowRangesArray;
1169 std::shared_ptr<const SfxFilter> pFilter = rMedium.
GetFilter();
1172 OUString aFltName = pFilter->GetFilterName();
1174 bool bCalc3 = aFltName ==
"StarCalc 3.0";
1175 bool bCalc4 = aFltName ==
"StarCalc 4.0";
1176 if (!bCalc3 && !bCalc4)
1180 bRet =
LoadXML( &rMedium,
nullptr );
1187 (pOptionsItem = pSet->
GetItemIfSet( SID_FILE_FILTEROPTIONS,
true )) )
1192 if (sItStr.isEmpty())
1211 bSetColWidths =
true;
1212 bSetRowHeights =
true;
1232 if (
m_pDocument->IsChartListenerCollectionNeedsUpdate() )
1248 else if (aFltName ==
"Gnumeric Spreadsheet")
1256 else if (aFltName ==
"MS Excel 2003 XML Orcus")
1269 bool bOptInit =
false;
1272 (pOptionsItem = pSet->
GetItemIfSet( SID_FILE_FILTEROPTIONS )) )
1289 bool bOverflowRow, bOverflowCol, bOverflowCell;
1290 bOverflowRow = bOverflowCol = bOverflowCell =
false;
1301 pInStream->
Seek( 0 );
1319#if !(defined ANDROID)
1338 OSL_FAIL(
"No Stream" );
1349 else if (!
GetError() && (bOverflowRow || bOverflowCol || bOverflowCell))
1357 bSetColWidths =
true;
1358 bSetSimpleTextColWidths =
true;
1366 (pOptionsItem = pSet->
GetItemIfSet( SID_FILE_FILTEROPTIONS )) )
1371 if (sItStr.isEmpty())
1382 aRecalcRowRangesArray.push_back(aRecalcRanges);
1395 bSetColWidths =
true;
1396 bSetSimpleTextColWidths =
true;
1408 (pOptionsItem = pSet->
GetItemIfSet( SID_FILE_FILTEROPTIONS )) )
1413 if (sItStr.isEmpty())
1434 bSetColWidths =
true;
1435 bSetSimpleTextColWidths =
true;
1436 bSetRowHeights =
true;
1441 bool bOverflowRow, bOverflowCol, bOverflowCell;
1442 bOverflowRow = bOverflowCol = bOverflowCell =
false;
1450 pInStream->
Seek( 0 );
1463 OSL_FAIL(
"No Stream" );
1474 else if (!
GetError() && (bOverflowRow || bOverflowCol || bOverflowCell))
1482 bSetColWidths =
true;
1483 bSetSimpleTextColWidths =
true;
1484 bSetRowHeights =
true;
1502 bSetRowHeights =
true;
1512 pInStream->
Seek( 0 );
1528 bSetColWidths =
true;
1529 bSetRowHeights =
true;
1533 OSL_FAIL(
"No Stream" );
1555 bool bDateConvert =
false;
1559 (pOptionsItem = pSet->
GetItemIfSet( SID_FILE_FILTEROPTIONS )) )
1561 OUString aFilterOption = pOptionsItem->
GetValue();
1565 pInStream->
Seek( 0 );
1589 OSL_FAIL(
"No Stream" );
1605 SAL_WARN(
"sc.filter",
"No match for filter '" << aFltName <<
"' in ConvertFrom");
1615 OSL_FAIL(
"No Filter in ConvertFrom");
1620 if ( bRet && (bSetColWidths || bSetRowHeights) )
1628 for (
SCTAB nTab=0; nTab<nTabCount; nTab++)
1632 m_pDocument->GetCellArea( nTab, nEndCol, nEndRow );
1640 if ( bSetColWidths )
1642 for (
SCCOL nCol=0; nCol <= nEndCol; nCol++ )
1644 if (!bSetSimpleTextColWidths)
1645 aColWidthParam[nCol].mbSimpleText =
false;
1647 sal_uInt16 nWidth =
m_pDocument->GetOptimalColWidth(
1648 nCol, nTab, pVirtDev,
nPPTX,
nPPTY, aZoom, aZoom,
false, &aMark,
1649 &aColWidthParam[nCol] );
1663 else if (!aRecalcRowRangesArray.empty())
1684 std::shared_ptr<const SfxFilter> pFilter = rMed.
GetFilter();
1688 if (pFilter->GetProviderName() ==
"orcus")
1694 const OUString& rFilterName = pFilter->GetName();
1695 if (rFilterName ==
"gnumeric")
1700 else if (rFilterName ==
"csv")
1705 else if (rFilterName ==
"xlsx")
1710 else if (rFilterName ==
"ods")
1724 : mrDocShell( rDocShell)
1749 if (mrDocShell.m_pDocument->HasExternalRefManager())
1768 if (
auto pSysWin = pFrame1->GetWindow().GetSystemWindow())
1770 pSysWin->SetAccessibleName(OUString());
1785void popFileName(OUString& rPath)
1787 if (!rPath.isEmpty())
1790 aURLObj.removeSegment();
1800 SC_MOD()->InputEnterHandler();
1809 aCurPath = pCurMedium->
GetName();
1810 popFileName(aCurPath);
1813 if (!aCurPath.isEmpty())
1816 OUString aNewPath = rMedium.
GetName();
1817 popFileName(aNewPath);
1819 if (!aRel.isEmpty())
1837 if ( bNeedsRehash && rMedium.
GetFilter()->GetFilterName() ==
"calc8" &&
1842 SAL_WARN(
"sc.filter",
"Should re-type password for own format, won't export recovery file");
1847 if (pViewShell && bNeedsRehash)
1861 bRet =
SaveXML( &rMedium,
nullptr );
1869sal_Int32 lcl_ScDocShell_GetColWidthInChars( sal_uInt16 nWidth )
1877 return sal_Int32( f );
1880void lcl_ScDocShell_GetFixedWidthString( OUString& rStr,
const ScDocument& rDoc,
1883 OUString aString = rStr;
1884 sal_Int32 nLen = lcl_ScDocShell_GetColWidthInChars(
1887 if ( nLen < aString.getLength() )
1889 OUStringBuffer aReplacement;
1891 aReplacement.append(
"###");
1893 aReplacement.append(aString);
1898 if ( nLen > aString.getLength() )
1900 if ( bValue && eHorJust == SvxCellHorJustify::Standard )
1901 eHorJust = SvxCellHorJustify::Right;
1902 OUStringBuffer aTmp(nLen);
1905 case SvxCellHorJustify::Right:
1907 aString = aTmp.append(aString);
1909 case SvxCellHorJustify::Center:
1913 aTmp.append(aString);
1916 aString = aTmp.makeStringAndClear();
1921void lcl_ScDocShell_WriteEmptyFixedWidthString(
SvStream& rStream,
1925 lcl_ScDocShell_GetFixedWidthString( aString, rDoc, nTab, nCol,
false,
1926 SvxCellHorJustify::Standard );
1930template<
typename StrT,
typename SepCharT>
1931sal_Int32 getTextSepPos(
1932 const StrT& rStr,
const ScImportOptions& rAsciiOpt,
const SepCharT& rTextSep,
const SepCharT& rFieldSep,
bool& rNeedQuotes)
1936 sal_Int32
nPos = rStr.indexOf(rTextSep);
1938 (rStr.indexOf(rFieldSep) >= 0) ||
1939 (rStr.indexOf(
'\n') >= 0) ||
1940 (rStr.indexOf(
'\r') >= 0);
1950 rtl_TextEncoding eCharSet = rAsciiOpt.
eCharSet;
1960 OString aStrDelimEncoded;
1961 OUString aStrDelimDecoded;
1962 OString aDelimEncoded;
1963 OUString aDelimDecoded;
1964 bool bContextOrNotAsciiEncoding;
1965 if ( eCharSet == RTL_TEXTENCODING_UNICODE )
1968 bContextOrNotAsciiEncoding =
false;
1973 if (bIncludeBOM && eCharSet == RTL_TEXTENCODING_UTF8)
1975 aStrDelimEncoded = OString(&cStrDelim, 1, eCharSet);
1976 aDelimEncoded = OString(&
cDelim, 1, eCharSet);
1977 rtl_TextEncodingInfo aInfo;
1978 aInfo.StructSize =
sizeof(aInfo);
1979 if ( rtl_getTextEncodingInfo( eCharSet, &aInfo ) )
1981 bContextOrNotAsciiEncoding =
1982 (((aInfo.Flags & RTL_TEXTENCODING_INFO_CONTEXT) != 0) ||
1983 ((aInfo.Flags & RTL_TEXTENCODING_INFO_ASCII) == 0));
1984 if ( bContextOrNotAsciiEncoding )
1986 aStrDelimDecoded = OStringToOUString(aStrDelimEncoded, eCharSet);
1987 aDelimDecoded = OStringToOUString(aDelimEncoded, eCharSet);
1991 bContextOrNotAsciiEncoding =
false;
1994 SCCOL nStartCol = 0;
1995 SCROW nStartRow = 0;
1998 m_pDocument->GetCellArea( nTab, nEndCol, nEndRow );
2004 bool bTabProtect =
m_pDocument->IsTabProtected( nTab );
2011 if (!bFixedWidth &&
cDelim != 0)
2018 if ((pCell = aIter.
GetNext( nCol, nRow)) !=
nullptr && nCol == nStartCol && !aIter.
GetNext( nCol, nRow))
2023 if (aString.getLength() <= 5 && aString.startsWithIgnoreAsciiCase(
"sep="))
2029 aString =
"sep=" + OUStringChar(
cDelim);
2032 if (eCharSet == RTL_TEXTENCODING_UNICODE)
2040 rStream.
WriteBytes( aStrEnc.getStr(), aStrEnc.getLength());
2051 SCCOL nNextCol = nStartCol;
2052 SCROW nNextRow = nStartRow;
2060 while ( ( pCell = aIter.
GetNext( nCol, nRow ) ) !=
nullptr )
2062 bool bProgress =
false;
2063 if ( nNextRow < nRow )
2066 for ( nEmptyCol = nNextCol; nEmptyCol < nEndCol; nEmptyCol++ )
2069 lcl_ScDocShell_WriteEmptyFixedWidthString( rStream,
2076 for ( nEmptyRow = nNextRow; nEmptyRow < nRow; nEmptyRow++ )
2078 for ( nEmptyCol = nStartCol; nEmptyCol < nEndCol; nEmptyCol++ )
2081 lcl_ScDocShell_WriteEmptyFixedWidthString( rStream,
2088 for ( nEmptyCol = nStartCol; nEmptyCol < nCol; nEmptyCol++ )
2091 lcl_ScDocShell_WriteEmptyFixedWidthString( rStream,
2098 else if ( nNextCol < nCol )
2100 for ( nEmptyCol = nNextCol; nEmptyCol < nCol; nEmptyCol++ )
2103 lcl_ScDocShell_WriteEmptyFixedWidthString( rStream,
2109 if ( nCol == nEndCol )
2112 nNextCol = nStartCol;
2113 nNextRow = nRow + 1;
2116 nNextCol = nCol + 1;
2129 bool bForceQuotes =
false;
2140 if ( bShowFormulas )
2152 sal_uInt32 nFormat =
m_pDocument->GetNumberFormat(aPos);
2153 if ( bFixedWidth || bSaveAsShown )
2155 const Color* pDummy;
2157 bString = bSaveAsShown && rFormatter.
IsTextFormat( nFormat);
2162 bString = bForceQuotes = !bSaveNumberAsSuch;
2169 sal_uInt32 nFormat =
m_pDocument->GetNumberFormat(aPos);
2170 const Color* pDummy;
2182 sal_uInt32 nFormat =
m_pDocument->GetNumberFormat(aPos);
2183 const Color* pDummy;
2201 sal_uInt32 nFormat =
m_pDocument->GetNumberFormat( nCol, nRow, nTab );
2202 if ( bFixedWidth || bSaveAsShown )
2204 const Color* pDummy;
2206 bString = bSaveAsShown && rFormatter.
IsTextFormat( nFormat);
2211 bString = bForceQuotes = !bSaveNumberAsSuch;
2216 OSL_FAIL(
"ScDocShell::AsciiSave: unknown CellType" );
2225 lcl_ScDocShell_GetFixedWidthString( aString, *
m_pDocument, nTab, nCol,
2226 !bString, eHorJust );
2231 OUString aUniString = aString;
2232 if (!bString && cStrDelim != 0 && !aUniString.isEmpty())
2235 bString = (c == cStrDelim || c ==
' ' ||
2236 aUniString.endsWith(
" ") ||
2237 aUniString.indexOf(cStrDelim) >= 0);
2238 if (!bString &&
cDelim != 0)
2239 bString = (aUniString.indexOf(
cDelim) >= 0);
2243 if ( cStrDelim != 0 )
2245 if ( eCharSet == RTL_TEXTENCODING_UNICODE )
2247 bool bNeedQuotes =
false;
2248 sal_Int32
nPos = getTextSepPos(aUniString, rAsciiOpt, cStrDelim,
cDelim, bNeedQuotes);
2251 OUString strFrom(cStrDelim);
2252 OUString strTo = strFrom + strFrom;
2253 aUniString = aUniString.replaceAll(strFrom, strTo);
2256 if ( bNeedQuotes || bForceQuotes )
2259 if ( bNeedQuotes || bForceQuotes )
2278 if ( bContextOrNotAsciiEncoding )
2283 OUString aStrDec = OStringToOUString(aStrEnc, eCharSet);
2286 bool bNeedQuotes =
false;
2287 sal_Int32
nPos = getTextSepPos(aStrDec, rAsciiOpt, aStrDelimDecoded, aDelimDecoded, bNeedQuotes);
2290 OUString strTo = aStrDelimDecoded + aStrDelimDecoded;
2291 aStrDec = aStrDec.replaceAll(aStrDelimDecoded, strTo);
2295 if ( bNeedQuotes || bForceQuotes )
2298 if ( bNeedQuotes || bForceQuotes )
2306 bool bNeedQuotes =
false;
2307 sal_Int32
nPos = getTextSepPos(aStrEnc, rAsciiOpt, aStrDelimEncoded, aDelimEncoded, bNeedQuotes);
2310 OString strTo = aStrDelimEncoded + aStrDelimEncoded;
2311 aStrEnc = aStrEnc.replaceAll(aStrDelimEncoded, strTo);
2315 if ( bNeedQuotes || bForceQuotes )
2317 aStrDelimEncoded.getStr(), aStrDelimEncoded.getLength());
2318 rStream.
WriteBytes(aStrEnc.getStr(), aStrEnc.getLength());
2319 if ( bNeedQuotes || bForceQuotes )
2321 aStrDelimEncoded.getStr(), aStrDelimEncoded.getLength());
2332 if( nCol < nEndCol )
2345 if ( nNextRow <= nEndRow )
2347 for ( nEmptyCol = nNextCol; nEmptyCol < nEndCol; nEmptyCol++ )
2350 lcl_ScDocShell_WriteEmptyFixedWidthString( rStream,
2358 for ( nEmptyRow = nNextRow; nEmptyRow <= nEndRow; nEmptyRow++ )
2360 for ( nEmptyCol = nStartCol; nEmptyCol < nEndCol; nEmptyCol++ )
2363 lcl_ScDocShell_WriteEmptyFixedWidthString( rStream,
2372 rStream.
SetEndian( nOldNumberFormatInt );
2387 OSL_ENSURE( rMed.
GetFilter(),
"Filter == 0" );
2390 OUString aFltName = rMed.
GetFilter()->GetFilterName();
2395 OSL_FAIL(
"XML filter in ConvertFrom?!");
2396 bRet =
SaveXML( &rMed,
nullptr );
2404 bool bDoSave =
true;
2410 m_pDocument->SetExtDocOptions( std::make_unique<ScExtDocOptions>() );
2413 pViewShell->GetViewData().WriteExtOptions( *pExtDocOpt );
2418 if( (rMed.
GetFilter()->GetFilterFlags() & SfxFilterFlags::ENCRYPTION) == SfxFilterFlags::NONE )
2421 if( pItemSet && pItemSet->
GetItemState( SID_PASSWORD ) == SfxItemState::SET )
2433 bDoSave = !bNeedRetypePassDlg || pViewShell->ExecuteRetypePassDlg(
PASSHASH_XL );
2462 (pOptionsItem = pSet->
GetItemIfSet( SID_FILE_FILTEROPTIONS )) )
2467 if ( sItStr.isEmpty() )
2486 bool bVerbose =
false;
2487 const css::uno::Sequence<css::beans::PropertyValue> & rArgs = rMed.
GetArgs();
2488 const auto pProp = std::find_if( rArgs.begin(), rArgs.end(),
2489 [](
const css::beans::PropertyValue& rProp) { return rProp.Name ==
"ConversionRequestOrigin"; });
2490 if (pProp != rArgs.end())
2493 pProp->Value >>= aOrigin;
2494 bVerbose = (aOrigin ==
"CommandLine");
2516 std::cout <<
"Bad sheet number string given." << std::endl;
2519 <<
", number of sheets is " <<
nCount << std::endl;
2536 sTabName = OUString::number(
i);
2538 OUString sFileName = sBaseName +
"-" + sTabName;
2539 if (!sExt.isEmpty())
2540 sFileName = sFileName +
"." + sExt;
2541 aSheetURLObject.
Append(sFileName);
2547 OUString aDisplayedName;
2548 if (osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(aOutFile, aDisplayedName))
2549 aDisplayedName = aOutFile;
2550 std::cout <<
"Writing sheet " <<
OUStringToOString(sTabName, osl_getThreadTextEncoding()) <<
" -> "
2555 std::cout <<
"Overwriting: " <<
OUStringToOString(aDisplayedName, osl_getThreadTextEncoding())
2589 (pOptionsItem = pSet->
GetItemIfSet( SID_FILE_FILTEROPTIONS )) )
2591 sCharSet = pOptionsItem->
GetValue();
2594 if (sCharSet.isEmpty())
2605 bool bHasMemo =
false;
2626 assert(pNameItem &&
"SID_FILE_NAME is required");
2642 if ( bRet && !
MoveFile( aTmpFile, aDbtFile ) )
2664 (pOptionsItem = pSet->
GetItemIfSet( SID_FILE_FILTEROPTIONS )) )
2669 if (sItStr.isEmpty())
2697 ScRange aRange( 0,0,0, nEndCol,nEndRow,0 );
2710 OUString sFilterOptions;
2713 sFilterOptions = pOptionsItem->GetValue();
2725 DialogMask::ButtonsOk | DialogMask::MessageInfo));
2742 Broadcast(
SfxHint( SfxHintId::ScDocSaved ) );
2752 sal_Int32 nVbaEventId = VBAEventId::NO_EVENT;
2753 uno::Sequence< uno::Any > aArgs;
2758 nVbaEventId = VBAEventId::WORKBOOK_BEFORESAVE;
2759 aArgs = {
uno::Any(nSlotId == SID_SAVEASDOC) };
2762 case SID_PRINTDOCDIRECT:
2763 nVbaEventId = VBAEventId::WORKBOOK_BEFOREPRINT;
2767 bool bSlotExecutable =
true;
2768 if( nVbaEventId != VBAEventId::NO_EVENT )
try
2770 uno::Reference< XVBAEventProcessor > xEventProcessor(
m_pDocument->GetVbaEventProcessor(), uno::UNO_SET_THROW );
2771 xEventProcessor->processVbaEvent( nVbaEventId, aArgs );
2773 catch( util::VetoException& )
2775 bSlotExecutable =
false;
2777 catch( uno::Exception& )
2780 return bSlotExecutable;
2785 if(
SC_MOD()->GetCurRefDlgId()>0)
2792 if(pViewSh!=
nullptr)
2814 uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents(
m_pDocument->GetVbaEventProcessor(), uno::UNO_SET_THROW );
2815 uno::Sequence< uno::Any > aArgs;
2816 xVbaEvents->processVbaEvent( script::vba::VBAEventId::WORKBOOK_BEFORECLOSE, aArgs );
2818 catch( util::VetoException& )
2823 catch( uno::Exception& )
2889 return std::make_unique<ScDocFuncDirect>( *
this );
2906 m_nCanUpdate (css::document::UpdateDocMode::ACCORDING_TO_CONFIG)
2923 m_pDocument->GetDBCollection()->SetRefreshHandler(
2958 OSL_FAIL(
"The Modificator should not exist");
2973 Broadcast(
SfxHint( SfxHintId::DocChanged ) );
3048 if (bUpdate && pBindings)
3064 if (
m_pDocument->IsChartListenerCollectionNeedsUpdate() )
3069 SC_MOD()->AnythingChanged();
3087 static_cast<sal_uInt16
>(
ScPrintFunc(
this, pPrinter,
i ).GetTotalPages()) );
3092 std::shared_ptr<SfxDocumentInfoDialog> xDlg = std::make_shared<SfxDocumentInfoDialog>(pParent,
rSet);
3096 if( pDocSh ==
this )
3100 OSL_ENSURE(ScDocStatPageCreate,
"Tabpage create fail!");
3101 xDlg->AddFontTabPage();
3102 xDlg->AddTabPage(
"calcstats",
ScResId(STR_DOC_STAT), ScDocStatPageCreate);
3138void removeKeysIfExists(
const Reference<ui::XAcceleratorConfiguration>& xScAccel,
const vector<const awt::KeyEvent*>& rKeys)
3140 for (
const awt::KeyEvent* p : rKeys)
3147 xScAccel->removeKeyEvent(*p);
3149 catch (
const container::NoSuchElementException&) {}
3159 Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
3163 Reference<XModuleUIConfigurationManagerSupplier> xModuleCfgSupplier(
3164 theModuleUIConfigurationManagerSupplier::get(xContext) );
3167 Reference<XUIConfigurationManager> xConfigMgr =
3168 xModuleCfgSupplier->getUIConfigurationManager(
3169 "com.sun.star.sheet.SpreadsheetDocument");
3171 if (!xConfigMgr.is())
3175 Reference<XAcceleratorConfiguration> xScAccel = xConfigMgr->getShortCutManager();
3180 vector<const awt::KeyEvent*> aKeys;
3184 awt::KeyEvent aBackspace;
3185 aBackspace.KeyCode = awt::Key::BACKSPACE;
3186 aBackspace.Modifiers = 0;
3187 aKeys.push_back(&aBackspace);
3190 awt::KeyEvent aDelete;
3191 aDelete.KeyCode = awt::Key::DELETE;
3192 aDelete.Modifiers = 0;
3193 aKeys.push_back(&aDelete);
3196 awt::KeyEvent aCtrlD;
3197 aCtrlD.KeyCode = awt::Key::D;
3198 aCtrlD.Modifiers = awt::KeyModifier::MOD1;
3199 aKeys.push_back(&aCtrlD);
3202 awt::KeyEvent aAltDown;
3203 aAltDown.KeyCode = awt::Key::DOWN;
3204 aAltDown.Modifiers = awt::KeyModifier::MOD2;
3205 aKeys.push_back(&aAltDown);
3208 awt::KeyEvent aCtrlSpace;
3209 aCtrlSpace.KeyCode = awt::Key::SPACE;
3210 aCtrlSpace.Modifiers = awt::KeyModifier::MOD1;
3211 aKeys.push_back(&aCtrlSpace);
3214 awt::KeyEvent aCtrlShiftSpace;
3215 aCtrlShiftSpace.KeyCode = awt::Key::SPACE;
3216 aCtrlShiftSpace.Modifiers = awt::KeyModifier::MOD1 | awt::KeyModifier::SHIFT;
3217 aKeys.push_back(&aCtrlShiftSpace);
3221 aF4.KeyCode = awt::Key::F4;
3223 aKeys.push_back(&aF4);
3226 awt::KeyEvent aCtrlShiftF4;
3227 aCtrlShiftF4.KeyCode = awt::Key::F4;
3228 aCtrlShiftF4.Modifiers = awt::KeyModifier::MOD1 | awt::KeyModifier::SHIFT;
3229 aKeys.push_back(&aCtrlShiftF4);
3232 awt::KeyEvent aShiftF4;
3233 aShiftF4.KeyCode = awt::Key::F4;
3234 aShiftF4.Modifiers = awt::KeyModifier::SHIFT;
3235 aKeys.push_back(&aShiftF4);
3239 removeKeysIfExists(xScAccel, aKeys);
3245 xScAccel->setKeyEvent(aDelete,
".uno:ClearContents");
3246 xScAccel->setKeyEvent(aBackspace,
".uno:Delete");
3247 xScAccel->setKeyEvent(aCtrlD,
".uno:FillDown");
3248 xScAccel->setKeyEvent(aAltDown,
".uno:DataSelect");
3249 xScAccel->setKeyEvent(aCtrlSpace,
".uno:SelectColumn");
3250 xScAccel->setKeyEvent(aCtrlShiftSpace,
".uno:SelectAll");
3251 xScAccel->setKeyEvent(aF4,
".uno:ToggleRelative");
3252 xScAccel->setKeyEvent(aCtrlShiftF4,
".uno:ViewDataSourceBrowser");
3255 xScAccel->setKeyEvent(aDelete,
".uno:Delete");
3256 xScAccel->setKeyEvent(aBackspace,
".uno:ClearContents");
3257 xScAccel->setKeyEvent(aCtrlD,
".uno:DataSelect");
3258 xScAccel->setKeyEvent(aCtrlShiftSpace,
".uno:SelectColumn");
3259 xScAccel->setKeyEvent(aF4,
".uno:ViewDataSourceBrowser");
3260 xScAccel->setKeyEvent(aShiftF4,
".uno:ToggleRelative");
3276 bool bHasEntries =
false;
3279 for (nTab = 0; nTab < nTabCount; ++nTab)
3287 for (nTab = 0; nTab < nTabCount; ++nTab)
3338 return pChangeTrack !=
nullptr;
3359 m_pDocument->SetChangeViewSettings(aChangeViewSet);
3385 if (!rNewPassword.isEmpty())
3390 css::uno::Sequence< sal_Int8 > aProtectionHash;
3396 pChangeTrack->
SetProtection( css::uno::Sequence< sal_Int8 >() );
3432 aDocument.SetInsertingFromOtherDoc(
true);
3436 return aImpEx.
ImportStream(rStream, OUString(), SotClipboardFormatId::SYLK);
3448 OUString sTmpDir = aTmpDir.
GetURL();
3462 SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS |
3463 SfxModelFlags::DISABLE_DOCUMENT_RECOVERY);
3465 xDocShell->DoInitNew();
3477 std::map<SCCOL, ScColWidthParam> aColWidthParam;
3480 xDocShell->DoClose();
const PropertyValue * pValues
#define BCA_BRDCST_ALWAYS
SfxApplication * SfxGetpApp()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static weld::Window * GetDefDialogParent()
const OUString & GetValue() const
OUString GetText(LineEnd eEnd=LINEEND_LF) const
void SetText(const OUString &rStr)
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool setExtension(std::u16string_view rTheExtension, sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool Append(std::u16string_view rTheSegment, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
bool GetShowSharedDocumentWarning() const
void SetShowSharedDocumentWarning(bool bNew)
void SetFieldSeps(const OUString &rStr)
rtl_TextEncoding GetCharSet() const
void SetIncludeBOM(bool bVal)
void SetCharSet(rtl_TextEncoding eNew)
void ReadFromString(std::u16string_view rString)
void SetTextSep(sal_Unicode c)
OUString WriteToString() const
move ScAutoStyleHint to a different file?
void SetProtection(const css::uno::Sequence< sal_Int8 > &rPass)
const css::uno::Sequence< sal_Int8 > & GetProtection() const
void SetShowChanges(bool bFlag)
void SetShowAccepted(bool bVal)
static SC_DLLPUBLIC void Init()
DLL-init/exit-code must be linked to the DLL only.
SC_DLLPUBLIC size_t GetCount() const
OUString CreateNewName() const
Create a new name that's not yet used by any existing data pilot objects.
void SetName(const OUString &rNew)
const OUString & GetName() const
bool DetectiveRefresh(bool bAutomatic=false)
void SetLookUpColRowNames(bool bVal)
Create before modifications of the document and destroy thereafter.
ScDocShellModificator(const ScDocShellModificator &)=delete
~ScDocShellModificator() COVERITY_NOEXCEPT_FALSE
bool bAutoCalcShellDisabled
void SetDocumentModified()
Do things that need to be done before saving to our own format and necessary clean ups in dtor.
~PrepareSaveGuard() COVERITY_NOEXCEPT_FALSE
PrepareSaveGuard(ScDocShell &rDocShell)
void NotifyStyle(const SfxStyleSheetHint &rHint)
void SetInitialLinkUpdate(const SfxMedium *pMedium)
SAL_DLLPRIVATE void UseSheetSaveEntries()
static weld::Window * GetActiveDialogParent()
ScDocShell(const ScDocShell &rDocShell)=delete
virtual bool Load(SfxMedium &rMedium) override
static OUString GetHtmlFilterName()
virtual bool Save() override
double m_nPrtToScreenFactor
SAL_DLLPRIVATE void ResetDrawObjectShell()
static OUString GetDifFilterName()
static OUString GetLotusFilterName()
bool MergeSharedDocument(ScDocShell *pSharedDocShell)
void SetDocumentModified()
static SAL_DLLPRIVATE bool KillFile(const INetURLObject &rURL)
virtual bool QuerySlotExecutable(sal_uInt16 nSlotId) override
css::uno::Reference< ooo::vba::excel::XWorkbook > mxAutomationWorkbookObject
sal_uInt16 m_nDocumentLock
SfxBindings * GetViewBindings()
bool m_bDocumentModifiedPending
void ErrorMessage(TranslateId pGlobStrId)
std::unique_ptr< ScDocFunc > m_pDocFunc
static OUString GetAsciiFilterName()
void AfterXMLLoading(bool bRet)
void AsciiSave(SvStream &rStream, const ScImportOptions &rOpt, SCTAB nTab)
virtual bool IsChangeRecording() const override
std::unique_ptr< ScOptSolverSave > m_pSolverSaveData
virtual void SetModified(bool=true) override
void SetClipData(const css::uno::Reference< css::datatransfer::XTransferable2 > &xTransferable)
virtual bool HasChangeRecordProtection() const override
void RegisterAutomationWorkbookObject(css::uno::Reference< ooo::vba::excel::XWorkbook > const &xWorkbook)
SAL_DLLPRIVATE SCTAB GetSaveTab()
css::uno::Reference< css::datatransfer::XTransferable2 > const & GetClipData() const
virtual bool DoSaveCompleted(SfxMedium *pNewStor=nullptr, bool bRegisterRecent=true) override
void SetSolverSaveData(std::unique_ptr< ScOptSolverSave > pData)
virtual bool ConvertTo(SfxMedium &rMedium) override
SAL_DLLPRIVATE css::uno::Reference< css::frame::XModel > LoadSharedDocument()
std::unique_ptr< ScSheetSaveData > m_pSheetSaveData
std::unique_ptr< ScFormatSaveData > m_pFormatSaveData
bool m_bAreasChangedNeedBroadcast
const ScDocument & GetDocument() const
SAL_DLLPRIVATE void InitItems()
void GetDocStat(ScDocStat &rDocStat)
virtual bool PrepareClose(bool bUI=true) override
virtual bool LoadFrom(SfxMedium &rMedium) override
std::shared_ptr< ScDocument > m_pDocument
static SAL_DLLPRIVATE bool MoveFile(const INetURLObject &rSource, const INetURLObject &rDest)
static OUString GetWebQueryFilterName()
std::unique_ptr< ScAutoStyleList > m_pAutoStyleList
SAL_DLLPRIVATE bool SaveXML(SfxMedium *pMedium, const css::uno::Reference< css::embed::XStorage > &)
std::unique_ptr< ScPaintLockData > m_pPaintLockData
ScDrawLayer * MakeDrawLayer()
virtual void SetProtectionPassword(const OUString &rPassword) override
SAL_DLLPRIVATE ErrCode DBaseExport(const OUString &rFullFileName, rtl_TextEncoding eCharSet, bool &bHasMemo)
std::unique_ptr< DocShell_Impl > m_pImpl
virtual HiddenInformation GetHiddenInformationState(HiddenInformation nStates) override
ScTabViewShell * GetBestViewShell(bool bOnlyVisible=true)
void SetInUndo(bool bSet)
static OUString GetDBaseFilterName()
virtual bool SaveAs(SfxMedium &rMedium) override
std::unique_ptr< ScDocShellModificator, o3tl::default_delete< ScDocShellModificator > > m_pModificator
bool IsDocumentModifiedPending() const
virtual void TerminateEditing() override
SAL_DLLPRIVATE void InitOptions(bool bForLoading)
SAL_DLLPRIVATE ErrCode DBaseImport(const OUString &rFullFileName, rtl_TextEncoding eCharSet, std::map< SCCOL, ScColWidthParam > &aColWidthParam, ScFlatBoolRowSegments &rRowHeightsRecalc)
SAL_DLLPRIVATE void DoEnterHandler()
css::uno::Reference< css::script::vba::XVBAScriptListener > m_xVBAListener
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
virtual ~ScDocShell() override
SAL_DLLPRIVATE bool LoadXML(SfxMedium *pMedium, const css::uno::Reference< css::embed::XStorage > &)
std::unique_ptr< ScDBData > m_pOldAutoDBRange
virtual bool ConvertFrom(SfxMedium &rMedium) override
void SetDrawModified()
SetDrawModified - without Formula update.
virtual void SetChangeRecording(bool bActivate, bool bLockAllViews=false) override
static OUString GetOwnFilterName()
static ScViewData * GetViewData()
virtual bool GetProtectionHash(css::uno::Sequence< sal_Int8 > &rPasswordHash) override
static bool HasAutomaticTableName(std::u16string_view rFilter)
void SetDocumentModifiedPending(bool bVal)
SAL_DLLPRIVATE std::unique_ptr< ScDocFunc > CreateDocFunc()
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
ScSheetSaveData * GetSheetSaveData()
virtual std::set< Color > GetDocColors() override
ScModelObj * GetModel() const
virtual std::shared_ptr< SfxDocumentInfoDialog > CreateDocumentInfoDialog(weld::Window *pParent, const SfxItemSet &rSet) override
static void ResetKeyBindings(ScOptionsUtil::KeyBindingType eType)
double GetOutputFactor() const
virtual SfxUndoManager * GetUndoManager() override
static SAL_DLLPRIVATE bool IsDocument(const INetURLObject &rURL)
ScFormatSaveData * GetFormatSaveData()
void UpdateLinks() override
virtual bool LoadExternal(SfxMedium &rMedium) override
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
void ClosingClipboardSource()
To be called at the clipboard document when closing a document that is the current clipboard source t...
bool IsIdleEnabled() const
SC_DLLPUBLIC SCROW MaxRow() const
void PrepareFormulaCalc()
Call this before any operations that might trigger one or more formula cells to get calculated.
SC_DLLPUBLIC void SetDocOptions(const ScDocOptions &rOpt)
void EnableExecuteLink(bool bVal)
@ TEMPORARY
normal calculation of dependencies
void EnableIdle(bool bDo)
SC_DLLPUBLIC void MakeTable(SCTAB nTab, bool _bNeedsNameCheck=true)
void SetInsertingFromOtherDoc(bool bVal)
sc::DocumentLinkManager & GetDocLinkManager()
void SetAutoCalcShellDisabled(bool bNew)
bool IsAutoCalcShellDisabled() const
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
bool IsImportingXML() const
void BroadcastUno(const SfxHint &rHint)
Extended options held by an ScDocument containing additional settings for filters.
void setAllCacheTableReferencedStati(bool bReferenced)
bool hasExternalData() const
static SC_DLLPUBLIC double nScreenPPTX
Horizontal pixel per twips factor.
static rtl_TextEncoding GetCharsetValue(std::u16string_view rCharSet)
static SC_DLLPUBLIC OUString GetDocTabName(std::u16string_view rFileName, std::u16string_view rTabName)
static const sal_Unicode * UnicodeStrChr(const sal_Unicode *pStr, sal_Unicode c)
strchr() functionality on unicode, as long as we need it for FormulaToken etc.
::tools::Long nLastColWidthExtra
static SC_DLLPUBLIC double nScreenPPTY
Vertical pixel per twips factor.
static OUString GetCharsetString(rtl_TextEncoding eVal)
static OUString GetErrorString(FormulaError nErrNumber)
ScRefCellValue * GetNext(SCCOL &rCol, SCROW &rRow)
bool IsOverflowCol() const
void SetFilterOptions(const OUString &rFilterOptions)
void SetStreamPath(const OUString &rPath)
bool ExportStream(SvStream &, const OUString &rBaseURL, SotClipboardFormatId)
bool IsOverflowRow() const
bool ImportStream(SvStream &, const OUString &rBaseURL, SotClipboardFormatId)
bool IsOverflowCell() const
void SetExtOptions(const ScAsciiOptions &rOpt)
const OUString & GetNonConvertibleChars() const
bool GetIncludeBOM() const
OUString BuildString() const
sal_Unicode nFieldSepCode
rtl_TextEncoding eCharSet
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
SCTAB GetFirstSelected() const
void SetMarkArea(const ScRange &rRange)
static void CreateAndSet(ScDocShell *pDocSh)
create ScModelObj and set at pDocSh (SetBaseModel)
static ScDocument * GetClipDoc()
Collection of orcus filter wrappers.
virtual bool importXLSX(ScDocument &rDoc, SfxMedium &rMedium) const =0
virtual bool importExcel2003XML(ScDocument &rDoc, SfxMedium &rMedium) const =0
virtual bool importGnumeric(ScDocument &rDoc, SfxMedium &rMedium) const =0
virtual bool importCSV(ScDocument &rDoc, SfxMedium &rMedium) const =0
virtual bool importODS_Styles(ScDocument &rDoc, OUString &aFileName) const =0
Used to import just the styles from an xml file.
virtual bool importODS(ScDocument &rDoc, SfxMedium &rMedium) const =0
void SetStateOnPercent(sal_uInt64 nVal)
bool GetHideFormula() const
OutputDevice * GetDevice() const
bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash)
static ScTabViewShell * GetActiveViewShell()
weld::Window * GetDialogParent()
parent window for dialogs Problem: OLE Server!
ScViewData & GetViewData()
sal_uInt16 GetTablesHintId() const
ScMarkData & GetMarkData()
ScDocShell * GetDocShell() const
ScTabViewShell * GetViewShell() const
ScDBFunc * GetView() const
static bool WarningOnPassword(SfxMedium &rMedium)
Opens a query warning dialog.
bool Export(bool bStylesOnly)
bool Import(ImportFlags nMode, ErrCode &rError)
const sc::ImportPostProcessData & GetImportPostProcessData() const
void RemoveDdeTopic(SfxObjectShell const *)
const DdeService * GetDdeService() const
virtual css::uno::Reference< css::document::XDocumentProperties > SAL_CALL getDocumentProperties() override
virtual void SAL_CALL storeToURL(const OUString &sURL, const css::uno::Sequence< css::beans::PropertyValue > &seqArguments) override
SfxObjectShell * GetObjectShell() const
const SfxPoolItem * ExecuteSynchron(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr)
void Invalidate(sal_uInt16 nId)
void InvalidateAll(bool bWithMsg)
SfxEventHintId GetEventId() const
css::uno::Reference< css::frame::XController > GetController() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
const std::shared_ptr< const SfxFilter > & GetFilter() const
void SetError(ErrCode nError)
OUString GetBaseURL(bool bForSaving=false)
const INetURLObject & GetURLObject() const
SfxItemSet * GetItemSet() const
const OUString & GetName() const
const css::uno::Sequence< css::beans::PropertyValue > & GetArgs() const
SvStream * GetOutStream()
const OUString & GetPhysicalName() const
virtual bool PrepareClose(bool bUI=true)
void SetError(ErrCode rErr)
css::uno::Reference< css::script::XLibraryContainer > GetBasicContainer()
virtual bool DoSaveCompleted(SfxMedium *pNewStor=nullptr, bool bRegisterRecent=true)
virtual bool LoadFrom(SfxMedium &rMedium)
virtual bool Load(SfxMedium &rMedium)
bool IsInPrepareClose() const
OUString GetSharedFileURL() const
static bool IsOwnStorageFormat(const SfxMedium &)
virtual bool SaveAs(SfxMedium &rMedium)
bool IsEnableSetModified() const
virtual void SetVisArea(const tools::Rectangle &rVisArea)
bool SwitchToShared(bool bShared, bool bSave)
void FinishedLoading(SfxLoadedFlags nWhich=SfxLoadedFlags::ALL)
SfxMedium * GetMedium() const
void SetReadOnlyUI(bool bReadOnly=true)
bool HasSharedXMLFlagSet() const
virtual HiddenInformation GetHiddenInformationState(HiddenInformation nStates)
SfxObjectCreateMode GetCreateMode() const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
virtual void SetModified(bool bModified=true)
SfxItemPool & GetPool() const
const OUString & GetName() const
SfxViewShell * GetViewShell() const
void SetPool(SfxItemPool *pNewPool)
const css::uno::Any & GetValue() const
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SfxFrame & GetFrame() const
SfxViewFrame & GetViewFrame() const
vcl::Window * GetWindow() const
static SVL_DLLPUBLIC void GetHashPassword(css::uno::Sequence< sal_Int8 > &rPassHash, const char *pPass, sal_uInt32 nLen)
void StartWritingUnicodeText()
void SetEndian(SvStreamEndian SvStreamEndian)
std::size_t WriteBytes(const void *pData, std::size_t nSize)
SvStream & WriteUChar(unsigned char nChar)
bool WriteUnicodeOrByteText(std::u16string_view rStr, rtl_TextEncoding eDestCharSet)
bool WriteUniOrByteChar(sal_Unicode ch, rtl_TextEncoding eDestCharSet)
SvStreamEndian GetEndian() const
sal_uInt64 Seek(sal_uInt64 nPos)
void SetStreamCharSet(rtl_TextEncoding eCharSet)
std::size_t ReadBytes(void *pData, std::size_t nSize)
rtl_TextEncoding GetStreamCharSet() const
static std::shared_ptr< ConfigurationChanges > create()
#define SO3_SC_CLASSID_60
void SetRefreshOnEmptyLine(bool bVal)
void setDataStream(DataStream *p)
const OUString & getString() const
LockFileEntry GetLockData()
static OUString getProductName()
void EnableKillingFile(bool bEnable=true)
SvStream * GetStream(StreamMode eMode)
OUString const & GetURL() const
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
#define SC_COMPILER_FILE_TAB_SEP
#define TOOLS_WARN_EXCEPTION(area, stream)
void UpdateAcceptChangesDialog()
constexpr OUStringLiteral pFilterDif
constexpr OUStringLiteral pFilterDBase
SAL_DLLPUBLIC_EXPORT bool TestImportSLK(SvStream &rStream)
constexpr OUStringLiteral pFilterHtmlWebQ
SAL_DLLPUBLIC_EXPORT bool TestImportDBF(SvStream &rStream)
const char pFilterEx97Temp[]
constexpr OUStringLiteral pFilterLotus
static void lcl_parseHtmlFilterOption(const OUString &rOption, LanguageType &rLang, bool &rDateConvert)
const char pFilterExcel97[]
const char16_t pFilterSylk[]
constexpr OUStringLiteral pFilterSc50
const char pFilterEx5Temp[]
const char pFilterEx95Temp[]
const char pFilterQPro6[]
const char16_t pFilterRtf[]
constexpr OUStringLiteral pFilterHtml
const char pFilterExcel5[]
const char16_t pFilterEx4Temp[]
const char pFilterExcel95[]
const char16_t pFilterExcel4[]
#define ERRCODE_IO_CANTCREATE
#define ERRCODE_IO_GENERAL
#define SVSTREAM_FILEFORMAT_ERROR
Reference< XSingleServiceFactory > xFactory
constexpr OUStringLiteral SC_TEXT_CSV_FILTER_NAME
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
std::unique_ptr< sal_Int32[]> pData
SVL_DLLPUBLIC bool IsDocument(const OUString &rURL)
constexpr OUStringLiteral aData
bool needsPassHashRegen(const ScDocument &rDoc, ScPasswordHash eHash1, ScPasswordHash eHash2=PASSHASH_UNSPECIFIED)
Check for the compatibility of all password hashes.
SVL_DLLPUBLIC OUString simpleNormalizedMakeRelative(OUString const &baseUriReference, OUString const &uriReference)
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill='\0')
OUStringBuffer & truncateToLength(OUStringBuffer &rBuffer, sal_Int32 nLength)
Reference< XComponentContext > getProcessComponentContext()
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
std::shared_ptr< T > make_shared(Args &&... args)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
SFX_IMPL_OBJECTFACTORY(DrawDocShell, SvGlobalName(SO3_SIMPRESS_CLASSID), "simpress") void DrawDocShell
sal_Int32 toInt32(std::u16string_view rStr)
OUString ScResId(TranslateId aId)
#define SCWARN_EXPORT_ASCII
#define SCWARN_IMPORT_ROW_OVERFLOW
#define SCERR_IMPORT_UNKNOWN
#define SCWARN_IMPORT_CELL_OVERFLOW
#define SCERR_EXPORT_DATA
#define SCWARN_IMPORT_COLUMN_OVERFLOW
#define SCERR_IMPORT_CONNECT
#define SCWARN_EXPORT_NONCONVERTIBLE_CHARS
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
#define ERRCODE_SFX_WRONGPASSWORD
#define SFX_IMPL_INTERFACE(Class, SuperClass)
OUString VCL_DLLPUBLIC GetStandardText(StandardButtonType eButton)
TOOLS_DLLPUBLIC SvStream & endlub(SvStream &rStr)
TOOLS_DLLPUBLIC std::size_t write_uInt16s_FromOUString(SvStream &rStrm, std::u16string_view rStr, std::size_t nUnits)
ScFlatBoolRowSegments maRanges
This is very similar to ScCellValue, except that it references the original value instead of copying ...
ScFormulaCell * getFormula() const
const EditTextObject * getEditText() const
const svl::SharedString * getSharedString() const
Data stream data needs to be post-processed because it requires ScDocShell instance which is not avai...
Stores data imported from the file that need to be processed at the end of the import process.
std::unique_ptr< DataStream > mpDataStream
Reference< XController > xController
Reference< XModel > xModel
std::unique_ptr< weld::CheckButton > m_xWarningOnBox
std::unique_ptr< char[]> aBuffer