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>
103#include <progress.hxx>
119#include <compiler.hxx>
127#include <undomanager.hxx>
130#include <officecfg/Office/Calc.hxx>
137#include <uiitems.hxx>
154using ::com::sun::star::uno::Reference;
155using ::com::sun::star::lang::XMultiServiceFactory;
156using std::shared_ptr;
180#define ShellClass_ScDocShell
181#include <scslots.hxx>
195 OUString* pFullTypeName,
196 sal_Int32 nFileFormat,
197 bool bTemplate )
const
202 *pFormat = SotClipboardFormatId::STARCALC_60;
203 *pFullTypeName =
ScResId( SCSTR_LONG_SCDOC_NAME_60 );
208 *pFormat = bTemplate ? SotClipboardFormatId::STARCALC_8_TEMPLATE : SotClipboardFormatId::STARCALC_8;
209 *pFullTypeName =
ScResId( SCSTR_LONG_SCDOC_NAME_80 );
213 OSL_FAIL(
"Which version?");
244 return pTheme->getColorSet();
251 SC_MOD()->InputEnterHandler();
271 if ( nStates & HiddenInformation::RECORDEDCHANGES )
274 nState |= HiddenInformation::RECORDEDCHANGES;
276 if ( nStates & HiddenInformation::NOTES )
280 for (
SCTAB nTab = 0; nTab < nTableCount && !bFound; ++nTab)
287 nState |= HiddenInformation::NOTES;
298 OSL_ENSURE(
m_pModificator ==
nullptr,
"The Modificator should not exist");
323 for (
SCTAB i = 0;
i < nTabCount; ++
i)
330 sal_Int32 nLinkTabNameLength = aLinkTabName.getLength();
331 sal_Int32 nNameLength =
aName.getLength();
332 if (nLinkTabNameLength < nNameLength)
337 if ( *pNameBuffer ==
'\'' &&
340 OUStringBuffer aDocURLBuffer;
343 while ( bQuote && *pNameBuffer )
345 if ( *pNameBuffer ==
'\'' && *(pNameBuffer-1) !=
'\\' )
347 else if( *pNameBuffer !=
'\\' || *(pNameBuffer+1) !=
'\'' )
348 aDocURLBuffer.append(*pNameBuffer);
354 sal_Int32
nIndex = nNameLength - nLinkTabNameLength;
378 size_t nDPCount = pDPCollection->
GetCount();
379 for (
size_t nDP=0; nDP<nDPCount; ++nDP)
382 if (rDPObj.
GetName().isEmpty())
409 OSL_FAIL(
"The Modificator should exist");
423 mpDoc->SetLoadingMedium(
true);
428 mpDoc->SetLoadingMedium(
false);
469 MessageWithCheck(
weld::Window *pParent,
const OUString& rUIFile,
const OUString& rDialogId)
470 : MessageDialogController(pParent, rUIFile, rDialogId,
"ask")
478#if HAVE_FEATURE_SCRIPTING
479class VBAScriptListener :
public ::cppu::WeakImplHelper< css::script::vba::XVBAScriptListener >
484 VBAScriptListener(
ScDocShell* pDocSh) : m_pDocSh(pDocSh)
489 virtual void SAL_CALL notifyVBAScriptEvent( const ::css::script::vba::VBAScriptEvent& aEvent )
override
491 if (
aEvent.Identifier == script::vba::VBAScriptEventId::SCRIPT_STOPPED &&
494 m_pDocSh->
SetClipData(uno::Reference<datatransfer::XTransferable2>());
499 virtual void SAL_CALL disposing( const ::css::lang::EventObject& )
override
538 static_cast<ScRecalcOptions>(officecfg::Office::Calc::Formula::Load::ODFRecalcMode::get());
540 bool bHardRecalc =
false;
544 if (
m_pDocument->IsUserInteractionEnabled() && xDocProps->getGenerator().indexOf(sProductName) == -1)
549 "modules/scalc/ui/recalcquerydialog.ui",
"RecalcQueryDialog");
550 aQueryBox.set_primary_text(
ScResId(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS));
551 aQueryBox.set_default_response(
RET_YES);
553 if ( officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::isReadOnly() )
554 aQueryBox.hide_ask();
556 bHardRecalc = aQueryBox.run() ==
RET_YES;
558 if (aQueryBox.get_active())
562 officecfg::Office::Calc::Formula::Load::ODFRecalcMode::set(sal_Int32(0), batch);
567 SC_MOD()->SetFormulaOptions(aOpt);
597 bRet = aImport.
Export(
false);
599 bRet = aImport.
Export(
true);
621 pDrawLayer->SetCompatibilityFlag(SdrCompatibilityFlag::AnchoredTextOverflowLegacy,
623 pDrawLayer->SetCompatibilityFlag(SdrCompatibilityFlag::LegacySingleLineFontwork,
639 m_pDocument->GetStyleSheetPool()->CreateStandardStyles();
644 OUString
aURL(
"$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER
"/calc/styles.xml");
645 rtl::Bootstrap::expandMacros(
aURL);
648 osl::FileBase::getSystemPathFromFileURL(
aURL, aPath);
655 m_pDocument->GetStyleSheetPool()->setAllParaStandard();
658 bRet =
LoadXML( &rMedium,
nullptr );
687 uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents =
m_pDocument->GetVbaEventProcessor();
688 if ( xVbaEvents.is() )
try
691 xVbaEvents->processVbaEvent( script::vba::VBAEventId::WORKBOOK_NEWSHEET, aArgs );
693 catch( uno::Exception& )
701 else if (
auto pStlHint =
dynamic_cast<const ScAutoStyleHint*
>(&rHint) )
709 const ScRange& aRange = pStlHint->GetRange();
710 const OUString& aName1 = pStlHint->GetStyle1();
711 const OUString& aName2 = pStlHint->GetStyle2();
712 sal_uInt32 nTimeout = pStlHint->GetTimeout();
718 else if (
auto pEventHint =
dynamic_cast<const SfxEventHint*
>(&rHint) )
724 case SfxEventHintId::LoadFinished:
726#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
749 case SfxEventHintId::ViewCreated:
751 #if HAVE_FEATURE_SCRIPTING
752 uno::Reference<script::vba::XVBACompatibility> xVBACompat(
GetBasicContainer(), uno::UNO_QUERY);
760#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
768 "modules/scalc/ui/sharedwarningdialog.ui",
"SharedWarningDialog");
771 bool bChecked = aWarningBox.get_active();
775 SC_MOD()->SetAppOptions( aAppOptions );
782 uno::Reference< uno::XComponentContext > xContext(
784 uno::Reference< lang::XMultiServiceFactory > xServiceManager(
785 xContext->getServiceManager(),
786 uno::UNO_QUERY_THROW );
787 uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xServiceManager, uno::UNO_QUERY_THROW );
788 uno::Reference< container::XEnumeration> xEnum = xEnumAccess->createContentEnumeration(
789 "com.sun.star.sheet.SpreadsheetDocumentJob" );
792 while ( xEnum->hasMoreElements() )
794 uno::Any aAny = xEnum->nextElement();
795 uno::Reference< lang::XSingleComponentFactory >
xFactory;
799 uno::Reference< task::XJob > xJob(
xFactory->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW );
805 uno::Reference< sheet::XSpreadsheetView > xSpreadsheetView(
xController, uno::UNO_QUERY_THROW );
806 uno::Sequence< beans::NamedValue > aArgsForJob { {
"SpreadsheetView",
uno::Any( xSpreadsheetView ) } };
807 xJob->execute( aArgsForJob );
812 catch ( uno::Exception & )
817 case SfxEventHintId::SaveDoc:
819#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
822 bool bSuccess =
false;
827 uno::Reference< frame::XModel >
xModel;
832 uno::Reference< util::XCloseable > xCloseable(
xModel, uno::UNO_QUERY_THROW );
835 bool bShared =
false;
838 if ( pSharedDocShell )
844 bool bOwnEntry =
false;
845 bool bEntriesNotAccessible =
false;
851 catch ( uno::Exception& )
853 bEntriesNotAccessible =
true;
856 if ( bShared && bOwnEntry )
858 uno::Reference< frame::XStorable > xStorable(
xModel, uno::UNO_QUERY_THROW );
860 if ( xStorable->isReadonly() )
862 xCloseable->close(
true );
864 OUString aUserName(
ScResId( STR_UNKNOWN_USER ) );
865 bool bNoLockAccess =
false;
870 if ( !
aData[LockFileComponent::OOOUSERNAME].isEmpty() )
872 aUserName =
aData[LockFileComponent::OOOUSERNAME];
874 else if ( !
aData[LockFileComponent::SYSUSERNAME].isEmpty() )
876 aUserName =
aData[LockFileComponent::SYSUSERNAME];
879 catch ( uno::Exception& )
881 bNoLockAccess =
true;
891 OUString aMessage(
ScResId( STR_FILE_LOCKED_SAVE_LATER ) );
892 aMessage = aMessage.replaceFirst(
"%1", aUserName );
895 VclMessageType::Warning, VclButtonsType::NONE,
909 bool bSaveToShared =
false;
910 if ( pSharedDocShell )
916 xCloseable->close(
true );
923 bool bChangedViewSettings =
false;
925 if ( pChangeViewSet && pChangeViewSet->
ShowChanges() )
929 m_pDocument->SetChangeViewSettings( *pChangeViewSet );
930 bChangedViewSettings =
true;
934 uno::Sequence< beans::PropertyValue > aValues{
937 GetMedium()->GetFilter()->GetFilterName())
941 if ( pPasswordItem && !pPasswordItem->
GetValue().isEmpty() )
943 aValues.realloc( 2 );
944 auto pValues = aValues.getArray();
951 aValues.realloc(aValues.getLength() + 1);
952 auto pValues = aValues.getArray();
953 pValues[aValues.getLength() - 1].Name =
"EncryptionData";
957 SC_MOD()->SetInSharedDocSaving(
true );
959 SC_MOD()->SetInSharedDocSaving(
false );
961 if ( bChangedViewSettings )
965 m_pDocument->SetChangeViewSettings( *pChangeViewSet );
975 xCloseable->close(
true );
977 if ( bEntriesNotAccessible )
985 VclMessageType::Warning, VclButtonsType::Ok,
986 ScResId(STR_DOC_NOLONGERSHARED)));
997 catch ( uno::Exception& )
1000 SC_MOD()->SetInSharedDocSaving(
false );
1004 uno::Reference< util::XCloseable > xClose(
xModel, uno::UNO_QUERY_THROW );
1005 xClose->close(
true );
1007 catch ( uno::Exception& )
1022 case SfxEventHintId::SaveAsDoc:
1024 if (
GetDocument().GetExternalRefManager()->containsUnsavedReferences() )
1027 VclMessageType::Warning, VclButtonsType::YesNo,
1028 ScResId(STR_UNSAVED_EXT_REF)));
1029 if (
RET_NO == xWarn->run())
1036 case SfxEventHintId::SaveToDoc:
1043 case SfxEventHintId::SaveDocDone:
1044 case SfxEventHintId::SaveAsDocDone:
1050 case SfxEventHintId::SaveToDocDone:
1061 else if (rHint.
GetId() == SfxHintId::TitleChanged)
1067 else if (rHint.
GetId() == SfxHintId::Deinitializing)
1070#if HAVE_FEATURE_SCRIPTING
1071 uno::Reference<script::vba::XVBACompatibility> xVBACompat(
GetBasicContainer(), uno::UNO_QUERY);
1097 case SfxEventHintId::CreateDoc:
1101 uno::Sequence< uno::Any > aArgs{ aWorkbook };
1102 SC_MOD()->CallAutomationApplicationEventSinks(
"NewWorkbook", aArgs );
1105 case SfxEventHintId::OpenDoc:
1109 uno::Sequence< uno::Any > aArgs{ aWorkbook };
1110 SC_MOD()->CallAutomationApplicationEventSinks(
"WorkbookOpen", aArgs );
1132 bRet =
LoadXML( &rMedium,
nullptr );
1142 OUStringBuffer
aBuf;
1143 std::vector< OUString > aTokens;
1144 sal_Int32
n = rOption.getLength();
1146 for (sal_Int32
i = 0;
i <
n; ++
i)
1151 if (!
aBuf.isEmpty())
1152 aTokens.push_back(
aBuf.makeStringAndClear() );
1158 if (!
aBuf.isEmpty())
1159 aTokens.push_back(
aBuf.makeStringAndClear() );
1162 rDateConvert =
false;
1164 if (!aTokens.empty())
1165 rLang =
static_cast<LanguageType>(aTokens[0].toInt32());
1166 if (aTokens.size() > 1)
1167 rDateConvert =
static_cast<bool>(aTokens[1].
toInt32());
1168 if (aTokens.size() > 2)
1169 rScientificConvert =
static_cast<bool>(aTokens[2].
toInt32());
1184 bool bSetColWidths =
false;
1185 bool bSetSimpleTextColWidths =
false;
1186 std::map<SCCOL, ScColWidthParam> aColWidthParam;
1189 bool bSetRowHeights =
false;
1191 vector<ScDocRowHeightUpdater::TabRanges> aRecalcRowRangesArray;
1199 std::shared_ptr<const SfxFilter> pFilter = rMedium.
GetFilter();
1202 OUString aFltName = pFilter->GetFilterName();
1204 bool bCalc3 = aFltName ==
"StarCalc 3.0";
1205 bool bCalc4 = aFltName ==
"StarCalc 4.0";
1206 if (!bCalc3 && !bCalc4)
1210 bRet =
LoadXML( &rMedium,
nullptr );
1216 sItStr = pOptionsItem->GetValue();
1219 if (sItStr.isEmpty())
1238 bSetColWidths =
true;
1239 bSetRowHeights =
true;
1259 if (
m_pDocument->IsChartListenerCollectionNeedsUpdate() )
1275 else if (aFltName ==
"Gnumeric Spreadsheet")
1283 else if (aFltName ==
"MS Excel 2003 XML Orcus")
1294 bool bOptInit =
false;
1313 bool bOverflowRow, bOverflowCol, bOverflowCell;
1314 bOverflowRow = bOverflowCol = bOverflowCell =
false;
1325 pInStream->
Seek( 0 );
1342#if !(defined ANDROID)
1361 OSL_FAIL(
"No Stream" );
1372 else if (!
GetError() && (bOverflowRow || bOverflowCol || bOverflowCell))
1380 bSetColWidths =
true;
1381 bSetSimpleTextColWidths =
true;
1388 sItStr = pOptionsItem->GetValue();
1391 if (sItStr.isEmpty())
1402 aRecalcRowRangesArray.push_back(aRecalcRanges);
1415 bSetColWidths =
true;
1416 bSetSimpleTextColWidths =
true;
1427 sItStr = pOptionsItem->GetValue();
1430 if (sItStr.isEmpty())
1451 bSetColWidths =
true;
1452 bSetSimpleTextColWidths =
true;
1453 bSetRowHeights =
true;
1458 bool bOverflowRow, bOverflowCol, bOverflowCell;
1459 bOverflowRow = bOverflowCol = bOverflowCell =
false;
1467 pInStream->
Seek( 0 );
1480 OSL_FAIL(
"No Stream" );
1491 else if (!
GetError() && (bOverflowRow || bOverflowCol || bOverflowCell))
1499 bSetColWidths =
true;
1500 bSetSimpleTextColWidths =
true;
1501 bSetRowHeights =
true;
1519 bSetRowHeights =
true;
1529 pInStream->
Seek( 0 );
1545 bSetColWidths =
true;
1546 bSetRowHeights =
true;
1550 OSL_FAIL(
"No Stream" );
1572 bool bDateConvert =
false;
1573 bool bScientificConvert =
true;
1576 OUString aFilterOption = pOptionsItem->GetValue();
1580 pInStream->
Seek( 0 );
1586 GetOutputFactor(), !bWebQuery, &aNumFormatter, bDateConvert, bScientificConvert );
1604 OSL_FAIL(
"No Stream" );
1620 SAL_WARN(
"sc.filter",
"No match for filter '" << aFltName <<
"' in ConvertFrom");
1630 OSL_FAIL(
"No Filter in ConvertFrom");
1635 if ( bRet && (bSetColWidths || bSetRowHeights) )
1643 for (
SCTAB nTab=0; nTab<nTabCount; nTab++)
1647 m_pDocument->GetCellArea( nTab, nEndCol, nEndRow );
1655 if ( bSetColWidths )
1657 for (
SCCOL nCol=0; nCol <= nEndCol; nCol++ )
1659 if (!bSetSimpleTextColWidths)
1660 aColWidthParam[nCol].mbSimpleText =
false;
1662 sal_uInt16 nWidth =
m_pDocument->GetOptimalColWidth(
1663 nCol, nTab, pVirtDev,
nPPTX,
nPPTY, aZoom, aZoom,
false, &aMark,
1664 &aColWidthParam[nCol] );
1678 else if (!aRecalcRowRangesArray.empty())
1699 std::shared_ptr<const SfxFilter> pFilter = rMed.
GetFilter();
1703 if (pFilter->GetProviderName() ==
"orcus")
1709 const OUString& rFilterName = pFilter->GetName();
1710 if (rFilterName ==
"gnumeric")
1715 else if (rFilterName ==
"csv")
1720 else if (rFilterName ==
"xlsx")
1725 else if (rFilterName ==
"ods")
1739 : mrDocShell( rDocShell)
1764 if (mrDocShell.m_pDocument->HasExternalRefManager())
1783 if (
auto pSysWin = pFrame1->GetWindow().GetSystemWindow())
1785 pSysWin->SetAccessibleName(OUString());
1800void popFileName(OUString& rPath)
1802 if (!rPath.isEmpty())
1805 aURLObj.removeSegment();
1815 SC_MOD()->InputEnterHandler();
1824 aCurPath = pCurMedium->
GetName();
1825 popFileName(aCurPath);
1828 if (!aCurPath.isEmpty())
1831 OUString aNewPath = rMedium.
GetName();
1832 popFileName(aNewPath);
1834 if (!aRel.isEmpty())
1851 if (pViewShell && bNeedsRehash)
1853 bool bAutoSaveEvent =
false;
1860 "Should re-type password for own format, won't export recovery file");
1877 bRet =
SaveXML( &rMedium,
nullptr );
1885sal_Int32 lcl_ScDocShell_GetColWidthInChars( sal_uInt16 nWidth )
1893 return sal_Int32( f );
1896void lcl_ScDocShell_GetFixedWidthString( OUString& rStr,
const ScDocument& rDoc,
1899 OUString aString = rStr;
1900 sal_Int32 nLen = lcl_ScDocShell_GetColWidthInChars(
1903 if ( nLen < aString.getLength() )
1905 OUStringBuffer aReplacement;
1907 aReplacement.append(
"###");
1909 aReplacement.append(aString);
1914 if ( nLen > aString.getLength() )
1916 if ( bValue && eHorJust == SvxCellHorJustify::Standard )
1917 eHorJust = SvxCellHorJustify::Right;
1918 OUStringBuffer aTmp(nLen);
1921 case SvxCellHorJustify::Right:
1923 aString = aTmp.append(aString);
1925 case SvxCellHorJustify::Center:
1929 aTmp.append(aString);
1932 aString = aTmp.makeStringAndClear();
1937void lcl_ScDocShell_WriteEmptyFixedWidthString(
SvStream& rStream,
1941 lcl_ScDocShell_GetFixedWidthString( aString, rDoc, nTab, nCol,
false,
1942 SvxCellHorJustify::Standard );
1946template<
typename StrT,
typename SepCharT>
1947sal_Int32 getTextSepPos(
1948 const StrT& rStr,
const ScImportOptions& rAsciiOpt,
const SepCharT& rTextSep,
const SepCharT& rFieldSep,
bool& rNeedQuotes)
1952 sal_Int32
nPos = rStr.indexOf(rTextSep);
1954 (rStr.indexOf(rFieldSep) >= 0) ||
1955 (rStr.indexOf(
'\n') >= 0) ||
1956 (rStr.indexOf(
'\r') >= 0);
1966 rtl_TextEncoding eCharSet = rAsciiOpt.
eCharSet;
1976 OString aStrDelimEncoded;
1977 OUString aStrDelimDecoded;
1978 OString aDelimEncoded;
1979 OUString aDelimDecoded;
1980 bool bContextOrNotAsciiEncoding;
1981 if ( eCharSet == RTL_TEXTENCODING_UNICODE )
1984 bContextOrNotAsciiEncoding =
false;
1989 if (bIncludeBOM && eCharSet == RTL_TEXTENCODING_UTF8)
1991 aStrDelimEncoded = OString(&cStrDelim, 1, eCharSet);
1992 aDelimEncoded = OString(&
cDelim, 1, eCharSet);
1993 rtl_TextEncodingInfo aInfo;
1994 aInfo.StructSize =
sizeof(aInfo);
1995 if ( rtl_getTextEncodingInfo( eCharSet, &aInfo ) )
1997 bContextOrNotAsciiEncoding =
1998 (((aInfo.Flags & RTL_TEXTENCODING_INFO_CONTEXT) != 0) ||
1999 ((aInfo.Flags & RTL_TEXTENCODING_INFO_ASCII) == 0));
2000 if ( bContextOrNotAsciiEncoding )
2002 aStrDelimDecoded = OStringToOUString(aStrDelimEncoded, eCharSet);
2003 aDelimDecoded = OStringToOUString(aDelimEncoded, eCharSet);
2007 bContextOrNotAsciiEncoding =
false;
2010 SCCOL nStartCol = 0;
2011 SCROW nStartRow = 0;
2014 m_pDocument->GetCellArea( nTab, nEndCol, nEndRow );
2020 bool bTabProtect =
m_pDocument->IsTabProtected( nTab );
2027 if (!bFixedWidth &&
cDelim != 0)
2034 if ((pCell = aIter.
GetNext( nCol, nRow)) !=
nullptr && nCol == nStartCol && !aIter.
GetNext( nCol, nRow))
2039 if (aString.getLength() <= 5 && aString.startsWithIgnoreAsciiCase(
"sep="))
2045 aString =
"sep=" + OUStringChar(
cDelim);
2048 if (eCharSet == RTL_TEXTENCODING_UNICODE)
2056 rStream.
WriteBytes( aStrEnc.getStr(), aStrEnc.getLength());
2067 SCCOL nNextCol = nStartCol;
2068 SCROW nNextRow = nStartRow;
2076 while ( ( pCell = aIter.
GetNext( nCol, nRow ) ) !=
nullptr )
2078 bool bProgress =
false;
2079 if ( nNextRow < nRow )
2082 for ( nEmptyCol = nNextCol; nEmptyCol < nEndCol; nEmptyCol++ )
2085 lcl_ScDocShell_WriteEmptyFixedWidthString( rStream,
2092 for ( nEmptyRow = nNextRow; nEmptyRow < nRow; nEmptyRow++ )
2094 for ( nEmptyCol = nStartCol; nEmptyCol < nEndCol; nEmptyCol++ )
2097 lcl_ScDocShell_WriteEmptyFixedWidthString( rStream,
2104 for ( nEmptyCol = nStartCol; nEmptyCol < nCol; nEmptyCol++ )
2107 lcl_ScDocShell_WriteEmptyFixedWidthString( rStream,
2114 else if ( nNextCol < nCol )
2116 for ( nEmptyCol = nNextCol; nEmptyCol < nCol; nEmptyCol++ )
2119 lcl_ScDocShell_WriteEmptyFixedWidthString( rStream,
2125 if ( nCol == nEndCol )
2128 nNextCol = nStartCol;
2129 nNextRow = nRow + 1;
2132 nNextCol = nCol + 1;
2145 bool bForceQuotes =
false;
2156 if ( bShowFormulas )
2168 sal_uInt32 nFormat =
m_pDocument->GetNumberFormat(aPos);
2169 if ( bFixedWidth || bSaveAsShown )
2171 const Color* pDummy;
2173 bString = bSaveAsShown && rFormatter.
IsTextFormat( nFormat);
2178 bString = bForceQuotes = !bSaveNumberAsSuch;
2185 sal_uInt32 nFormat =
m_pDocument->GetNumberFormat(aPos);
2186 const Color* pDummy;
2198 sal_uInt32 nFormat =
m_pDocument->GetNumberFormat(aPos);
2199 const Color* pDummy;
2217 sal_uInt32 nFormat =
m_pDocument->GetNumberFormat( nCol, nRow, nTab );
2218 if ( bFixedWidth || bSaveAsShown )
2220 const Color* pDummy;
2222 bString = bSaveAsShown && rFormatter.
IsTextFormat( nFormat);
2227 bString = bForceQuotes = !bSaveNumberAsSuch;
2232 OSL_FAIL(
"ScDocShell::AsciiSave: unknown CellType" );
2241 lcl_ScDocShell_GetFixedWidthString( aString, *
m_pDocument, nTab, nCol,
2242 !bString, eHorJust );
2247 OUString aUniString = aString;
2248 if (!bString && cStrDelim != 0 && !aUniString.isEmpty())
2251 bString = (c == cStrDelim || c ==
' ' ||
2252 aUniString.endsWith(
" ") ||
2253 aUniString.indexOf(cStrDelim) >= 0);
2254 if (!bString &&
cDelim != 0)
2255 bString = (aUniString.indexOf(
cDelim) >= 0);
2259 if ( cStrDelim != 0 )
2261 if ( eCharSet == RTL_TEXTENCODING_UNICODE )
2263 bool bNeedQuotes =
false;
2264 sal_Int32
nPos = getTextSepPos(aUniString, rAsciiOpt, cStrDelim,
cDelim, bNeedQuotes);
2267 OUString strFrom(cStrDelim);
2268 OUString strTo = strFrom + strFrom;
2269 aUniString = aUniString.replaceAll(strFrom, strTo);
2272 if ( bNeedQuotes || bForceQuotes )
2275 if ( bNeedQuotes || bForceQuotes )
2294 if ( bContextOrNotAsciiEncoding )
2299 OUString aStrDec = OStringToOUString(aStrEnc, eCharSet);
2302 bool bNeedQuotes =
false;
2303 sal_Int32
nPos = getTextSepPos(aStrDec, rAsciiOpt, aStrDelimDecoded, aDelimDecoded, bNeedQuotes);
2306 OUString strTo = aStrDelimDecoded + aStrDelimDecoded;
2307 aStrDec = aStrDec.replaceAll(aStrDelimDecoded, strTo);
2311 if ( bNeedQuotes || bForceQuotes )
2314 if ( bNeedQuotes || bForceQuotes )
2322 bool bNeedQuotes =
false;
2323 sal_Int32
nPos = getTextSepPos(aStrEnc, rAsciiOpt, aStrDelimEncoded, aDelimEncoded, bNeedQuotes);
2326 OString strTo = aStrDelimEncoded + aStrDelimEncoded;
2327 aStrEnc = aStrEnc.replaceAll(aStrDelimEncoded, strTo);
2331 if ( bNeedQuotes || bForceQuotes )
2333 aStrDelimEncoded.getStr(), aStrDelimEncoded.getLength());
2334 rStream.
WriteBytes(aStrEnc.getStr(), aStrEnc.getLength());
2335 if ( bNeedQuotes || bForceQuotes )
2337 aStrDelimEncoded.getStr(), aStrDelimEncoded.getLength());
2348 if( nCol < nEndCol )
2361 if ( nNextRow <= nEndRow )
2363 for ( nEmptyCol = nNextCol; nEmptyCol < nEndCol; nEmptyCol++ )
2366 lcl_ScDocShell_WriteEmptyFixedWidthString( rStream,
2374 for ( nEmptyRow = nNextRow; nEmptyRow <= nEndRow; nEmptyRow++ )
2376 for ( nEmptyCol = nStartCol; nEmptyCol < nEndCol; nEmptyCol++ )
2379 lcl_ScDocShell_WriteEmptyFixedWidthString( rStream,
2388 rStream.
SetEndian( nOldNumberFormatInt );
2403 OSL_ENSURE( rMed.
GetFilter(),
"Filter == 0" );
2406 OUString aFltName = rMed.
GetFilter()->GetFilterName();
2411 OSL_FAIL(
"XML filter in ConvertFrom?!");
2412 bRet =
SaveXML( &rMed,
nullptr );
2420 bool bDoSave =
true;
2426 m_pDocument->SetExtDocOptions( std::make_unique<ScExtDocOptions>() );
2429 pViewShell->GetViewData().WriteExtOptions( *pExtDocOpt );
2434 if( (rMed.
GetFilter()->GetFilterFlags() & SfxFilterFlags::ENCRYPTION) == SfxFilterFlags::NONE )
2437 if( rItemSet.
GetItemState( SID_PASSWORD ) == SfxItemState::SET )
2449 bDoSave = !bNeedRetypePassDlg || pViewShell->ExecuteRetypePassDlg(
PASSHASH_XL );
2477 sItStr = pOptionsItem->GetValue();
2480 if ( sItStr.isEmpty() )
2499 bool bVerbose =
false;
2500 const css::uno::Sequence<css::beans::PropertyValue> & rArgs = rMed.
GetArgs();
2501 const auto pProp = std::find_if( rArgs.begin(), rArgs.end(),
2502 [](
const css::beans::PropertyValue& rProp) { return rProp.Name ==
"ConversionRequestOrigin"; });
2503 if (pProp != rArgs.end())
2506 pProp->Value >>= aOrigin;
2507 bVerbose = (aOrigin ==
"CommandLine");
2529 std::cout <<
"Bad sheet number string given." << std::endl;
2532 <<
", number of sheets is " <<
nCount << std::endl;
2549 sTabName = OUString::number(
i);
2551 OUString sFileName = sBaseName +
"-" + sTabName;
2552 if (!sExt.isEmpty())
2553 sFileName = sFileName +
"." + sExt;
2554 aSheetURLObject.
Append(sFileName);
2560 OUString aDisplayedName;
2561 if (osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(aOutFile, aDisplayedName))
2562 aDisplayedName = aOutFile;
2563 std::cout <<
"Writing sheet " <<
OUStringToOString(sTabName, osl_getThreadTextEncoding()) <<
" -> "
2568 std::cout <<
"Overwriting: " <<
OUStringToOString(aDisplayedName, osl_getThreadTextEncoding())
2601 sCharSet = pOptionsItem->GetValue();
2604 if (sCharSet.isEmpty())
2615 bool bHasMemo =
false;
2636 assert(pNameItem &&
"SID_FILE_NAME is required");
2652 if ( bRet && !
MoveFile( aTmpFile, aDbtFile ) )
2673 sItStr = pOptionsItem->GetValue();
2676 if (sItStr.isEmpty())
2704 ScRange aRange( 0,0,0, nEndCol,nEndRow,0 );
2716 OUString sFilterOptions;
2719 sFilterOptions = pOptionsItem->GetValue();
2731 DialogMask::ButtonsOk | DialogMask::MessageInfo));
2748 Broadcast(
SfxHint( SfxHintId::ScDocSaved ) );
2758 sal_Int32 nVbaEventId = VBAEventId::NO_EVENT;
2759 uno::Sequence< uno::Any > aArgs;
2764 nVbaEventId = VBAEventId::WORKBOOK_BEFORESAVE;
2765 aArgs = {
uno::Any(nSlotId == SID_SAVEASDOC) };
2768 case SID_PRINTDOCDIRECT:
2769 nVbaEventId = VBAEventId::WORKBOOK_BEFOREPRINT;
2773 bool bSlotExecutable =
true;
2774 if( nVbaEventId != VBAEventId::NO_EVENT )
try
2776 uno::Reference< XVBAEventProcessor > xEventProcessor(
m_pDocument->GetVbaEventProcessor(), uno::UNO_SET_THROW );
2777 xEventProcessor->processVbaEvent( nVbaEventId, aArgs );
2779 catch( util::VetoException& )
2781 bSlotExecutable =
false;
2783 catch( uno::Exception& )
2786 return bSlotExecutable;
2791 if(
SC_MOD()->GetCurRefDlgId()>0)
2798 if(pViewSh!=
nullptr)
2820 uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents(
m_pDocument->GetVbaEventProcessor(), uno::UNO_SET_THROW );
2821 uno::Sequence< uno::Any > aArgs;
2822 xVbaEvents->processVbaEvent( script::vba::VBAEventId::WORKBOOK_BEFORECLOSE, aArgs );
2824 catch( util::VetoException& )
2829 catch( uno::Exception& )
2895 return std::make_unique<ScDocFuncDirect>( *
this );
2912 m_nCanUpdate (css::document::UpdateDocMode::ACCORDING_TO_CONFIG)
2929 m_pDocument->GetDBCollection()->SetRefreshHandler(
2963 OSL_FAIL(
"The Modificator should not exist");
2978 Broadcast(
SfxHint( SfxHintId::DocChanged ) );
3053 if (bUpdate && pBindings)
3069 if (
m_pDocument->IsChartListenerCollectionNeedsUpdate() )
3074 SC_MOD()->AnythingChanged();
3092 static_cast<sal_uInt16
>(
ScPrintFunc(
this, pPrinter,
i ).GetTotalPages()) );
3097 std::shared_ptr<SfxDocumentInfoDialog> xDlg = std::make_shared<SfxDocumentInfoDialog>(pParent,
rSet);
3101 if( pDocSh ==
this )
3105 OSL_ENSURE(ScDocStatPageCreate,
"Tabpage create fail!");
3106 xDlg->AddFontTabPage();
3107 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)
void update(const bool bOnlyUsedRows=false)
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
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
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
virtual std::shared_ptr< model::ColorSet > GetThemeColors() 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()
ScDrawView * GetScDrawView()
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
std::shared_ptr< model::Theme > const & GetTheme() const
SdrPage * GetPage() const
SdrPageProperties & getSdrPageProperties()
SdrPageView * GetSdrPageView() 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
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[]
static void lcl_parseHtmlFilterOption(const OUString &rOption, LanguageType &rLang, bool &rDateConvert, bool &rScientificConvert)
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)
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