tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / vba / excelvbahelper.cxx
blob0687f9c302cab202457a496714bfa2a623f939c4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "excelvbahelper.hxx"
22 #include <basic/basmgr.hxx>
23 #include <comphelper/propertyvalue.hxx>
24 #include <comphelper/processfactory.hxx>
25 #include <comphelper/servicehelper.hxx>
26 #include <osl/file.hxx>
27 #include <tools/urlobj.hxx>
28 #include <vbahelper/vbahelper.hxx>
29 #include <com/sun/star/beans/PropertyAttribute.hpp>
30 #include <com/sun/star/beans/PropertyExistException.hpp>
31 #include <com/sun/star/frame/XModel.hpp>
32 #include <com/sun/star/sheet/XSheetCellRange.hpp>
33 #include <com/sun/star/sheet/GlobalSheetSettings.hpp>
34 #include <com/sun/star/sheet/XUnnamedDatabaseRanges.hpp>
35 #include <com/sun/star/sheet/XSpreadsheet.hpp>
36 #include <com/sun/star/sheet/XDatabaseRange.hpp>
37 #include <com/sun/star/system/SystemShellExecute.hpp>
38 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
39 #include <com/sun/star/util/XCloneable.hpp>
41 #include <document.hxx>
42 #include <docuno.hxx>
43 #include <tabvwsh.hxx>
44 #include <transobj.hxx>
45 #include <cellsuno.hxx>
46 #include <gridwin.hxx>
48 #include <com/sun/star/script/vba/VBAEventId.hpp>
49 #include <com/sun/star/script/vba/XVBACompatibility.hpp>
50 #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
51 #include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
52 #include <com/sun/star/script/ModuleInfo.hpp>
53 #include <com/sun/star/script/ModuleType.hpp>
55 using namespace ::com::sun::star;
56 using namespace ::ooo::vba;
58 namespace ooo::vba::excel {
60 uno::Reference< sheet::XUnnamedDatabaseRanges >
61 GetUnnamedDataBaseRanges( const ScDocShell* pShell )
63 uno::Reference< frame::XModel > xModel;
64 if ( pShell )
65 xModel.set( pShell->GetModel(), uno::UNO_SET_THROW );
66 uno::Reference< beans::XPropertySet > xModelProps( xModel, uno::UNO_QUERY_THROW );
67 uno::Reference< sheet::XUnnamedDatabaseRanges > xUnnamedDBRanges( xModelProps->getPropertyValue(u"UnnamedDatabaseRanges"_ustr), uno::UNO_QUERY_THROW );
68 return xUnnamedDBRanges;
71 // returns the XDatabaseRange for the autofilter on sheet (nSheet)
72 // also populates sName with the name of range
73 uno::Reference< sheet::XDatabaseRange >
74 GetAutoFiltRange( const ScDocShell* pShell, sal_Int16 nSheet )
76 uno::Reference< sheet::XUnnamedDatabaseRanges > xUnnamedDBRanges( GetUnnamedDataBaseRanges( pShell ), uno::UNO_SET_THROW );
77 uno::Reference< sheet::XDatabaseRange > xDataBaseRange;
78 if (xUnnamedDBRanges->hasByTable( nSheet ) )
80 uno::Reference< sheet::XDatabaseRange > xDBRange( xUnnamedDBRanges->getByTable( nSheet ) , uno::UNO_QUERY_THROW );
81 bool bHasAuto = false;
82 uno::Reference< beans::XPropertySet > xProps( xDBRange, uno::UNO_QUERY_THROW );
83 xProps->getPropertyValue(u"AutoFilter"_ustr) >>= bHasAuto;
84 if ( bHasAuto )
86 xDataBaseRange = std::move(xDBRange);
89 return xDataBaseRange;
92 ScDocShell* GetDocShellFromRange( const uno::Reference< uno::XInterface >& xRange )
94 ScCellRangesBase* pScCellRangesBase = dynamic_cast<ScCellRangesBase*>( xRange.get() );
95 if ( !pScCellRangesBase )
97 throw uno::RuntimeException(u"Failed to access underlying doc shell uno range object"_ustr );
99 return pScCellRangesBase->GetDocShell();
102 uno::Reference< XHelperInterface >
103 getUnoSheetModuleObj( const uno::Reference< table::XCellRange >& xRange )
105 uno::Reference< sheet::XSheetCellRange > xSheetRange( xRange, uno::UNO_QUERY_THROW );
106 uno::Reference< sheet::XSpreadsheet > xSheet( xSheetRange->getSpreadsheet(), uno::UNO_SET_THROW );
107 return getUnoSheetModuleObj( xSheet );
110 void implSetZoom( const uno::Reference< frame::XModel >& xModel, sal_Int16 nZoom, std::vector< SCTAB >& nTabs )
112 ScTabViewShell* pViewSh = excel::getBestViewShell( xModel );
113 Fraction aFract( nZoom, 100 );
114 pViewSh->GetViewData().SetZoom( aFract, aFract, nTabs );
115 pViewSh->RefreshZoom();
118 namespace {
120 class PasteCellsWarningReseter
122 private:
123 bool bInitialWarningState;
124 /// @throws uno::RuntimeException
125 static uno::Reference< sheet::XGlobalSheetSettings > const & getGlobalSheetSettings()
127 static uno::Reference< sheet::XGlobalSheetSettings > xProps = sheet::GlobalSheetSettings::create( comphelper::getProcessComponentContext() );
128 return xProps;
131 /// @throws uno::RuntimeException
132 static bool getReplaceCellsWarning()
134 return getGlobalSheetSettings()->getReplaceCellsWarning();
137 /// @throws uno::RuntimeException
138 static void setReplaceCellsWarning( bool bState )
140 getGlobalSheetSettings()->setReplaceCellsWarning( bState );
142 public:
143 /// @throws uno::RuntimeException
144 PasteCellsWarningReseter()
146 bInitialWarningState = getReplaceCellsWarning();
147 if ( bInitialWarningState )
148 setReplaceCellsWarning( false );
150 ~PasteCellsWarningReseter()
152 if ( bInitialWarningState )
154 // don't allow dtor to throw
157 setReplaceCellsWarning( true );
159 catch ( uno::Exception& /*e*/ ){}
166 void
167 implnPaste( const uno::Reference< frame::XModel>& xModel )
169 PasteCellsWarningReseter resetWarningBox;
170 ScTabViewShell* pViewShell = getBestViewShell( xModel );
171 if ( pViewShell )
173 pViewShell->PasteFromSystem();
174 pViewShell->CellContentChanged();
178 void
179 implnCopy( const uno::Reference< frame::XModel>& xModel )
181 ScTabViewShell* pViewShell = getBestViewShell( xModel );
182 ScDocShell* pDocShell = getDocShell( xModel );
183 if ( !(pViewShell && pDocShell) )
184 return;
186 pViewShell->CopyToClip(nullptr,false,false,true);
188 // mark the copied transfer object so it is used in ScVbaRange::Insert
189 uno::Reference<datatransfer::XTransferable2> xTransferable(ScTabViewShell::GetClipData(pViewShell->GetViewData().GetActiveWin()));
190 ScTransferObj* pClipObj = ScTransferObj::GetOwnClipboard(xTransferable);
191 if (pClipObj)
193 pClipObj->SetUseInApi( true );
194 pDocShell->SetClipData(xTransferable);
198 void
199 implnCut( const uno::Reference< frame::XModel>& xModel )
201 ScTabViewShell* pViewShell = getBestViewShell( xModel );
202 ScDocShell* pDocShell = getDocShell( xModel );
203 if ( !(pViewShell && pDocShell) )
204 return;
206 pViewShell->CutToClip();
208 // mark the copied transfer object so it is used in ScVbaRange::Insert
209 uno::Reference<datatransfer::XTransferable2> xTransferable(ScTabViewShell::GetClipData(pViewShell->GetViewData().GetActiveWin()));
210 ScTransferObj* pClipObj = ScTransferObj::GetOwnClipboard(xTransferable);
211 if (pClipObj)
213 pClipObj->SetUseInApi( true );
214 pDocShell->SetClipData(xTransferable);
218 void implnPasteSpecial( const uno::Reference< frame::XModel>& xModel, InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bTranspose)
220 PasteCellsWarningReseter resetWarningBox;
222 ScTabViewShell* pTabViewShell = getBestViewShell(xModel);
223 if (!pTabViewShell)
224 return;
226 ScDocShell* pDocShell = getDocShell(xModel);
227 if (!pDocShell)
228 return;
230 ScViewData& rView = pTabViewShell->GetViewData();
231 vcl::Window* pWin = rView.GetActiveWin();
232 if (!pWin)
233 return;
235 const ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(pWin));
236 if (pOwnClip)
238 pTabViewShell->PasteFromClip(nFlags, pOwnClip->GetDocument(),
239 nFunction, bSkipEmpty, bTranspose, false,
240 INS_NONE, InsertDeleteFlags::NONE, true);
242 pTabViewShell->CellContentChanged();
246 ScDocShell*
247 getDocShell( const css::uno::Reference< css::frame::XModel>& xModel )
249 uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW );
250 ScModelObj* pModel = comphelper::getFromUnoTunnel< ScModelObj >( xIf );
251 ScDocShell* pDocShell = nullptr;
252 if ( pModel )
253 pDocShell = static_cast<ScDocShell*>(pModel->GetEmbeddedObject());
254 return pDocShell;
258 ScTabViewShell*
259 getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel )
261 ScDocShell* pDocShell = getDocShell( xModel );
262 if ( pDocShell )
263 return pDocShell->GetBestViewShell();
264 return nullptr;
267 ScTabViewShell*
268 getCurrentBestViewShell( const uno::Reference< uno::XComponentContext >& xContext )
270 uno::Reference< frame::XModel > xModel = getCurrentExcelDoc( xContext );
271 return getBestViewShell( xModel );
274 SfxViewFrame*
275 getViewFrame( const uno::Reference< frame::XModel >& xModel )
277 ScTabViewShell* pViewShell = getBestViewShell( xModel );
278 if ( pViewShell )
279 return &pViewShell->GetViewFrame();
280 return nullptr;
283 uno::Reference< XHelperInterface >
284 getUnoSheetModuleObj( const uno::Reference< sheet::XSpreadsheet >& xSheet )
286 uno::Reference< beans::XPropertySet > xProps( xSheet, uno::UNO_QUERY_THROW );
287 OUString sCodeName;
288 xProps->getPropertyValue(u"CodeName"_ustr) >>= sCodeName;
289 // #TODO #FIXME ideally we should 'throw' here if we don't get a valid parent, but... it is possible
290 // to create a module ( and use 'Option VBASupport 1' ) for a calc document, in this scenario there
291 // are *NO* special document module objects ( of course being able to switch between vba/non vba mode at
292 // the document in the future could fix this, especially IF the switching of the vba mode takes care to
293 // create the special document module objects if they don't exist.
294 return getUnoDocModule( sCodeName, GetDocShellFromRange( xSheet ) );
297 uno::Reference< XHelperInterface >
298 getUnoSheetModuleObj( const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges )
300 uno::Reference< container::XEnumerationAccess > xEnumAccess( xRanges, uno::UNO_QUERY_THROW );
301 uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration();
302 uno::Reference< table::XCellRange > xRange( xEnum->nextElement(), uno::UNO_QUERY_THROW );
303 return getUnoSheetModuleObj( xRange );
306 uno::Reference< XHelperInterface >
307 getUnoSheetModuleObj( const uno::Reference< table::XCell >& xCell )
309 uno::Reference< sheet::XSheetCellRange > xSheetRange( xCell, uno::UNO_QUERY_THROW );
310 uno::Reference< sheet::XSpreadsheet > xSheet( xSheetRange->getSpreadsheet(), uno::UNO_SET_THROW );
311 return getUnoSheetModuleObj( xSheet );
314 uno::Reference< XHelperInterface >
315 getUnoSheetModuleObj( const uno::Reference< frame::XModel >& xModel, SCTAB nTab )
317 uno::Reference< sheet::XSpreadsheetDocument > xDoc( xModel, uno::UNO_QUERY_THROW );
318 uno::Reference< container::XIndexAccess > xSheets( xDoc->getSheets(), uno::UNO_QUERY_THROW );
319 uno::Reference< sheet::XSpreadsheet > xSheet( xSheets->getByIndex( nTab ), uno::UNO_QUERY_THROW );
320 return getUnoSheetModuleObj( xSheet );
323 void setUpDocumentModules( const uno::Reference< sheet::XSpreadsheetDocument >& xDoc )
325 uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY );
326 ScDocShell* pShell = excel::getDocShell( xModel );
327 if ( !pShell )
328 return;
330 OUString aPrjName( u"Standard"_ustr );
331 pShell->GetBasicManager()->SetName( aPrjName );
333 /* Set library container to VBA compatibility mode. This will create
334 the VBA Globals object and store it in the Basic manager of the
335 document. */
336 uno::Reference<script::XLibraryContainer> xLibContainer = pShell->GetBasicContainer();
337 uno::Reference<script::vba::XVBACompatibility> xVBACompat( xLibContainer, uno::UNO_QUERY_THROW );
338 xVBACompat->setVBACompatibilityMode( true );
340 if( xLibContainer.is() )
342 if( !xLibContainer->hasByName( aPrjName ) )
343 xLibContainer->createLibrary( aPrjName );
344 uno::Any aLibAny = xLibContainer->getByName( aPrjName );
345 uno::Reference< container::XNameContainer > xLib;
346 aLibAny >>= xLib;
347 if( xLib.is() )
349 uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY_THROW );
350 uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess( pShell->GetModel()->createInstance(u"ooo.vba.VBAObjectModuleObjectProvider"_ustr), uno::UNO_QUERY_THROW );
351 // set up the module info for the workbook and sheets in the newly created
352 // spreadsheet
353 ScDocument& rDoc = pShell->GetDocument();
354 OUString sCodeName = rDoc.GetCodeName();
355 if ( sCodeName.isEmpty() )
357 sCodeName = "ThisWorkbook";
358 rDoc.SetCodeName( sCodeName );
361 std::vector< OUString > sDocModuleNames { sCodeName };
363 for ( SCTAB index = 0; index < rDoc.GetTableCount(); index++)
365 OUString aName;
366 rDoc.GetCodeName( index, aName );
367 sDocModuleNames.push_back( aName );
370 for ( const auto& rName : sDocModuleNames )
372 script::ModuleInfo sModuleInfo;
374 uno::Any aName= xVBACodeNamedObjectAccess->getByName( rName );
375 sModuleInfo.ModuleObject.set( aName, uno::UNO_QUERY );
376 sModuleInfo.ModuleType = script::ModuleType::DOCUMENT;
377 xVBAModuleInfo->insertModuleInfo( rName, sModuleInfo );
378 if( xLib->hasByName( rName ) )
379 xLib->replaceByName( rName, uno::Any( u"Option VBASupport 1\n"_ustr ) );
380 else
381 xLib->insertByName( rName, uno::Any( u"Option VBASupport 1\n"_ustr ) );
386 /* Trigger the Workbook_Open event, event processor will register
387 itself as listener for specific events. */
390 uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pShell->GetDocument().GetVbaEventProcessor(), uno::UNO_SET_THROW );
391 uno::Sequence< uno::Any > aArgs;
392 xVbaEvents->processVbaEvent( script::vba::VBAEventId::WORKBOOK_OPEN, aArgs );
394 catch( uno::Exception& )
399 void ExportAsFixedFormatHelper(
400 const uno::Reference< frame::XModel >& xModel, const css::uno::Reference< XApplication >& xApplication,
401 const css::uno::Any& Type, const css::uno::Any& FileName, const css::uno::Any& Quality,
402 const css::uno::Any& IncludeDocProperties, const css::uno::Any& From,
403 const css::uno::Any& To, const css::uno::Any& OpenAfterPublish)
405 OUString sType;
406 if ((Type >>= sType) && (sType.equalsIgnoreAsciiCase(u"xlTypeXPS") || sType == "1"))
408 /* xlTypePDF 0 "PDF" - Portable Document Format file(.pdf)
409 xlTypeXPS 1 "XPS" - XPS Document(.xps) --> not supported in LibreOffice */
410 return;
413 OUString sFileName;
414 FileName >>= sFileName;
415 OUString sRelURL;;
416 osl::FileBase::getFileURLFromSystemPath(sFileName, sRelURL);
417 // detect if there is no path then we need
418 // to use the current folder
419 INetURLObject aURL(sRelURL);
420 OUString sURL;
421 sURL = aURL.GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
422 if (sURL.isEmpty())
424 // need to add cur dir ( of this workbook ) or else the 'Work' dir
425 sURL = xModel->getURL();
427 if (sURL.isEmpty())
429 // not path available from 'this' document
430 // need to add the 'document'/work directory then
431 OUString sWorkPath = xApplication->getDefaultFilePath();
432 OUString sWorkURL;
433 osl::FileBase::getFileURLFromSystemPath(sWorkPath, sWorkURL);
434 aURL.SetURL(sWorkURL);
436 else
438 if (!sFileName.isEmpty())
440 aURL.SetURL(INetURLObject::GetAbsURL(sURL, sRelURL));
442 else
444 aURL.SetURL(sURL);
445 if (aURL.removeExtension())
446 aURL.setExtension(u"pdf");
449 sURL = aURL.GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
453 sal_Int32 nTo = 0;
454 sal_Int32 nFrom = 0;
455 From >>= nFrom;
456 To >>= nTo;
458 OUString sRange(u"-"_ustr);
460 css::uno::Sequence<css::beans::PropertyValue> aFilterData;
461 if (nFrom || nTo)
463 if (nFrom)
464 sRange = OUString::number(nFrom) + sRange;
465 if (nTo)
466 sRange += OUString::number(nTo);
468 aFilterData.realloc(aFilterData.getLength() + 1);
469 aFilterData.getArray()[aFilterData.getLength() - 1] = comphelper::makePropertyValue(u"PageRange"_ustr, sRange);
472 OUString sQuality;
473 if (Quality >>= sQuality)
475 if (sQuality.equalsIgnoreAsciiCase(u"xlQualityMinimum") || sQuality == "1")
477 aFilterData.realloc(aFilterData.getLength() + 1);
478 aFilterData.getArray()[aFilterData.getLength() - 1] = comphelper::makePropertyValue(u"Quality"_ustr, sal_Int32(70));
480 else if (sQuality.equalsIgnoreAsciiCase(u"xlQualityStandard") || sQuality == "0")
482 aFilterData.realloc(aFilterData.getLength() + 1);
483 aFilterData.getArray()[aFilterData.getLength() - 1] = comphelper::makePropertyValue(u"UseLosslessCompression"_ustr, true);
485 else
487 /* Name Value Description
488 xlQualityMinimum 1 Minimum quality
489 xlQualityStandard 0 Standard quality */
493 // init set of params for storeToURL() call
494 css::uno::Sequence<css::beans::PropertyValue> storeProps{
495 comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData),
496 comphelper::makePropertyValue(u"FilterName"_ustr, u"calc_pdf_Export"_ustr),
497 comphelper::makePropertyValue(u"URL"_ustr, sURL)
500 bool bIncludeDocProperties = true;
501 if ((IncludeDocProperties >>= bIncludeDocProperties) && !bIncludeDocProperties)
503 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(xModel, uno::UNO_QUERY);
504 if (xDPS.is())
506 uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
507 uno::Reference<util::XCloneable> xCloneable(xDocProps, uno::UNO_QUERY_THROW);
508 uno::Reference<document::XDocumentProperties> xOldDocProps(xCloneable->createClone(), uno::UNO_QUERY_THROW);
510 // reset doc properties to default temporary
511 xDocProps->resetUserData(OUString());
513 uno::Reference< frame::XStorable > xStor(xModel, uno::UNO_QUERY_THROW);
514 try {
515 xStor->storeToURL(sURL, storeProps);
517 catch (const uno::Exception&)
519 SetDocInfoState(xModel, xOldDocProps);
520 throw;
523 SetDocInfoState(xModel, xOldDocProps);
526 else
528 uno::Reference< frame::XStorable > xStor(xModel, uno::UNO_QUERY_THROW);
529 xStor->storeToURL(sURL, storeProps);
532 bool bOpenAfterPublish = false;
533 if ((OpenAfterPublish >>= bOpenAfterPublish) && bOpenAfterPublish)
535 uno::Reference<css::system::XSystemShellExecute> xSystemShellExecute(css::system::SystemShellExecute::create(::comphelper::getProcessComponentContext()));
536 xSystemShellExecute->execute(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), u""_ustr, css::system::SystemShellExecuteFlags::URIS_ONLY);
540 void SetDocInfoState(
541 const uno::Reference< frame::XModel >& xModel,
542 const uno::Reference< css::document::XDocumentProperties>& i_xOldDocProps)
544 uno::Reference<document::XDocumentPropertiesSupplier> const
545 xModelDocPropsSupplier(xModel, uno::UNO_QUERY_THROW);
546 uno::Reference<document::XDocumentProperties> const xDocPropsToFill =
547 xModelDocPropsSupplier->getDocumentProperties();
548 uno::Reference< beans::XPropertySet > const xPropSet(
549 i_xOldDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
551 uno::Reference< util::XModifiable > xModifiable(xModel, uno::UNO_QUERY);
552 if (!xModifiable.is())
553 throw uno::RuntimeException();
555 bool bIsModified = xModifiable->isModified();
559 uno::Reference< beans::XPropertySet > const xSet(
560 xDocPropsToFill->getUserDefinedProperties(), uno::UNO_QUERY);
561 uno::Reference< beans::XPropertyContainer > xContainer(xSet, uno::UNO_QUERY);
562 uno::Reference< beans::XPropertySetInfo > xSetInfo = xSet->getPropertySetInfo();
563 const uno::Sequence< beans::Property > lProps = xSetInfo->getProperties();
564 for (const beans::Property& rProp : lProps)
566 uno::Any aValue = xPropSet->getPropertyValue(rProp.Name);
567 if (rProp.Attributes & css::beans::PropertyAttribute::REMOVABLE)
571 // QUESTION: DefaultValue?!
572 xContainer->addProperty(rProp.Name, rProp.Attributes, aValue);
574 catch (beans::PropertyExistException const&) {}
577 // it is possible that the propertysets from XML and binary files differ; we shouldn't break then
578 xSet->setPropertyValue(rProp.Name, aValue);
580 catch (const uno::Exception&) {}
584 // sigh... have to set these manually I'm afraid...
585 xDocPropsToFill->setAuthor(i_xOldDocProps->getAuthor());
586 xDocPropsToFill->setGenerator(i_xOldDocProps->getGenerator());
587 xDocPropsToFill->setCreationDate(i_xOldDocProps->getCreationDate());
588 xDocPropsToFill->setTitle(i_xOldDocProps->getTitle());
589 xDocPropsToFill->setSubject(i_xOldDocProps->getSubject());
590 xDocPropsToFill->setDescription(i_xOldDocProps->getDescription());
591 xDocPropsToFill->setKeywords(i_xOldDocProps->getKeywords());
592 xDocPropsToFill->setModifiedBy(i_xOldDocProps->getModifiedBy());
593 xDocPropsToFill->setModificationDate(i_xOldDocProps->getModificationDate());
594 xDocPropsToFill->setPrintedBy(i_xOldDocProps->getPrintedBy());
595 xDocPropsToFill->setPrintDate(i_xOldDocProps->getPrintDate());
596 xDocPropsToFill->setAutoloadURL(i_xOldDocProps->getAutoloadURL());
597 xDocPropsToFill->setAutoloadSecs(i_xOldDocProps->getAutoloadSecs());
598 xDocPropsToFill->setDefaultTarget(i_xOldDocProps->getDefaultTarget());
599 xDocPropsToFill->setEditingCycles(i_xOldDocProps->getEditingCycles());
600 xDocPropsToFill->setEditingDuration(i_xOldDocProps->getEditingDuration());
602 catch (const uno::Exception&) {}
604 // set the modified flag back if required
605 if (bIsModified != bool(xModifiable->isModified()))
606 xModifiable->setModified(bIsModified);
609 SfxItemSet*
610 ScVbaCellRangeAccess::GetDataSet( ScCellRangesBase* pRangeObj )
612 return pRangeObj ? pRangeObj->GetCurrentDataSet( true ) : nullptr;
615 } // namespace ooo::vba::excel
617 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */