diff --git a/Repository.mk b/Repository.mk index e8c0f18f30d8..6b8f2a982c12 100644 --- a/Repository.mk +++ b/Repository.mk @@ -809,7 +809,6 @@ $(eval $(call gb_Helper_register_jars_for_install,URE,ure, \ $(eval $(call gb_Helper_register_jars_for_install,OOO,ooo, \ ScriptFramework \ ScriptProviderForJava \ - XMergeBridge \ commonwizards \ form \ $(if $(filter-out MACOSX,$(OS)),officebean) \ @@ -819,7 +818,6 @@ $(eval $(call gb_Helper_register_jars_for_install,OOO,ooo, \ smoketest \ table \ unoil \ - xmerge \ )) $(eval $(call gb_Helper_register_jars_for_install,OOO,reportbuilder, \ diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk index 429df464023f..b37ebd4fd02e 100644 --- a/RepositoryModule_host.mk +++ b/RepositoryModule_host.mk @@ -188,7 +188,6 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\ vcl \ wizards \ writerperfect \ - xmerge \ $(call gb_Helper_optional,XMLHELP,xmlhelp) \ xmloff \ xmlreader \ diff --git a/accessibility/source/extended/AccessibleBrowseBox.cxx b/accessibility/source/extended/AccessibleBrowseBox.cxx index debdf15e2443..b78c6cb65048 100644 --- a/accessibility/source/extended/AccessibleBrowseBox.cxx +++ b/accessibility/source/extended/AccessibleBrowseBox.cxx @@ -134,27 +134,24 @@ AccessibleBrowseBox::getAccessibleAtPoint( const awt::Point& rPoint ) SolarMethodGuard aGuard(getMutex()); ensureIsAlive(); - css::uno::Reference< css::accessibility::XAccessible > xChild; sal_Int32 nIndex = 0; if (mpBrowseBox->ConvertPointToControlIndex(nIndex, VCLUnoHelper::ConvertToVCLPoint(rPoint))) - xChild = mpBrowseBox->CreateAccessibleControl( nIndex ); - else - { - // try whether point is in one of the fixed children - // (table, header bars, corner control) - Point aPoint(VCLUnoHelper::ConvertToVCLPoint(rPoint)); - for( nIndex = 0; (nIndex < vcl::BBINDEX_FIRSTCONTROL) && !xChild.is(); ++nIndex ) - { - css::uno::Reference< css::accessibility::XAccessible > xCurrChild( implGetFixedChild( nIndex ) ); - css::uno::Reference< css::accessibility::XAccessibleComponent > - xCurrChildComp( xCurrChild, uno::UNO_QUERY ); + return mpBrowseBox->CreateAccessibleControl(nIndex); - if (xCurrChildComp.is() - && VCLUnoHelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint)) - xChild = xCurrChild; - } + // try whether point is in one of the fixed children + // (table, header bars, corner control) + Point aPoint(VCLUnoHelper::ConvertToVCLPoint(rPoint)); + for (nIndex = 0; nIndex < vcl::BBINDEX_FIRSTCONTROL; ++nIndex) + { + css::uno::Reference< css::accessibility::XAccessible > xCurrChild(implGetFixedChild(nIndex)); + css::uno::Reference< css::accessibility::XAccessibleComponent > + xCurrChildComp( xCurrChild, uno::UNO_QUERY ); + + if (xCurrChildComp.is() + && VCLUnoHelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint)) + return xCurrChild; } - return xChild; + return nullptr; } diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx index 46d04780285b..6dcd09748d79 100644 --- a/accessibility/source/extended/AccessibleGridControl.cxx +++ b/accessibility/source/extended/AccessibleGridControl.cxx @@ -146,16 +146,15 @@ AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint ) SolarMutexGuard aSolarGuard; ensureIsAlive(); - css::uno::Reference< css::accessibility::XAccessible > xChild; sal_Int32 nIndex = 0; if (m_aTable.ConvertPointToControlIndex(nIndex, VCLUnoHelper::ConvertToVCLPoint(rPoint))) - xChild = m_aTable.CreateAccessibleControl( nIndex ); + return m_aTable.CreateAccessibleControl(nIndex); else { // try whether point is in one of the fixed children // (table, header bars, corner control) Point aPoint(VCLUnoHelper::ConvertToVCLPoint(rPoint)); - for( nIndex = 0; (nIndex < 3) && !xChild.is(); ++nIndex ) + for (nIndex = 0; nIndex < 3; ++nIndex) { css::uno::Reference< css::accessibility::XAccessible > xCurrChild( implGetFixedChild( nIndex ) ); css::uno::Reference< css::accessibility::XAccessibleComponent > @@ -163,10 +162,10 @@ AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint ) if (xCurrChildComp.is() && VCLUnoHelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint)) - xChild = xCurrChild; + return xCurrChild; } } - return xChild; + return nullptr; } diff --git a/accessibility/source/extended/accessibletabbar.cxx b/accessibility/source/extended/accessibletabbar.cxx index 9942ab4f21fa..2b1522f30a28 100644 --- a/accessibility/source/extended/accessibletabbar.cxx +++ b/accessibility/source/extended/accessibletabbar.cxx @@ -349,15 +349,11 @@ namespace accessibility return Application::GetSettings().GetLanguageTag().getLocale(); } - // XAccessibleComponent - - Reference< XAccessible > AccessibleTabBar::getAccessibleAtPoint( const awt::Point& rPoint ) { OExternalLockGuard aGuard( this ); - Reference< XAccessible > xChild; for( sal_Int64 i = 0; i < getAccessibleChildCount(); ++i ) { Reference< XAccessible > xAcc = getAccessibleChild( i ); @@ -370,17 +366,15 @@ namespace accessibility Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { - xChild = xAcc; - break; + return xAcc; } } } } - return xChild; + return nullptr; } - void AccessibleTabBar::grabFocus( ) { OExternalLockGuard aGuard( this ); diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 9021f85af610..a5c35ad4b056 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -1004,15 +1004,15 @@ Document::retrieveCharacterAttributes( // sort the attributes auto nLength = static_cast(aRes.getLength()); - std::unique_ptr pIndices( new sal_Int32[nLength] ); - std::iota(&pIndices[0], &pIndices[nLength], 0); - std::sort(&pIndices[0], &pIndices[nLength], + std::vector pIndices(nLength); + std::iota(pIndices.begin(), pIndices.end(), 0); + std::sort(pIndices.begin(), pIndices.end(), [&aRes](sal_Int32 a, sal_Int32 b) { return aRes[a].Name < aRes[b].Name; }); // create sorted sequences according to index array std::vector aNewValues; aNewValues.reserve(nLength); - std::transform(&pIndices[0], &pIndices[nLength], std::back_inserter(aNewValues), + std::transform(pIndices.begin(), pIndices.end(), std::back_inserter(aNewValues), [&aRes](const sal_Int32 nIdx) -> const css::beans::PropertyValue& { return aRes[nIdx]; }); return comphelper::containerToSequence(aNewValues); diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index f6d861f4c5ee..d95d47b214d9 100644 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -303,8 +303,6 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLX Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXWindow* _pXWindow ) { - Reference< XAccessibleContext > xContext; - VclPtr pWindow = _pXWindow->GetWindow(); if ( pWindow ) { @@ -315,50 +313,50 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLX Reference< XAccessible > xAcc( pWindow->GetAccessible() ); if ( xAcc.is() ) { - Reference< XAccessibleContext > xCont( xAcc->getAccessibleContext() ); + Reference xContext(xAcc->getAccessibleContext()); if ( pWindow->GetType() == WindowType::MENUBARWINDOW || - ( xCont.is() && xCont->getAccessibleRole() == AccessibleRole::POPUP_MENU ) ) + ( xContext.is() && xContext->getAccessibleRole() == AccessibleRole::POPUP_MENU ) ) { - xContext = xCont; + return xContext; } } } else if ( nType == WindowType::STATUSBAR ) { - xContext = new VCLXAccessibleStatusBar(_pXWindow); + return new VCLXAccessibleStatusBar(_pXWindow); } else if ( nType == WindowType::TABCONTROL ) { - xContext = new VCLXAccessibleTabControl(_pXWindow); + return new VCLXAccessibleTabControl(_pXWindow); } else if ( nType == WindowType::TABPAGE && pWindow->GetAccessibleParentWindow() && pWindow->GetAccessibleParentWindow()->GetType() == WindowType::TABCONTROL ) { - xContext = new VCLXAccessibleTabPageWindow( _pXWindow ); + return new VCLXAccessibleTabPageWindow(_pXWindow); } else if ( nType == WindowType::FLOATINGWINDOW ) { - xContext = new FloatingWindowAccessible( _pXWindow ); + return new FloatingWindowAccessible(_pXWindow); } else if ( nType == WindowType::BORDERWINDOW && hasFloatingChild( pWindow ) ) { - xContext = new FloatingWindowAccessible( _pXWindow ); + return new FloatingWindowAccessible(_pXWindow); } else if ( ( nType == WindowType::HELPTEXTWINDOW ) || ( nType == WindowType::FIXEDLINE ) ) { - xContext = new VCLXAccessibleFixedText(_pXWindow); + return new VCLXAccessibleFixedText(_pXWindow); } else { - xContext = new VCLXAccessibleComponent(_pXWindow); + return new VCLXAccessibleComponent(_pXWindow); } } - return xContext; + return nullptr; } Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXToolBox* _pXWindow ) diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/accessibility/source/standard/accessiblemenubasecomponent.cxx index 66d90a0d7087..5c9e1e47b637 100644 --- a/accessibility/source/standard/accessiblemenubasecomponent.cxx +++ b/accessibility/source/standard/accessiblemenubasecomponent.cxx @@ -334,7 +334,6 @@ Reference< XAccessible > OAccessibleMenuBaseComponent::GetChild( sal_Int64 i ) Reference< XAccessible > OAccessibleMenuBaseComponent::GetChildAt( const awt::Point& rPoint ) { - Reference< XAccessible > xChild; for ( sal_Int64 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) { Reference< XAccessible > xAcc = getAccessibleChild( i ); @@ -347,14 +346,13 @@ Reference< XAccessible > OAccessibleMenuBaseComponent::GetChildAt( const awt::Po Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { - xChild = xAcc; - break; + return xAcc; } } } } - return xChild; + return nullptr; } diff --git a/accessibility/source/standard/vclxaccessibletabpage.cxx b/accessibility/source/standard/vclxaccessibletabpage.cxx index d2e32f1dfa46..1cf1330cfbe9 100644 --- a/accessibility/source/standard/vclxaccessibletabpage.cxx +++ b/accessibility/source/standard/vclxaccessibletabpage.cxx @@ -399,7 +399,6 @@ Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleAtPoint( const awt: { OExternalLockGuard aGuard( this ); - Reference< XAccessible > xChild; for ( sal_Int64 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) { Reference< XAccessible > xAcc = getAccessibleChild( i ); @@ -412,14 +411,13 @@ Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleAtPoint( const awt: Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { - xChild = xAcc; - break; + return xAcc; } } } } - return xChild; + return nullptr; } diff --git a/avmedia/source/qt6/QtPlayer.cxx b/avmedia/source/qt6/QtPlayer.cxx index 5cd19a3c2df5..23460c92d675 100644 --- a/avmedia/source/qt6/QtPlayer.cxx +++ b/avmedia/source/qt6/QtPlayer.cxx @@ -21,8 +21,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -36,14 +36,6 @@ using namespace ::com::sun::star; -namespace -{ -inline QString toQString(const OUString& rStr) -{ - return QString::fromUtf16(rStr.getStr(), rStr.getLength()); -} -} - namespace avmedia::qt { QtPlayer::QtPlayer() @@ -351,14 +343,7 @@ void QtPlayer::createMediaPlayerWidget() } else { - BitmapEx aPlaceholderIcon(u"avmedia/res/avaudiologo.png"_ustr); - SvMemoryStream aMemoryStream; - vcl::PngImageWriter aWriter(aMemoryStream); - aWriter.write(aPlaceholderIcon); - QPixmap aAudioPixmap; - aAudioPixmap.loadFromData(static_cast(aMemoryStream.GetData()), - aMemoryStream.TellEnd()); - assert(!aAudioPixmap.isNull() && "Failed to load audio logo"); + QPixmap aAudioPixmap = loadQPixmapIcon(u"avmedia/res/avaudiologo.png"_ustr); aAudioPixmap = aAudioPixmap.scaled(QSize(m_aPlayerWidgetRect.Width, m_aPlayerWidgetRect.Height)); diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index b7740a6484b5..39b19e8a4462 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -671,10 +671,7 @@ Locale AccessibleDialogWindow::getLocale( ) return Application::GetSettings().GetLanguageTag().getLocale(); } - // XAccessibleComponent - - Reference< XAccessible > AccessibleDialogWindow::getAccessibleAtPoint( const awt::Point& rPoint ) { OExternalLockGuard aGuard( this ); @@ -692,7 +689,7 @@ Reference< XAccessible > AccessibleDialogWindow::getAccessibleAtPoint( const awt Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { - xChild = xAcc; + xChild = std::move(xAcc); break; } } @@ -702,7 +699,6 @@ Reference< XAccessible > AccessibleDialogWindow::getAccessibleAtPoint( const awt return xChild; } - void AccessibleDialogWindow::grabFocus( ) { OExternalLockGuard aGuard( this ); @@ -711,7 +707,6 @@ void AccessibleDialogWindow::grabFocus( ) m_pDialogWindow->GrabFocus(); } - sal_Int32 AccessibleDialogWindow::getForeground( ) { OExternalLockGuard aGuard( this ); diff --git a/basctl/source/basicide/documentenumeration.cxx b/basctl/source/basicide/documentenumeration.cxx index d71e02139e02..60ace06d2bac 100644 --- a/basctl/source/basicide/documentenumeration.cxx +++ b/basctl/source/basicide/documentenumeration.cxx @@ -117,7 +117,7 @@ namespace basctl::docs { // create a DocumentDescriptor DocumentDescriptor aDescriptor; - aDescriptor.xModel = xModel; + aDescriptor.xModel = std::move(xModel); lcl_getDocumentControllers_nothrow( aDescriptor ); // consult filter, if there is one diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx index 12a0e671863a..0a23093ecf71 100644 --- a/basctl/source/dlged/propbrw.cxx +++ b/basctl/source/dlged/propbrw.cxx @@ -443,7 +443,7 @@ void PropBrw::ImplUpdate( const Reference< XModel >& _rxContextDocument, SdrView if ( xContextDocument != m_xContextDocument ) { - m_xContextDocument = xContextDocument; + m_xContextDocument = std::move(xContextDocument); ImplReCreateController(); } diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index f97f1a77afef..b7ffebb0e983 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -499,7 +499,7 @@ void RTL_Impl_CreateUnoDialog( SbxArray& rPar ) if ( aDlgLib.is() ) { bDocDialog = true; - xModel = xNextModel; + xModel = std::move(xNextModel); break; } } diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 57d262960f31..77e3541cf157 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -3738,7 +3738,7 @@ void SbUnoSingleton::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) Reference < XComponentContext > xFirstParamContext; Any aArg1 = sbxToUnoValue(pParams->Get(1)); if( (aArg1 >>= xFirstParamContext) && xFirstParamContext.is() ) - xContextToUse = xFirstParamContext; + xContextToUse = std::move(xFirstParamContext); } if( !xContextToUse.is() ) diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 55d59da942ec..b62378fb2474 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -1205,7 +1205,7 @@ void SbiRuntime::PushForEach() else if (aAny >>= xIndexAccess) { p->eForType = ForType::EachXIndexAccess; - p->xIndexAccess = xIndexAccess; + p->xIndexAccess = std::move(xIndexAccess); p->nCurCollectionIndex = 0; } else if ( isVBAEnabled() && pUnoObj->isNativeCOMObject() ) diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index e302c1dd392f..48cdfd36d628 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -324,7 +324,7 @@ Any SfxDialogLibraryContainer::importLibraryElement return aRetAny; InputSource source; - source.aInputStream = xInput; + source.aInputStream = std::move(xInput); source.sSystemId = aFile; try { diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index a554edb9d8c6..e90be0c4849a 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -1697,7 +1697,7 @@ bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib, } InputSource source; - source.aInputStream = xInput; + source.aInputStream = std::move(xInput); source.sSystemId = aLibInfoPath; // start parsing diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index 07ddb654f815..4f90fecd3e13 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -228,7 +228,7 @@ Any SfxScriptLibraryContainer::importLibraryElement return aRetAny; InputSource source; - source.aInputStream = xInput; + source.aInputStream = std::move(xInput); source.sSystemId = aFile; // start parsing diff --git a/bin/diff-pdf-page.py b/bin/diff-pdf-page.py index 153654d5d386..fced5c84da77 100755 --- a/bin/diff-pdf-page.py +++ b/bin/diff-pdf-page.py @@ -8,6 +8,8 @@ # red is meant to reduce as fixing progresses. Sample usage: # # bin/diff-pdf-page.py reference.pdf test.pdf diff.png +# +# using the ImageMagick tooling import argparse import tempfile @@ -26,15 +28,15 @@ def main(): parser.add_argument("diff_png") args = parser.parse_args() + CONVERT_CMD="convert" # use "magick" if Windows has installed ImageMagick and GhostScript + a_png = tempfile.NamedTemporaryFile(suffix=".png") a_pdf = args.a_pdf + "[" + args.page + "]" - run(["convert", "-density", args.density, a_pdf, "-colorspace", "RGB", "-fuzz", "95%", "-fill", "red", "-opaque", "black", a_png.name]) + run([CONVERT_CMD, "-density", args.density, a_pdf, "-colorspace", "RGB", "-transparent", "white", "-fuzz", "95%", "-fill", "red", "-opaque", "black", a_png.name]) b_png = tempfile.NamedTemporaryFile(suffix=".png") b_pdf = args.b_pdf + "[" + args.page + "]" - run(["convert", "-density", args.density, b_pdf, "-colorspace", "RGB", b_png.name]) - composite_png = tempfile.NamedTemporaryFile(suffix=".png") - run(["convert", "-composite", a_png.name, b_png.name, composite_png.name]) - run(["convert", composite_png.name, "-background", "white", "-flatten", args.diff_png]) + run([CONVERT_CMD, "-density", args.density, b_pdf, "-colorspace", "RGB", "-transparent", "white", b_png.name]) + run([CONVERT_CMD, a_png.name, b_png.name, "-composite", "-background", "white", "-flatten", args.diff_png]) if __name__ == "__main__": main() diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes index 93b71f5247bc..aa1d6301ecce 100755 --- a/bin/find-unneeded-includes +++ b/bin/find-unneeded-includes @@ -412,7 +412,7 @@ def run_tool(task_queue, failed_files, dontstop, noexclude, checknamespaces, fin retcode = processIWYUOutput(p.communicate()[0].decode('utf-8').splitlines(), moduleRules, invocation.split(' ')[-1], noexclude, checknamespaces, finderrors) if finderrors: if p.returncode == 1: - print("Running the IWYU process returned error code:\n",invocation) + print("Running the IWYU process returned error code:\n" + invocation) if retcode == -1 and not checknamespaces: print("ERROR: A file is probably not self contained, check this commands output:\n" + invocation) elif retcode > 0: diff --git a/bin/find-unusedheaders.sh b/bin/find-unusedheaders.sh index 0a27696cc161..ca9dd45b2679 100755 --- a/bin/find-unusedheaders.sh +++ b/bin/find-unusedheaders.sh @@ -54,7 +54,6 @@ for subdir in $(ls -d */ | grep -v \ -e unotest/ \ -e ure/ \ -e wizards/ \ - -e xmerge/ \ -e xmlreader/ \ -e instdir/ `# Skip typical build-related temporaries` \ -e workdir/ \ diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx index 92cfdccb62bd..18be04d358de 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx @@ -575,7 +575,7 @@ void ChartDataWrapper::fireChartDataChangeEvent( css::chart::ChartDataChangeEven uno::Reference< uno::XInterface > xSrc( static_cast< cppu::OWeakObject* >( this )); OSL_ASSERT( xSrc.is()); if( xSrc.is() ) - aEvent.Source = xSrc; + aEvent.Source = std::move(xSrc); m_aEventListenerContainer.forEach( g, [&aEvent](const uno::Reference& l) diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index cc00f5f300ba..1337ee3337e5 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -545,7 +545,7 @@ bool DataPointItemConverter::ApplySpecialItem( GetPropertySet()->getPropertyValue( u"Symbol"_ustr ) >>= aSymbol; if( aSymbol.Graphic != xGraphic ) { - aSymbol.Graphic = xGraphic; + aSymbol.Graphic = std::move(xGraphic); GetPropertySet()->setPropertyValue( u"Symbol"_ustr , uno::Any( aSymbol )); bChanged = true; } diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx index cd70c5a22368..182e50050f6f 100644 --- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx @@ -483,7 +483,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte GetPropertySet()->getPropertyValue(u"Symbol"_ustr) >>= aSymbol; if (aSymbol.Graphic != xGraphic) { - aSymbol.Graphic = xGraphic; + aSymbol.Graphic = std::move(xGraphic); GetPropertySet()->setPropertyValue(u"Symbol"_ustr, uno::Any(aSymbol)); bChanged = true; } diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 5c9bbb2d0133..3deda1fc6254 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -484,10 +484,7 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent impl_initializeAccessible(); - { - if( pChartWindow ) - pChartWindow->Invalidate(); - } + pChartWindow->Invalidate(); } m_bConnectingToView = false; diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 7ff6db70e922..304af1d07dc6 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -102,6 +102,10 @@ wrapper::ItemConverter* createItemConverter( //create itemconverter for a single object switch(eObjectType) { + case OBJECTTYPE_DATA_STOCK_LOSS: + case OBJECTTYPE_DATA_STOCK_GAIN: + case OBJECTTYPE_DIAGRAM_WALL: + case OBJECTTYPE_DIAGRAM_FLOOR: case OBJECTTYPE_PAGE: pItemConverter = new wrapper::GraphicPropertyItemConverter( xObjectProperties, rDrawModel.GetItemPool(), @@ -136,13 +140,6 @@ wrapper::ItemConverter* createItemConverter( break; case OBJECTTYPE_DIAGRAM: break; - case OBJECTTYPE_DIAGRAM_WALL: - case OBJECTTYPE_DIAGRAM_FLOOR: - pItemConverter = new wrapper::GraphicPropertyItemConverter( - xObjectProperties, rDrawModel.GetItemPool(), - rDrawModel, xChartModel, - wrapper::GraphicObjectType::LineAndFillProperties ); - break; case OBJECTTYPE_AXIS: { std::optional pRefSize; @@ -283,13 +280,6 @@ wrapper::ItemConverter* createItemConverter( } case OBJECTTYPE_DATA_STOCK_RANGE: break; - case OBJECTTYPE_DATA_STOCK_LOSS: - case OBJECTTYPE_DATA_STOCK_GAIN: - pItemConverter = new wrapper::GraphicPropertyItemConverter( - xObjectProperties, rDrawModel.GetItemPool(), - rDrawModel, xChartModel, - wrapper::GraphicObjectType::LineAndFillProperties ); - break; case OBJECTTYPE_DATA_TABLE: { pItemConverter = new wrapper::DataTableItemConverter( diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index a988f6ed9a6b..e61011ae0a77 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -425,7 +425,7 @@ void ChartController::impl_PasteShapes( SdrModel* pModel ) pDestPage->InsertObject( pNewObj.get() ); m_pDrawViewWrapper->AddUndo( std::make_unique( *pNewObj ) ); - xSelShape = xShape; + xSelShape = std::move(xShape); } } } diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index b9d4a4372f15..a4e54a5fd13e 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -982,21 +982,15 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) { SolarMutexGuard aGuard; auto pChartWindow(GetChartWindow()); - bool bIsAction = false; - { - DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get(); - if(!pChartWindow || !pDrawViewWrapper) - return; - bIsAction = m_pDrawViewWrapper->IsAction(); - } + DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get(); + if(!pChartWindow || !pDrawViewWrapper) + return; + bool bIsAction = m_pDrawViewWrapper->IsAction(); // pop-up menu if(rCEvt.GetCommand() == CommandEventId::ContextMenu && !bIsAction) { - { - if(pChartWindow) - pChartWindow->ReleaseMouse(); - } + pChartWindow->ReleaseMouse(); if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() ) impl_notifySelectionChangeListeners(); @@ -1006,8 +1000,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) Point aPos( rCEvt.GetMousePosPixel() ); if( !rCEvt.IsMouseEvent() ) { - if(pChartWindow) - aPos = pChartWindow->GetPointerState().maPos; + aPos = pChartWindow->GetPointerState().maPos; } OUString aMenuName; diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx index 1c317d1bf3dc..05f78367d66d 100644 --- a/chart2/source/controller/main/ShapeController.cxx +++ b/chart2/source/controller/main/ShapeController.cxx @@ -585,7 +585,7 @@ SdrObject* ShapeController::getFirstAdditionalShape() { if ( xShape.is() && xShape != xChartRoot ) { - xFirstShape = xShape; + xFirstShape = std::move(xShape); break; } } @@ -624,7 +624,7 @@ SdrObject* ShapeController::getLastAdditionalShape() { if ( xShape.is() && xShape != xChartRoot ) { - xLastShape = xShape; + xLastShape = std::move(xShape); break; } } diff --git a/chart2/source/tools/LabeledDataSequence.cxx b/chart2/source/tools/LabeledDataSequence.cxx index 16afb3a6076c..181c639625ec 100644 --- a/chart2/source/tools/LabeledDataSequence.cxx +++ b/chart2/source/tools/LabeledDataSequence.cxx @@ -70,8 +70,8 @@ LabeledDataSequence::LabeledDataSequence( const LabeledDataSequence& rSource ) : if( xValuesCloneable.is()) xNewValues.set( xValuesCloneable->createClone(), uno::UNO_QUERY ); - m_xData = xNewValues; - m_xLabel = xNewLabel; + m_xData = std::move(xNewValues); + m_xLabel = std::move(xNewLabel); ModifyListenerHelper::addListener( m_xData, m_xModifyEventForwarder ); ModifyListenerHelper::addListener( m_xLabel, m_xModifyEventForwarder ); diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 712ca15796ce..1e4e2764d063 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -1207,7 +1207,7 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet( errorBar = "ErrorBarZ"; xSeries->getPropertyValue( errorBar ) >>= xErrorBarProp; - xObjectProperties = xErrorBarProp; + xObjectProperties = std::move(xErrorBarProp); } break; } diff --git a/chart2/source/tools/StatisticsHelper.cxx b/chart2/source/tools/StatisticsHelper.cxx index 618236d7efbd..260c40eef2ca 100644 --- a/chart2/source/tools/StatisticsHelper.cxx +++ b/chart2/source/tools/StatisticsHelper.cxx @@ -133,7 +133,7 @@ void lcl_addSequenceToDataSource( xDataSource->getDataSequences()); aSequences.realloc( aSequences.getLength() + 1 ); auto pSequences = aSequences.getArray(); - pSequences[ aSequences.getLength() - 1 ] = xLSeq; + pSequences[ aSequences.getLength() - 1 ] = std::move(xLSeq); xSink->setData( aSequences ); } @@ -200,7 +200,7 @@ uno::Reference< chart2::data::XLabeledDataSequence > StatisticsHelper::getErrorL uno::Reference< chart2::data::XLabeledDataSequence > xLSeq = lcl_getErrorBarLabeledSequence( xDataSource, bPositiveValue, bYError, aRole ); if( xLSeq.is()) - xResult = xLSeq; + xResult = std::move(xLSeq); return xResult; } diff --git a/chart2/source/tools/WrappedPropertySet.cxx b/chart2/source/tools/WrappedPropertySet.cxx index 9eee3f8632e8..073fd67aeae8 100644 --- a/chart2/source/tools/WrappedPropertySet.cxx +++ b/chart2/source/tools/WrappedPropertySet.cxx @@ -66,7 +66,7 @@ Reference< beans::XPropertySetInfo > SAL_CALL WrappedPropertySet::getPropertySet { xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ); OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); - m_xInfo = xInfo; + m_xInfo = std::move(xInfo); } } else diff --git a/chart2/source/view/main/DataTableView.cxx b/chart2/source/view/main/DataTableView.cxx index 147643d0c2d3..bec3999d61fe 100644 --- a/chart2/source/view/main/DataTableView.cxx +++ b/chart2/source/view/main/DataTableView.cxx @@ -330,15 +330,15 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV auto xText = xCellTextRange->getText(); xText->insertString(xText->getStart(), rString, false); auto xTextPropertySet = getFirstParagraphProperties(xText); - if (!xTextPropertySet.is()) - continue; - - bool bLeft - = (bOutline && nColumn == 1) || (bVBorder && nColumn > 1 && nColumn < nColumnCount); - bool bRight = (bOutline && nColumn == nColumnCount) - || (bVBorder && nColumn > 1 && nColumn < nColumnCount); - setCellCharAndParagraphProperties(xTextPropertySet); - setCellProperties(xPropertySet, bLeft, bOutline, bRight, bOutline); + if (xTextPropertySet) + { + bool bLeft = (bOutline && nColumn == 1) + || (bVBorder && nColumn > 1 && nColumn < nColumnCount); + bool bRight = (bOutline && nColumn == nColumnCount) + || (bVBorder && nColumn > 1 && nColumn < nColumnCount); + setCellCharAndParagraphProperties(xTextPropertySet); + setCellProperties(xPropertySet, bLeft, bOutline, bRight, bOutline); + } } nColumn++; } @@ -399,18 +399,19 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV auto xText = xCellTextRange->getText(); xText->insertString(xText->getStart(), rSeriesName, false); auto xTextPropertySet = getFirstParagraphProperties(xText); - if (!xTextPropertySet.is()) - continue; - setCellCharAndParagraphProperties(xTextPropertySet); - setCellProperties(xCellPropertySet, bOutline, bTop, bOutline, bBottom); - - xCellPropertySet->setPropertyValue(u"ParaAdjust"_ustr, - uno::Any(style::ParagraphAdjust_LEFT)); - if (bKeys) + if (xTextPropertySet) { - xCellPropertySet->setPropertyValue( - u"ParaLeftMargin"_ustr, - uno::Any(nMaxSymbolWidth + sal_Int32(2 * constSymbolMargin))); + setCellCharAndParagraphProperties(xTextPropertySet); + setCellProperties(xCellPropertySet, bOutline, bTop, bOutline, bBottom); + + xCellPropertySet->setPropertyValue(u"ParaAdjust"_ustr, + uno::Any(style::ParagraphAdjust_LEFT)); + if (bKeys) + { + xCellPropertySet->setPropertyValue( + u"ParaLeftMargin"_ustr, + uno::Any(nMaxSymbolWidth + sal_Int32(2 * constSymbolMargin))); + } } } nRow++; @@ -418,11 +419,22 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV // TABLE nRow = 1; + const sal_Int32 nTableModelRowCount = m_xTable->getRowCount(); + const sal_Int32 nTableModelColCount = m_xTable->getColumnCount(); + // tdf#153182 the broken bounds are most likely because we don't know if the + // data-table has header rows and columns. Most likely it does not. + bool bBrokenBounds = false; for (auto const& rSeries : m_pDataSeriesValues) { nColumn = 1; for (auto const& rValue : rSeries) { + if (nRow >= nTableModelRowCount || nColumn >= nTableModelColCount) + { + bBrokenBounds = true; + SAL_WARN("chart2", "exceeding bounds of table model?"); + break; + } uno::Reference xCell = m_xTable->getCellByPosition(nColumn, nRow); uno::Reference xCellPropertySet(xCell, uno::UNO_QUERY); uno::Reference xCellTextRange(xCell, uno::UNO_QUERY); @@ -431,31 +443,33 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV auto xText = xCellTextRange->getText(); xText->insertString(xText->getStart(), rValue, false); auto xTextPropertySet = getFirstParagraphProperties(xText); - if (!xTextPropertySet.is()) - continue; + if (xTextPropertySet.is()) + { + bool bLeft = false; + bool bTop = false; + bool bRight = false; + bool bBottom = false; - bool bLeft = false; - bool bTop = false; - bool bRight = false; - bool bBottom = false; + if (nColumn > 1 && bVBorder) + bLeft = true; - if (nColumn > 1 && bVBorder) - bLeft = true; + if (nRow > 1 && bHBorder) + bTop = true; - if (nRow > 1 && bHBorder) - bTop = true; + if (nRow == nRowCount && bOutline) + bBottom = true; - if (nRow == nRowCount && bOutline) - bBottom = true; + if (nColumn == nColumnCount && bOutline) + bRight = true; - if (nColumn == nColumnCount && bOutline) - bRight = true; - - setCellCharAndParagraphProperties(xTextPropertySet); - setCellProperties(xCellPropertySet, bLeft, bTop, bRight, bBottom); + setCellCharAndParagraphProperties(xTextPropertySet); + setCellProperties(xCellPropertySet, bLeft, bTop, bRight, bBottom); + } } nColumn++; } + if (bBrokenBounds) + break; nRow++; } diff --git a/comphelper/qa/unit/propertyvalue.cxx b/comphelper/qa/unit/propertyvalue.cxx index 877a964478ac..4523bb49d352 100644 --- a/comphelper/qa/unit/propertyvalue.cxx +++ b/comphelper/qa/unit/propertyvalue.cxx @@ -103,7 +103,7 @@ class MakePropertyValueTest : public CppUnit::TestFixture ] } } -)json"_ostr); +)json"); CPPUNIT_ASSERT_EQUAL(static_cast(3), aRet.size()); beans::PropertyValue aFirst = aRet[0]; CPPUNIT_ASSERT_EQUAL(u"FieldType"_ustr, aFirst.Name); diff --git a/comphelper/source/container/container.cxx b/comphelper/source/container/container.cxx index 7b2432723360..78d3d1879639 100644 --- a/comphelper/source/container/container.cxx +++ b/comphelper/source/container/container.cxx @@ -99,7 +99,7 @@ css::uno::Reference< css::uno::XInterface> const & IndexAccessIterator::Next() break; } // Finally, if there's nothing more to do in this row (to the right), we'll move on to the next row. - xSearchLoop = xParent; + xSearchLoop = std::move(xParent); bCheckingStartingPoint = false; } diff --git a/comphelper/source/misc/diagnose_ex.cxx b/comphelper/source/misc/diagnose_ex.cxx index 487f98b637a0..27d15c930e2e 100644 --- a/comphelper/source/misc/diagnose_ex.cxx +++ b/comphelper/source/misc/diagnose_ex.cxx @@ -322,14 +322,6 @@ static void exceptionToStringImpl(OStringBuffer& sMessage, const css::uno::Any & sMessage.append(toOString(comphelper::anyToString( css::uno::Any(specialized.Code) ))); } } - { - css::xml::dom::DOMException specialized; - if ( caught >>= specialized ) - { - sMessage.append(" Code: "); - sMessage.append(toOString(comphelper::anyToString( css::uno::Any(specialized.Code) ))); - } - } { css::xml::sax::SAXException specialized; if ( caught >>= specialized ) diff --git a/comphelper/source/misc/sequenceashashmap.cxx b/comphelper/source/misc/sequenceashashmap.cxx index ba4955e09780..9f8655f3d164 100644 --- a/comphelper/source/misc/sequenceashashmap.cxx +++ b/comphelper/source/misc/sequenceashashmap.cxx @@ -302,13 +302,10 @@ void SequenceAsHashMap::update(const SequenceAsHashMap& rUpdate) } } -std::vector JsonToPropertyValues(const OString& rJson) +static std::vector JsonToPropertyValues(const boost::property_tree::ptree& aTree) { std::vector aArguments; - boost::property_tree::ptree aTree, aNodeNull, aNodeValue; - std::stringstream aStream((std::string(rJson))); - boost::property_tree::read_json(aStream, aTree); - + boost::property_tree::ptree aNodeNull, aNodeValue; for (const auto& rPair : aTree) { const std::string& rType = rPair.second.get("type", ""); @@ -364,10 +361,7 @@ std::vector JsonToPropertyValues(const OString& rJson else if (rType == "[]com.sun.star.beans.PropertyValue") { aNodeValue = rPair.second.get_child("value", aNodeNull); - std::stringstream s; - boost::property_tree::write_json(s, aNodeValue); - std::vector aPropertyValues = JsonToPropertyValues(OString(s.str())); - aValue.Value <<= comphelper::containerToSequence(aPropertyValues); + aValue.Value <<= comphelper::containerToSequence(JsonToPropertyValues(aNodeValue)); } else if (rType == "[][]com.sun.star.beans.PropertyValue") { @@ -375,10 +369,7 @@ std::vector JsonToPropertyValues(const OString& rJson std::vector> aSeqs; for (const auto& rItem : aNodeValue) { - std::stringstream s; - boost::property_tree::write_json(s, rItem.second); - std::vector aPropertyValues = JsonToPropertyValues(OString(s.str())); - aSeqs.push_back(comphelper::containerToSequence(aPropertyValues)); + aSeqs.push_back(comphelper::containerToSequence(JsonToPropertyValues(rItem.second))); } aValue.Value <<= comphelper::containerToSequence(aSeqs); } @@ -389,6 +380,14 @@ std::vector JsonToPropertyValues(const OString& rJson return aArguments; } +std::vector JsonToPropertyValues(std::string_view rJson) +{ + boost::property_tree::ptree aTree; + std::stringstream aStream((std::string(rJson))); + boost::property_tree::read_json(aStream, aTree); + return JsonToPropertyValues(aTree); +} + } // namespace comphelper /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx index ee81100ae617..1ce9ad4ea8c5 100644 --- a/comphelper/source/property/propertycontainerhelper.cxx +++ b/comphelper/source/property/propertycontainerhelper.cxx @@ -399,7 +399,7 @@ void OPropertyContainerHelper::getFastPropertyValue(Any& _rValue, sal_Int32 _nHa PropertiesIterator aPos = const_cast(this)->searchHandle(_nHandle); if (aPos == m_aProperties.end()) { - OSL_FAIL( "OPropertyContainerHelper::getFastPropertyValue: unknown handle!" ); + assert( false && "OPropertyContainerHelper::getFastPropertyValue: unknown handle" ); // should not happen if the derived class has built a correct property set info helper to be used by // our base class OPropertySetHelper return; diff --git a/comphelper/source/property/propshlp.cxx b/comphelper/source/property/propshlp.cxx index b0139c747969..d15db5c7e2df 100644 --- a/comphelper/source/property/propshlp.cxx +++ b/comphelper/source/property/propshlp.cxx @@ -176,6 +176,8 @@ Any OPropertySetHelper::getPropertyValueImpl(std::unique_lock& rGuar IPropertyArrayHelper& rPH = getInfoHelper(); // map the name to the handle sal_Int32 nHandle = rPH.getHandleByName(rPropertyName); + if (nHandle == -1) + throw UnknownPropertyException(rPropertyName); // call the method of the XFastPropertySet interface Any aAny; getFastPropertyValue(rGuard, aAny, nHandle); diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx index dceb16824c58..a90df21e3d80 100644 --- a/comphelper/source/streaming/seekableinput.cxx +++ b/comphelper/source/streaming/seekableinput.cxx @@ -108,7 +108,7 @@ void OSeekableInputWrapper::PrepareCopy_Impl() m_xCopyInput.set( xTempOut, uno::UNO_QUERY ); if ( m_xCopyInput.is() ) { - m_xCopySeek = xTempSeek; + m_xCopySeek = std::move(xTempSeek); m_pCopyByteReader = dynamic_cast(xTempOut.get()); assert(m_pCopyByteReader); } diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx index 1d003acdb8a6..3a69f78caef8 100644 --- a/compilerplugins/clang/badstatics.cxx +++ b/compilerplugins/clang/badstatics.cxx @@ -113,7 +113,7 @@ public: if (!pDefinition) { // maybe no definition if it's a pointer/reference return std::make_pair(false, std::vector()); } - if ( type.Class("DeleteOnDeinit").Namespace("vcl").GlobalNamespace() + if ( type.Class("DeleteOnDeinit").Namespace("tools").GlobalNamespace() || type.Class("weak_ptr").StdNamespace() // not owning || type.Class("ImplWallpaper").GlobalNamespace() // very odd static instance here || type.Class("Application").GlobalNamespace() // numerous odd subclasses in vclmain::createApplication() diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx index 2bee2f80cf65..4140b6a10688 100644 --- a/compilerplugins/clang/refcounting.cxx +++ b/compilerplugins/clang/refcounting.cxx @@ -337,7 +337,7 @@ bool containsSalhelperReferenceObjectSubclass(const clang::Type* pType0) { if (dc.Class("Reference").Namespace("rtl").GlobalNamespace() || (dc.Class("OStoreHandle").AnonymousNamespace().Namespace("store") .GlobalNamespace()) - || (dc.Class("DeleteRtlReferenceOnDeinit").Namespace("vcl") + || (dc.Class("DeleteRtlReferenceOnDeinit").Namespace("tools") .GlobalNamespace())) { return false; diff --git a/connectivity/source/commontools/ConnectionWrapper.cxx b/connectivity/source/commontools/ConnectionWrapper.cxx index 109f3d7b9459..12e3645ed27b 100644 --- a/connectivity/source/commontools/ConnectionWrapper.cxx +++ b/connectivity/source/commontools/ConnectionWrapper.cxx @@ -82,7 +82,7 @@ void OConnectionWrapper::setDelegation(const Reference< XConnection >& _xConnect if (xConProxy.is()) { // transfer the (one and only) real ref to the aggregate to our member - m_xProxyConnection = xConProxy; + m_xProxyConnection = std::move(xConProxy); // set ourself as delegator Reference xIf = static_cast< XUnoTunnel* >( this ); diff --git a/connectivity/source/commontools/statementcomposer.cxx b/connectivity/source/commontools/statementcomposer.cxx index 3ff71fcdbf2d..1ecaf36ea3bd 100644 --- a/connectivity/source/commontools/statementcomposer.cxx +++ b/connectivity/source/commontools/statementcomposer.cxx @@ -216,7 +216,7 @@ namespace dbtools sStatement = xComposer->getQuery(); - _rData.xComposer = xComposer; + _rData.xComposer = std::move(xComposer); _rData.bComposerDirty = false; } } diff --git a/connectivity/source/cpool/ZConnectionPool.cxx b/connectivity/source/cpool/ZConnectionPool.cxx index 9d38b2e99e2d..91790a7159ec 100644 --- a/connectivity/source/cpool/ZConnectionPool.cxx +++ b/connectivity/source/cpool/ZConnectionPool.cxx @@ -215,7 +215,7 @@ Reference< XConnection> OConnectionPool::createNewConnection(const OUString& _rU aPack.nALiveCount = m_nALiveCount; TActiveConnectionInfo aActiveInfo; aActiveInfo.aPos = m_aPool.emplace(nId,aPack).first; - aActiveInfo.xPooledConnection = xPooledConnection; + aActiveInfo.xPooledConnection = std::move(xPooledConnection); m_aActiveConnections.emplace(xConnection,aActiveInfo); if(m_xInvalidator->isExpired()) @@ -271,7 +271,7 @@ Reference< XConnection> OConnectionPool::getPooledConnection(TConnectionMap::ite TActiveConnectionInfo aActiveInfo; aActiveInfo.aPos = _rIter; - aActiveInfo.xPooledConnection = xPooledConnection; + aActiveInfo.xPooledConnection = std::move(xPooledConnection); m_aActiveConnections[xConnection] = std::move(aActiveInfo); } return xConnection; diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx index 160c21bfe7e4..e6ef3182520d 100644 --- a/connectivity/source/cpool/ZPoolCollection.cxx +++ b/connectivity/source/cpool/ZPoolCollection.cxx @@ -152,7 +152,7 @@ Reference< XDriver > SAL_CALL OPoolCollection::getDriverByURL( const OUString& _ } if (xExistentProxy.is()) { - xDriver = xExistentProxy; + xDriver = std::move(xExistentProxy); } else { // create a new proxy for the driver diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx index cc55b54ba8e7..fe43ed6477ed 100644 --- a/connectivity/source/drivers/file/FConnection.cxx +++ b/connectivity/source/drivers/file/FConnection.cxx @@ -179,7 +179,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >& { Reference xParent(Reference(aFile.get(),UNO_QUERY_THROW)->getParent(),UNO_QUERY_THROW); Reference xIdent = xParent->getIdentifier(); - m_xContent = xParent; + m_xContent = std::move(xParent); ::ucbhelper::Content aParent(xIdent->getContentIdentifier(), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext()); m_xDir = aParent.createDynamicCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ); diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx index 17f4128c8297..9a9754014d90 100644 --- a/connectivity/source/drivers/postgresql/pq_connection.cxx +++ b/connectivity/source/drivers/postgresql/pq_connection.cxx @@ -514,7 +514,7 @@ void Connection::initialize( const Sequence< Any >& aArguments ) m_settings.user = OUString( p, strlen(p), RTL_TEXTENCODING_UTF8); p = PQdb( m_settings.pConnection ); m_settings.catalog = OUString( p, strlen(p), RTL_TEXTENCODING_UTF8); - m_settings.tc = tc; + m_settings.tc = std::move(tc); SAL_INFO("connectivity.postgresql", "connection to '" << url << "' successfully opened"); } diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index 23de1cb772ab..849f925d7637 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -4505,7 +4505,6 @@ sal_Int32 OSQLParser::s_nRefCount = 0; // ::osl::Mutex OSQLParser::s_aMutex; OSQLScanner* OSQLParser::s_pScanner = nullptr; OSQLParseNodesGarbageCollector* OSQLParser::s_pGarbageCollector = nullptr; -vcl::DeleteOnDeinit> OSQLParser::s_xLocaleData(vcl::DeleteOnDeinitFlag::Empty); void setParser(OSQLParser* _pParser) { diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 626d9cab112b..e0ea16b36ae0 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -455,7 +455,7 @@ void OSQLParseTreeIterator::traverseOneTableName( OSQLTables& _rTables,const OSQ // get the object representing this table/query OSQLTable aTable = impl_locateRecordSource( aComposedName ); if ( aTable.is() ) - _rTables[ aTableRange ] = aTable; + _rTables[ aTableRange ] = std::move(aTable); } void OSQLParseTreeIterator::impl_fillJoinConditions(const OSQLParseNode* i_pJoinCondition) diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index 89d3d30779e6..bccdb37a947b 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -803,6 +803,7 @@ void OSQLParser::killThousandSeparator(OSQLParseNode* pLiteral) { if ( pLiteral ) { + auto& s_xLocaleData = getLocaleData(); if ( s_xLocaleData.get()->get()->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' ) { pLiteral->m_aNodeValue = pLiteral->m_aNodeValue.replace('.', sal_Unicode()); @@ -1118,6 +1119,7 @@ OUString OSQLParser::stringToDouble(const OUString& _rValue,sal_Int16 _nScale) OUString aValue; if(!m_xCharClass.is()) m_xCharClass = CharacterClassification::create( m_xContext ); + auto& s_xLocaleData = getLocaleData(); if( s_xLocaleData.get() ) { try @@ -1248,10 +1250,13 @@ std::unique_ptr OSQLParser::predicateTree(OUString& rErrorMessage s_pScanner->SetRule(OSQLScanner::GetSTRINGRule()); break; default: + { + auto& s_xLocaleData = getLocaleData(); if ( s_xLocaleData.get()->get()->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' ) s_pScanner->SetRule(OSQLScanner::GetGERRule()); else s_pScanner->SetRule(OSQLScanner::GetENGRule()); + } } } @@ -1334,6 +1339,7 @@ OSQLParser::OSQLParser(css::uno::Reference< css::uno::XComponentContext > xConte s_pScanner->setScanner(); s_pGarbageCollector = new OSQLParseNodesGarbageCollector(); + auto& s_xLocaleData = getLocaleData(); if(!s_xLocaleData.get()) s_xLocaleData.set(LocaleData::create(m_xContext)); @@ -1473,6 +1479,12 @@ OSQLParser::OSQLParser(css::uno::Reference< css::uno::XComponentContext > xConte m_pData->aLocale = m_pContext->getPreferredLocale(); } +//static +tools::DeleteOnDeinit>& OSQLParser::getLocaleData() +{ + static tools::DeleteOnDeinit> s_xLocaleData(tools::DeleteOnDeinitFlag::Empty); + return s_xLocaleData; +} OSQLParser::~OSQLParser() { diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx index ac3348daf68d..8b5d1168b262 100644 --- a/cppcanvas/source/mtfrenderer/textaction.cxx +++ b/cppcanvas/source/mtfrenderer/textaction.cxx @@ -465,7 +465,7 @@ namespace cppcanvas::internal xTextLayout->applyKashidaPositions(aKashidaPositions); } - io_rTextLayout = xTextLayout; + io_rTextLayout = std::move(xTextLayout); } diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx index 6a71d413faee..10985a87a16f 100644 --- a/cppu/source/uno/copy.hxx +++ b/cppu/source/uno/copy.hxx @@ -149,6 +149,7 @@ inline void _copyConstructAnyFromData( break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: + case typelib_TypeClass_ENUM: // enum is forced to 32bit long pDestAny->pData = &pDestAny->pReserved; *static_cast(pDestAny->pData) = *static_cast(pSource); break; @@ -190,11 +191,6 @@ inline void _copyConstructAnyFromData( case typelib_TypeClass_ANY: OSL_FAIL( "### unexpected nested any!" ); break; - case typelib_TypeClass_ENUM: - pDestAny->pData = &pDestAny->pReserved; - // enum is forced to 32bit long - *static_cast(pDestAny->pData) = *static_cast(pSource); - break; case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: if (pTypeDescr) @@ -562,6 +558,7 @@ inline void _copyConstructData( break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: + case typelib_TypeClass_ENUM: *static_cast(pDest) = *static_cast(pSource); break; case typelib_TypeClass_HYPER: @@ -588,9 +585,6 @@ inline void _copyConstructData( static_cast(pSource)->pType, nullptr, acquire, mapping ); break; - case typelib_TypeClass_ENUM: - *static_cast(pDest) = *static_cast(pSource); - break; case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: if (pTypeDescr) diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx index 48d8f2ea579d..227affa9a619 100644 --- a/cppuhelper/source/component_context.cxx +++ b/cppuhelper/source/component_context.cxx @@ -410,11 +410,11 @@ void ComponentContext::disposing(std::unique_lock& rGuard) { if ( rName == TDMGR_SINGLETON ) { - xTDMgr = xComp; + xTDMgr = std::move(xComp); } else if ( rName == AC_SINGLETON ) { - xAC = xComp; + xAC = std::move(xComp); } else // dispose immediately { @@ -547,7 +547,7 @@ extern "C" { static void s_createComponentContext_v(va_list * pParam) } else { - xContext = xDelegate; + xContext = std::move(xDelegate); } *ppContext = pTarget2curr->mapInterface(xContext.get(), cppu::UnoType::get()); diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 295ca5a034e9..8ace85e1e30b 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -756,7 +756,7 @@ void cppuhelper::ServiceManager::Data::Implementation::updateDisposeInstance( if (comp.is()) { std::unique_lock g(mutex); if (dispose) { - disposeInstance = comp; + disposeInstance = std::move(comp); } } } @@ -872,8 +872,8 @@ void cppuhelper::ServiceManager::loadImplementation( { implementation->status = Data::Implementation::STATUS_LOADED; implementation->constructorFn = std::move(ctor); - implementation->factory1 = f1; - implementation->factory2 = f2; + implementation->factory1 = std::move(f1); + implementation->factory2 = std::move(f2); } } @@ -1961,8 +1961,8 @@ void cppuhelper::ServiceManager::preloadImplementations() { if (!rEntry.second->constructorName.isEmpty() && fpFactory) rEntry.second->constructorFn = WrapperConstructorFn(reinterpret_cast(fpFactory)); - rEntry.second->factory1 = xSCFactory; - rEntry.second->factory2 = xSSFactory; + rEntry.second->factory1 = std::move(xSCFactory); + rEntry.second->factory2 = std::move(xSSFactory); rEntry.second->status = Data::Implementation::STATUS_LOADED; } diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx index ae712ed7a2ca..6fdf6c130319 100644 --- a/cui/source/dialogs/QrCodeGenDialog.cxx +++ b/cui/source/dialogs/QrCodeGenDialog.cxx @@ -215,7 +215,7 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference xModel m_xComboType->set_active(aBarCode.Type); // Mark this as existing shape - m_xExistingShapeProperties = xProps; + m_xExistingShapeProperties = std::move(xProps); } short QrCodeGenDialog::run() diff --git a/cui/source/dialogs/SignatureLineDialog.cxx b/cui/source/dialogs/SignatureLineDialog.cxx index aece41a3d89d..84d5adf1065c 100644 --- a/cui/source/dialogs/SignatureLineDialog.cxx +++ b/cui/source/dialogs/SignatureLineDialog.cxx @@ -88,7 +88,7 @@ SignatureLineDialog::SignatureLineDialog(weld::Widget* pParent, Referenceset_active(bShowSignDate); // Mark this as existing shape - m_xExistingShapeProperties = xProps; + m_xExistingShapeProperties = std::move(xProps); } void SignatureLineDialog::Apply() diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx index c1873bfe785e..427c6a00c391 100644 --- a/cui/source/tabpages/measure.cxx +++ b/cui/source/tabpages/measure.cxx @@ -274,6 +274,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) } break; case css::drawing::MeasureTextVertPos_CENTERED: + case css::drawing::MeasureTextVertPos_AUTO: switch( eHPos ) { case css::drawing::MeasureTextHorzPos_LEFTOUTSIDE: eRP = RectPoint::LM; break; @@ -293,16 +294,6 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) default: break; } break; - case css::drawing::MeasureTextVertPos_AUTO: - switch( eHPos ) - { - case css::drawing::MeasureTextHorzPos_LEFTOUTSIDE: eRP = RectPoint::LM; break; - case css::drawing::MeasureTextHorzPos_INSIDE: eRP = RectPoint::MM; break; - case css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE: eRP = RectPoint::RM; break; - case css::drawing::MeasureTextHorzPos_AUTO: eRP = RectPoint::MM; break; - default: break; - } - break; default: ;//prevent warning } diff --git a/cui/uiconfig/ui/optnewdictionarydialog.ui b/cui/uiconfig/ui/optnewdictionarydialog.ui index 0566ea9d638d..8f97fa73a2f3 100644 --- a/cui/uiconfig/ui/optnewdictionarydialog.ui +++ b/cui/uiconfig/ui/optnewdictionarydialog.ui @@ -89,6 +89,20 @@ 12 12 6 + + + True + False + _Name: + True + nameedit + 0 + + + 0 + 0 + + True @@ -108,20 +122,6 @@ 0 - - - True - False - _Name: - True - nameedit - 0 - - - 0 - 0 - - True @@ -136,26 +136,6 @@ 1 - - - _Exception (-) - True - True - False - True - True - - - Specifies whether you wish to avoid certain words in your documents. - - - - - 0 - 2 - 2 - - True @@ -179,6 +159,26 @@ 1 + + + _Exception (-) + True + True + False + True + True + + + Specifies whether you wish to avoid certain words in your documents. + + + + + 0 + 2 + 2 + + diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 49503a9d7b56..9970f97ddf83 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -1398,7 +1398,7 @@ bool ODatabaseModelImpl::hasTrustedScriptingSignature( { task::DocumentMacroConfirmationRequest aRequest; aRequest.DocumentURL = m_sDocFileLocation; - aRequest.DocumentStorage = xStorage; + aRequest.DocumentStorage = std::move(xStorage); aRequest.DocumentSignatureInformation = aInfo; aRequest.DocumentVersion = aODFVersion; aRequest.Classification = task::InteractionClassification_QUERY; diff --git a/dbaccess/source/core/misc/apitools.cxx b/dbaccess/source/core/misc/apitools.cxx index 384d5962bd2d..2693f59eebb9 100644 --- a/dbaccess/source/core/misc/apitools.cxx +++ b/dbaccess/source/core/misc/apitools.cxx @@ -74,7 +74,7 @@ void OSubComponent::release() noexcept if (xParent.is()) { MutexGuard aGuard( rBHelper.rMutex ); - m_xParent = xParent; + m_xParent = std::move(xParent); } // destroy the object if xHoldAlive decrement the refcount to 0 diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 092720a38d6f..ed10f38e660b 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -814,6 +814,8 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const aReturn.bChecked = getContainer()->getPreviewMode() == PreviewMode::Document; break; case ID_BROWSER_UNDO: + case SID_DB_APP_SENDREPORTTOWRITER: + case SID_DB_APP_DBADMIN: aReturn.bEnabled = false; break; case SID_MAIL_SENDDOC: @@ -825,10 +827,6 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = E_REPORT == eType && getContainer()->getSelectionCount() > 0 && getContainer()->isALeafSelected(); } break; - case SID_DB_APP_SENDREPORTTOWRITER: - case SID_DB_APP_DBADMIN: - aReturn.bEnabled = false; - break; case SID_DB_APP_STATUS_TYPE: aReturn.bEnabled = m_xDataSource.is(); if ( aReturn.bEnabled ) @@ -1248,8 +1246,6 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa case SID_DB_APP_QUERY_OPEN: case SID_DB_APP_FORM_OPEN: case SID_DB_APP_REPORT_OPEN: - doAction( _nId, ElementOpenMode::Normal ); - break; case SID_DB_APP_CONVERTTOVIEW: doAction( _nId, ElementOpenMode::Normal ); break; @@ -2034,7 +2030,7 @@ void OApplicationController::renameEntry() Reference xParent(xChild->getParent(),UNO_QUERY); if ( xParent.is() ) { - xHNames = xParent; + xHNames = std::move(xParent); Reference(xRename,UNO_QUERY_THROW)->getPropertyValue(PROPERTY_NAME) >>= sName; } } diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx index 78e025ea748c..355b3c9bd46e 100644 --- a/dbaccess/source/ui/dlg/CollectionView.cxx +++ b/dbaccess/source/ui/dlg/CollectionView.cxx @@ -229,7 +229,7 @@ IMPL_LINK_NOARG(OCollectionView, Dbl_Click_FileView, weld::TreeView&, bool) xContent.set(xNameAccess->getByName(sSubFolder),UNO_QUERY); if ( xContent.is() ) { - m_xContent = xContent; + m_xContent = std::move(xContent); Initialize(); initCurrentPath(); } diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx index 46f577703891..c7293deea86e 100644 --- a/dbaccess/source/ui/dlg/ConnectionPage.cxx +++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx @@ -101,9 +101,6 @@ namespace dbaui m_xFT_Connection->set_label(DBA_RES(STR_WRITER_PATH_OR_FILE)); m_xConnectionURL->set_help_id(HID_DSADMIN_WRITER_PATH); break; - case ::dbaccess::DST_ADO: - m_xFT_Connection->set_label(DBA_RES(STR_COMMONURL)); - break; case ::dbaccess::DST_MSACCESS: m_xFT_Connection->set_label(DBA_RES(STR_MSACCESS_MDB_FILE)); m_xConnectionURL->set_help_id(HID_DSADMIN_MSACCESS_MDB_FILE); @@ -150,6 +147,7 @@ namespace dbaui } m_xConnectionURL->hide(); break; + case ::dbaccess::DST_ADO: case ::dbaccess::DST_JDBC: default: m_xFT_Connection->set_label(DBA_RES(STR_COMMONURL)); diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index f8bdea3050f2..1cba0dee6943 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -421,9 +421,6 @@ sal_Int16 ODatabaseExport::CheckString(const OUString& aCheckToken, sal_Int16 _n case NumberFormat::ALL: nNumberFormat = NumberFormat::ALL; break; - case NumberFormat::DEFINED: - nNumberFormat = NumberFormat::TEXT; - break; case NumberFormat::DATE: switch(_nOldNumberFormat) { @@ -459,12 +456,10 @@ sal_Int16 ODatabaseExport::CheckString(const OUString& aCheckToken, sal_Int16 _n case NumberFormat::CURRENCY: switch(_nOldNumberFormat) { - case NumberFormat::NUMBER: - nNumberFormat = NumberFormat::CURRENCY; - break; case NumberFormat::CURRENCY: nNumberFormat = _nOldNumberFormat; break; + case NumberFormat::NUMBER: case NumberFormat::ALL: nNumberFormat = NumberFormat::CURRENCY; break; @@ -496,6 +491,7 @@ sal_Int16 ODatabaseExport::CheckString(const OUString& aCheckToken, sal_Int16 _n case NumberFormat::TEXT: case NumberFormat::UNDEFINED: case NumberFormat::LOGICAL: + case NumberFormat::DEFINED: nNumberFormat = NumberFormat::TEXT; // Text overwrites everything break; case NumberFormat::DATETIME: @@ -548,13 +544,6 @@ void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfo switch ( nType ) { - case NumberFormat::ALL: - nDataType = DataType::DOUBLE; - break; - case NumberFormat::DEFINED: - nDataType = DataType::VARCHAR; - nLength = ((m_vColumnSize[i] % 10 ) ? m_vColumnSize[i]/ 10 + 1: m_vColumnSize[i]/ 10) * 10; - break; case NumberFormat::DATE: nDataType = DataType::DATE; break; @@ -569,12 +558,14 @@ void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfo nScale = 4; nLength = 19; break; + case NumberFormat::ALL: case NumberFormat::NUMBER: case NumberFormat::SCIENTIFIC: case NumberFormat::FRACTION: case NumberFormat::PERCENT: nDataType = DataType::DOUBLE; break; + case NumberFormat::DEFINED: case NumberFormat::TEXT: case NumberFormat::UNDEFINED: case NumberFormat::LOGICAL: diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx index f48dc17c7a3a..2ca8c71b837f 100644 --- a/dbaccess/source/ui/querydesign/QueryTableView.cxx +++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx @@ -493,10 +493,10 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString& if ( pTabWinTmp == pNewTabWin ) continue; + assert(pTabWinTmp && "TableWindow is null!"); if ( pTabWinTmp->GetData()->isQuery() ) continue; - assert(pTabWinTmp && "TableWindow is null!"); Reference< XPropertySet > xFKKey = getKeyReferencedTo( pTabWinTmp->GetData()->getKeys(), pNewTabWin->GetComposedName() ); if ( !xFKKey.is() ) continue; diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index b13986769bb4..5134161cce5a 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -689,8 +689,6 @@ void OQueryController::impl_initialize(const ::comphelper::NamedValueCollection& switch ( m_nCommandType ) { case CommandType::QUERY: - m_sName = sCommand; - break; case CommandType::TABLE: m_sName = sCommand; break; diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index 941b24914aac..7b5b6d152cfc 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -1318,7 +1318,7 @@ void OTableController::assignTable() if (!xProp.is()) return; - m_xTable = xProp; + m_xTable = std::move(xProp); startTableListening(); // check if we set the table editable diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 171cc70d20a3..13a4f050731b 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -875,7 +875,7 @@ SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference< while ( false ); if ( xInteractionHandler != m_xInteractionHandler ) - _out_rxDocInteractionHandler = xInteractionHandler; + _out_rxDocInteractionHandler = std::move(xInteractionHandler); return xConnection; } @@ -1499,7 +1499,7 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments ) impl_ensureDataAccessDescriptor_throw( _rArguments, 1, m_xDestConnection, xDestDocHandler ); if ( xDestDocHandler.is() && !m_xInteractionHandler.is() ) - m_xInteractionHandler = xDestDocHandler; + m_xInteractionHandler = std::move(xDestDocHandler); Reference< XPropertySet > xInteractionHandler(m_xInteractionHandler, UNO_QUERY); if (xInteractionHandler.is()) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index a4ce4c965d3a..f33080482bba 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -713,6 +713,8 @@ OUString Desktop::CreateErrorMsgString( /// the bootstrap INI file could not be found or read case ::utl::Bootstrap::MISSING_BOOTSTRAP_FILE: + /// the version locator INI file could not be found or read + case ::utl::Bootstrap::MISSING_VERSION_FILE: { aMsg = DpResId(STR_BOOTSTRAP_ERR_FILE_MISSING); } @@ -727,13 +729,6 @@ OUString Desktop::CreateErrorMsgString( } break; - /// the version locator INI file could not be found or read - case ::utl::Bootstrap::MISSING_VERSION_FILE: - { - aMsg = DpResId(STR_BOOTSTRAP_ERR_FILE_MISSING); - } - break; - /// the version locator INI has no entry for this version case ::utl::Bootstrap::MISSING_VERSION_FILE_ENTRY: { @@ -1409,12 +1404,9 @@ int Desktop::Main() } } - // check if accessibility is enabled but not working and allow to quit + // check if accessibility is enabled if( Application::GetSettings().GetMiscSettings().GetEnableATToolSupport() ) - { - if( !InitAccessBridge() ) - return EXIT_FAILURE; - } + InitAccessBridge(); #endif // terminate if requested... diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 2d978ce080f0..cf53dddff48a 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -776,7 +776,7 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleCloseBtn, weld::Button&, void) IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface, void ) { - std::unique_lock aGuard( m_aMutex ); + SolarMutexGuard aGuard; bool bLockInterface = static_cast(_bLockInterface); if ( m_bStartProgress && !m_bHasProgress ) @@ -815,7 +815,7 @@ IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface, void ) void ExtMgrDialog::showProgress( bool _bStart ) { - std::unique_lock aGuard( m_aMutex ); + SolarMutexGuard aGuard; bool bStart = _bStart; @@ -839,7 +839,7 @@ void ExtMgrDialog::showProgress( bool _bStart ) void ExtMgrDialog::updateProgress( const tools::Long nProgress ) { - std::unique_lock aGuard( m_aMutex ); + SolarMutexGuard aGuard; if ( m_nProgress != nProgress ) { m_nProgress = nProgress; @@ -851,7 +851,7 @@ void ExtMgrDialog::updateProgress( const tools::Long nProgress ) void ExtMgrDialog::updateProgress( const OUString &rText, const uno::Reference< task::XAbortChannel > &xAbortChannel) { - std::unique_lock aGuard( m_aMutex ); + SolarMutexGuard aGuard; m_xAbortChannel = xAbortChannel; m_sProgressText = rText; @@ -945,7 +945,7 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleUpdateBtn, weld::Button&, void) IMPL_LINK_NOARG(ExtMgrDialog, TimeOutHdl, Timer *, void) { - std::unique_lock aGuard( m_aMutex ); + SolarMutexGuard aGuard; if ( m_bStopProgress ) { m_bHasProgress = false; diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index e7910535cad3..291b5c80981e 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -92,7 +92,6 @@ class ExtMgrDialog : public weld::GenericDialogController { const OUString m_sAddPackages; OUString m_sProgressText; - std::mutex m_aMutex; bool m_bHasProgress; bool m_bProgressChanged; bool m_bStartProgress; diff --git a/desktop/source/deployment/manager/dp_managerfac.cxx b/desktop/source/deployment/manager/dp_managerfac.cxx index e67769dacd76..d3bd911e36e9 100644 --- a/desktop/source/deployment/manager/dp_managerfac.cxx +++ b/desktop/source/deployment/manager/dp_managerfac.cxx @@ -164,7 +164,7 @@ PackageManagerFactoryImpl::getPackageManager( OUString const & context ) { guard.clear(); try_dispose( xRet ); - xRet = xAlreadyIn; + xRet = std::move(xAlreadyIn); } else { diff --git a/desktop/source/deployment/misc/dp_dependencies.cxx b/desktop/source/deployment/misc/dp_dependencies.cxx index b9044f256977..d06dabd47788 100644 --- a/desktop/source/deployment/misc/dp_dependencies.cxx +++ b/desktop/source/deployment/misc/dp_dependencies.cxx @@ -148,7 +148,7 @@ check(dp_misc::DescriptionInfoset const & infoset) { minimalVersionOpenOfficeOrg)); } if (!sat) { - unsatisfiedRange[unsat++] = e; + unsatisfiedRange[unsat++] = std::move(e); } } unsatisfied.realloc(unsat); diff --git a/desktop/source/deployment/misc/dp_update.cxx b/desktop/source/deployment/misc/dp_update.cxx index e78f40c2aff4..5c55ecef74a3 100644 --- a/desktop/source/deployment/misc/dp_update.cxx +++ b/desktop/source/deployment/misc/dp_update.cxx @@ -169,7 +169,7 @@ void getDefaultUpdateInfos( dp_misc::GREATER) { j->second.version = v; - j->second.info = node; + j->second.info = std::move(node); } } } diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx index 74374b95d66c..c64a9ecd9cb2 100644 --- a/desktop/source/lib/lokclipboard.cxx +++ b/desktop/source/lib/lokclipboard.cxx @@ -9,7 +9,7 @@ #include "lokclipboard.hxx" #include -#include +#include #include #include #include @@ -20,7 +20,12 @@ using namespace css; using namespace css::uno; /* static */ osl::Mutex LOKClipboardFactory::gMutex; -static vcl::DeleteOnDeinit>> gClipboards{}; +static tools::DeleteOnDeinit>>& getClipboards() +{ + static tools::DeleteOnDeinit>> + gClipboards{}; + return gClipboards; +} rtl::Reference LOKClipboardFactory::getClipboardForCurView() { @@ -28,6 +33,7 @@ rtl::Reference LOKClipboardFactory::getClipboardForCurView() osl::MutexGuard aGuard(gMutex); + auto& gClipboards = getClipboards(); auto it = gClipboards.get()->find(nViewId); if (it != gClipboards.get()->end()) { @@ -44,6 +50,7 @@ void LOKClipboardFactory::releaseClipboardForView(int nViewId) { osl::MutexGuard aGuard(gMutex); + auto& gClipboards = getClipboards(); if (nViewId < 0) // clear all { gClipboards.get()->clear(); diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index eb2c548eb10a..c5ecbdd7dd02 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -1070,7 +1070,7 @@ void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurat } if (sCommandURL == sToken) { - xTemp = xChild; + xTemp = std::move(xChild); break; } } diff --git a/download.lst b/download.lst index c7992187785f..7b7e5d37284b 100644 --- a/download.lst +++ b/download.lst @@ -457,8 +457,8 @@ LIBWEBP_TARBALL := libwebp-1.4.0.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -XMLSEC_SHA256SUM := 2ffd4ad1f860ec93e47a680310ab2bc94968bd07566e71976bd96133d9504917 -XMLSEC_TARBALL := xmlsec1-1.3.5.tar.gz +XMLSEC_SHA256SUM := 952b626ad3f3be1a4598622dab52fdab2a8604d0837c1b00589f3637535af92f +XMLSEC_TARBALL := xmlsec1-1.3.6.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts @@ -645,8 +645,8 @@ TWAIN_DSM_TARBALL := twaindsm_2.4.1.orig.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -VISIO_SHA256SUM := 8faf8df870cb27b09a787a1959d6c646faa44d0d8ab151883df408b7166bea4c -VISIO_TARBALL := libvisio-0.1.7.tar.xz +VISIO_SHA256SUM := b4098ffbf4dcb9e71213fa0acddbd928f27bed30db2d80234813b15d53d0405b +VISIO_TARBALL := libvisio-0.1.8.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index 66d92c2d60df..733ccbaad014 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -74,7 +74,7 @@ namespace drawinglayer::primitive2d xXControl->setModel(getControlModel()); // remember XControl - mxXControl = xXControl; + mxXControl = std::move(xXControl); } } diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index 28d383230eef..6b6499a8b539 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -383,7 +383,7 @@ VDevBuffer& getVDevBuffer() // secure global instance with Vcl's safe destroyer of external (seen by // library base) stuff, the remembered VDevs need to be deleted before // Vcl's deinit - static vcl::DeleteOnDeinit aVDevBuffer{}; + static tools::DeleteOnDeinit aVDevBuffer{}; return *aVDevBuffer.get(); } diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index a365beebae4d..5d8c73b9d028 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -521,10 +521,6 @@ void VclMetafileProcessor2D::popList() popStructureElement(vcl::PDFWriter::List); } -// init static break iterator -vcl::DeleteOnDeinit> - VclMetafileProcessor2D::mxBreakIterator; - VclMetafileProcessor2D::VclMetafileProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev) : VclProcessor2D(rViewInformation, rOutDev) @@ -1495,14 +1491,22 @@ void VclMetafileProcessor2D::processTextSimplePortionPrimitive2D( // #i101169# if(pTextDecoratedCandidate) { + /* break iterator support + made static so it only needs to be fetched once, even with many single + constructed VclMetafileProcessor2D. It's still incarnated on demand, + but exists for OOo runtime now by purpose. + */ + static tools::DeleteOnDeinit> + gxBreakIterator; + // support for TEXT_ MetaFile actions only for decorated texts - if (!mxBreakIterator.get() || !mxBreakIterator.get()->get()) + if (!gxBreakIterator.get() || !gxBreakIterator.get()->get()) { uno::Reference xContext( ::comphelper::getProcessComponentContext()); - mxBreakIterator.set(i18n::BreakIterator::create(xContext)); + gxBreakIterator.set(i18n::BreakIterator::create(xContext)); } - auto& rBreakIterator = *mxBreakIterator.get()->get(); + auto& rBreakIterator = *gxBreakIterator.get()->get(); const OUString& rTxt = rTextCandidate.getText(); const sal_Int32 nTextLength(rTextCandidate.getTextLength()); // rTxt.getLength()); diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx index c315281ebf61..07e81b360cec 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx @@ -25,7 +25,7 @@ #include #include #include // vcl::PDFExtOutDevData support -#include +#include class GDIMetaFile; namespace tools @@ -171,13 +171,6 @@ private: */ double mfCurrentUnifiedTransparence; - /* break iterator support - made static so it only needs to be fetched once, even with many single - constructed VclMetafileProcessor2D. It's still incarnated on demand, - but exists for OOo runtime now by purpose. - */ - static vcl::DeleteOnDeinit> mxBreakIterator; - /* vcl::PDFExtOutDevData support For the first step, some extra actions at vcl::PDFExtOutDevData need to be emulated with the VclMetafileProcessor2D. These are potentially temporarily diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 7feff6e8e6e0..fec2c8cd3c99 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -67,7 +67,7 @@ #include #include #include -#include +#include #include #include #include @@ -1714,7 +1714,7 @@ rtl::Reference EditEngine::CreatePool() SfxItemPool& EditEngine::GetGlobalItemPool() { - static vcl::DeleteOnDeinit> pGlobalPool(CreatePool()); + static tools::DeleteOnDeinit> pGlobalPool(CreatePool()); return **pGlobalPool.get(); } diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx index 4392022b77a3..f1bfa4e773ac 100644 --- a/editeng/source/editeng/editobj2.hxx +++ b/editeng/source/editeng/editobj2.hxx @@ -55,6 +55,7 @@ public: XEditAttribute(SfxItemPool&, const SfxPoolItem&, sal_Int32 nStart, sal_Int32 nEnd ); const SfxPoolItem* GetItem() const { return maItemHolder.getItem(); } + SfxPoolItemHolder& GetItemHolder() { return maItemHolder; } sal_Int32& GetStart() { return nStart; } sal_Int32& GetEnd() { return nEnd; } diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index 732c85ee18cd..9bc101646c7e 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -65,7 +65,7 @@ #include #include #include -#include +#include #include #include @@ -78,7 +78,7 @@ EditDLL& EditDLL::Get() Previously this data was function-static, but then data in i18npool would be torn down before the destructor here ran, causing a crash. */ - static vcl::DeleteOnDeinit< EditDLL > gaEditDll; + static tools::DeleteOnDeinit< EditDLL > gaEditDll; return *gaEditDll.get(); } @@ -157,7 +157,7 @@ ItemInfoPackage& getItemInfoPackageEditEngine() { EE_FEATURE_TAB, new SfxVoidItem( EE_FEATURE_TAB ), 0, SFX_ITEMINFOFLAG_NONE }, { EE_FEATURE_LINEBR, new SfxVoidItem( EE_FEATURE_LINEBR ), 0, SFX_ITEMINFOFLAG_NONE }, { EE_FEATURE_NOTCONV, new SvxColorItem( COL_RED, EE_FEATURE_NOTCONV ), SID_ATTR_CHAR_CHARSETCOLOR, SFX_ITEMINFOFLAG_NONE }, - { EE_FEATURE_FIELD, new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD ), SID_FIELD, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE } + { EE_FEATURE_FIELD, new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD ), SID_FIELD, SFX_ITEMINFOFLAG_NONE } }}; virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; } diff --git a/editeng/source/editeng/fieldupdater.cxx b/editeng/source/editeng/fieldupdater.cxx index 05eca4575590..6d6fbfb28c3c 100644 --- a/editeng/source/editeng/fieldupdater.cxx +++ b/editeng/source/editeng/fieldupdater.cxx @@ -18,6 +18,22 @@ using namespace com::sun::star; namespace editeng { +SvxFieldItemUpdater::~SvxFieldItemUpdater() {} + +namespace { +class SvxFieldItemUpdaterImpl : public SvxFieldItemUpdater +{ + SfxPoolItemHolder& mrItemHolder; +public: + SvxFieldItemUpdaterImpl(SfxPoolItemHolder& rHolder) : mrItemHolder(rHolder) {} + + virtual void SetItem(const SvxFieldItem& rNewItem) + { + mrItemHolder = SfxPoolItemHolder(mrItemHolder.getPool(), &rNewItem, false); + } +}; +} + class FieldUpdaterImpl { EditTextObjectImpl& mrObj; @@ -51,6 +67,24 @@ public: } } } + + void UpdatePageRelativeURLs(const std::function& rItemCallback) + { + EditTextObjectImpl::ContentInfosType& rContents = mrObj.GetContents(); + for (std::unique_ptr & i : rContents) + { + ContentInfo& rContent = *i; + for (XEditAttribute & rAttr : rContent.GetCharAttribs()) + { + const SfxPoolItem* pItem = rAttr.GetItem(); + if (pItem->Which() != EE_FEATURE_FIELD) + // This is not a field item. + continue; + SvxFieldItemUpdaterImpl aUpdater(rAttr.GetItemHolder()); + rItemCallback(static_cast(*pItem), aUpdater); + } + } + } }; FieldUpdater::FieldUpdater(EditTextObject& rObj) : mpImpl(new FieldUpdaterImpl(rObj)) {} @@ -65,6 +99,11 @@ void FieldUpdater::updateTableFields(int nTab) mpImpl->updateTableFields(nTab); } +void FieldUpdater::UpdatePageRelativeURLs(const std::function& rItemCallback) +{ + mpImpl->UpdatePageRelativeURLs(rItemCallback); +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 11ed1ac8e77f..6dd01d1d349e 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -937,11 +937,10 @@ bool ImpEditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView } default: // is then possible edited below. - eFunc = KeyFuncType::DONTKNOW; + break; } } - if ( eFunc == KeyFuncType::DONTKNOW ) { switch ( nCode ) { diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx index 67c3dc28e64a..8e3684606cfb 100644 --- a/editeng/source/misc/splwrap.cxx +++ b/editeng/source/misc/splwrap.cxx @@ -394,7 +394,7 @@ Reference< XDictionary > SvxSpellWrapper::GetAllRightDic() Reference< frame::XStorable > xStor( xTmp, UNO_QUERY ); if (xStor.is() && xStor->hasLocation() && !xStor->isReadonly()) { - xDic = xTmp; + xDic = std::move(xTmp); } } } diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index 4cf67b9e2f20..bb256e0bba60 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -659,7 +659,7 @@ uno::Reference< XDictionary > LinguMgr::GetStandard() xTmpDicList->addDictionary( xTmp ); xTmp->setActive( true ); } - xDic = xTmp; + xDic = std::move(xTmp); } #if OSL_DEBUG_LEVEL > 1 uno::Reference< XStorable > xStor( xDic, UNO_QUERY ); diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index e474647450e9..cc2eb9b6367c 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -801,6 +801,8 @@ uno::Sequence< OUString > SAL_CALL SvxUnoTextField::getSupportedServiceNames() switch (mnServiceId) { case text::textfield::Type::DATE: + case text::textfield::Type::TIME: + case text::textfield::Type::EXTENDED_TIME: pServices[2] = "com.sun.star.text.TextField.DateTime"; pServices[3] = "com.sun.star.text.textfield.DateTime"; break; @@ -816,10 +818,6 @@ uno::Sequence< OUString > SAL_CALL SvxUnoTextField::getSupportedServiceNames() pServices[2] = "com.sun.star.text.TextField.PageCount"; pServices[3] = "com.sun.star.text.textfield.PageCount"; break; - case text::textfield::Type::TIME: - pServices[2] = "com.sun.star.text.TextField.DateTime"; - pServices[3] = "com.sun.star.text.textfield.DateTime"; - break; case text::textfield::Type::DOCINFO_TITLE: pServices[2] = "com.sun.star.text.TextField.docinfo.Title"; pServices[3] = "com.sun.star.text.textfield.docinfo.Title"; @@ -828,10 +826,6 @@ uno::Sequence< OUString > SAL_CALL SvxUnoTextField::getSupportedServiceNames() pServices[2] = "com.sun.star.text.TextField.SheetName"; pServices[3] = "com.sun.star.text.textfield.SheetName"; break; - case text::textfield::Type::EXTENDED_TIME: - pServices[2] = "com.sun.star.text.TextField.DateTime"; - pServices[3] = "com.sun.star.text.textfield.DateTime"; - break; case text::textfield::Type::EXTENDED_FILE: pServices[2] = "com.sun.star.text.TextField.FileName"; pServices[3] = "com.sun.star.text.textfield.FileName"; diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index c72d788e3d04..15ad2ea51e89 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -1431,7 +1431,7 @@ void SAL_CALL OCommonEmbeddedObject::storeAsEntry( const uno::Reference< embed:: } m_bWaitSaveCompleted = true; - m_xNewObjectStorage = xSubStorage; + m_xNewObjectStorage = std::move(xSubStorage); m_xNewParentStorage = xStorage; m_aNewEntryName = sEntName; m_aNewDocMediaDescriptor = GetValuableArgs_Impl( lArguments, true ); diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index ca91d964bc11..eddc8a47ca0f 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -411,7 +411,7 @@ bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >& xPar xHatchWindow->setController( uno::Reference< embed::XHatchWindowController >( static_cast< embed::XHatchWindowController* >( this ) ) ); - xMyParent = xHatchWinPeer; + xMyParent = std::move(xHatchWinPeer); } else { @@ -453,8 +453,8 @@ bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >& xPar // the call will create, initialize the frame, and register it in the parent m_xFrame.set( xFrameFact->createInstanceWithArguments( aArgs ), uno::UNO_QUERY_THROW ); - m_xHatchWindow = xHWindow; - m_xOwnWindow = xOwnWindow; + m_xHatchWindow = std::move(xHWindow); + m_xOwnWindow = std::move(xOwnWindow); if ( !SetFrameLMVisibility( m_xFrame, false ) ) { diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx index 062ceb4adcf5..bb65e627d9e6 100644 --- a/embeddedobj/source/msole/olepersist.cxx +++ b/embeddedobj/source/msole/olepersist.cxx @@ -1241,7 +1241,7 @@ void OleEmbeddedObject::StoreToLocation_Impl( if ( bSaveAs ) { m_bWaitSaveCompleted = true; - m_xNewObjectStream = xTargetStream; + m_xNewObjectStream = std::move(xTargetStream); m_xNewParentStorage = xStorage; m_aNewEntryName = sEntName; m_bNewVisReplInStream = bStoreVis; @@ -1252,7 +1252,7 @@ void OleEmbeddedObject::StoreToLocation_Impl( if ( bNeedLocalCache ) m_xNewCachedVisRepl = GetNewFilledTempStream_Impl( xCachedVisualRepresentation->getInputStream() ); else - m_xNewCachedVisRepl = xCachedVisualRepresentation; + m_xNewCachedVisRepl = std::move(xCachedVisualRepresentation); } // TODO: register listeners for storages above, in case they are disposed diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx index d462f41a23d7..b9443998e4aa 100644 --- a/embeddedobj/source/msole/ownview.cxx +++ b/embeddedobj/source/msole/ownview.cxx @@ -142,7 +142,7 @@ bool OwnView_Impl::CreateModelFromURL( const OUString& aFileURL ) xCloseable->addCloseListener( uno::Reference< util::XCloseListener >(this) ); ::osl::MutexGuard aGuard( m_aMutex ); - m_xModel = xModel; + m_xModel = std::move(xModel); bResult = true; } } diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx index 77f94b71600c..fb65c997187a 100644 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ b/extensions/source/abpilot/datasourcehandling.cxx @@ -118,7 +118,7 @@ namespace abp if (xContext.is()) { // xDynamicContext->registerObject( _rName, xNewDataSource ); - _rxNewDataSource = xNewDataSource; + _rxNewDataSource = std::move(xNewDataSource); } } diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index 4b08658c5cf5..9293f6add16c 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -340,7 +340,7 @@ namespace dbp { DBG_ASSERT(xPage.is(), "OControlWizard::implDeterminePage: can't determine the page (no model)!"); } - m_aContext.xDrawPage = xPage; + m_aContext.xDrawPage = std::move(xPage); } catch(const Exception&) { diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 9933ce2f9dce..86acd8a1e483 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -225,7 +225,7 @@ namespace pcr if( xStringResourceResolver.is() && xStringResourceResolver->getLocales().hasElements() ) { - xRet = xStringResourceResolver; + xRet = std::move(xStringResourceResolver); } } catch(const UnknownPropertyException&) diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index fc91e007ae36..1abc97c962f5 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -310,7 +310,7 @@ namespace pcr m_xComponent.set( xIntrospectionAccess->queryAdapter( cppu::UnoType::get() ), UNO_QUERY_THROW ); // now that we survived so far, remember m_xComponentIntrospectionAccess - m_xComponentIntrospectionAccess = xIntrospectionAccess; + m_xComponentIntrospectionAccess = std::move(xIntrospectionAccess); m_xPropertyState.set(m_xComponent, css::uno::UNO_QUERY); m_bPropertyMapInitialized = false; diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx index bd6ba2af7407..cdedd0897e5d 100644 --- a/extensions/source/propctrlr/propertyhandler.cxx +++ b/extensions/source/propctrlr/propertyhandler.cxx @@ -85,7 +85,7 @@ namespace pcr OSL_ENSURE( m_aPropertyListeners.getLength() == 0, "PropertyHandler::inspect: derived classes are expected to forward the removePropertyChangeListener call to their base class (me)!" ); // remember the new component, and give derived classes the chance to react on it - m_xComponent = xNewComponent; + m_xComponent = std::move(xNewComponent); onNewComponent(); // add the listeners, again diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index 1579e69c4e70..7f26c06e4555 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -804,7 +804,7 @@ bool UpdateHandler::showWarning( const OUString &rWarningText ) const aDescriptor.Type = awt::WindowClass_MODALTOP; aDescriptor.WindowServiceName = "warningbox"; aDescriptor.ParentIndex = -1; - aDescriptor.Parent = xPeer; + aDescriptor.Parent = std::move(xPeer); aDescriptor.Bounds = awt::Rectangle( 10, 10, 250, 150 ); aDescriptor.WindowAttributes = nWindowAttributes; @@ -853,7 +853,7 @@ bool UpdateHandler::showWarning( const OUString &rWarningText, aDescriptor.Type = awt::WindowClass_MODALTOP; aDescriptor.WindowServiceName = "warningbox"; aDescriptor.ParentIndex = -1; - aDescriptor.Parent = xPeer; + aDescriptor.Parent = std::move(xPeer); aDescriptor.Bounds = awt::Rectangle( 10, 10, 250, 150 ); aDescriptor.WindowAttributes = nWindowAttributes; diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index 2bd7d08ea08e..118cf0316481 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -207,7 +207,7 @@ void UpdateCheckUI::setPropertyValue(const OUString& rPropertyName, rValue >>= aJob; if ( !aJob.is() ) throw lang::IllegalArgumentException(); - mrJob = aJob; + mrJob = std::move(aJob); } else if (rPropertyName == PROPERTY_SHOW_MENUICON ) { bool bShowMenuIcon = false; diff --git a/external/libvisio/UnpackedTarball_libvisio.mk b/external/libvisio/UnpackedTarball_libvisio.mk index b5f530fb2763..b4a3d912ef63 100644 --- a/external/libvisio/UnpackedTarball_libvisio.mk +++ b/external/libvisio/UnpackedTarball_libvisio.mk @@ -15,9 +15,4 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,libvisio,0)) $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libvisio)) -$(eval $(call gb_UnpackedTarball_add_patches,libvisio, \ - external/libvisio/ubsan.patch \ - external/libvisio/solid-fill-style.patch \ -)) - # vim: set noet sw=4 ts=4: diff --git a/external/libvisio/solid-fill-style.patch b/external/libvisio/solid-fill-style.patch deleted file mode 100644 index 53dc6a405e71..000000000000 --- a/external/libvisio/solid-fill-style.patch +++ /dev/null @@ -1,198 +0,0 @@ ---- src/lib/VSDStyles.h -+++ src/lib/VSDStyles.h -@@ -179,14 +177,13 @@ struct VSDFillStyle - ASSIGN_OPTIONAL(style.qsFillMatrix, qsFillMatrix); - if (theme) - { -- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) -- ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), fgColour); -- -- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) -- ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), bgColour); -- -- if (!!style.qsShadowColour && style.qsShadowColour.get() >= 0) -- ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.get()), shadowFgColour); -+ // Quick Style Colour 100 is special. It is the default, -+ // and it is not saved explicitely in the VSDX file. -+ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), fgColour); -+ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), bgColour); -+ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.value_or(100)), shadowFgColour); -+ if (!!style.qsFillMatrix && style.qsFillMatrix.get() >= 0) -+ ASSIGN_OPTIONAL(theme->getFillStyleColour(style.qsFillMatrix.get()), fgColour); - } - ASSIGN_OPTIONAL(style.fgColour, fgColour); - ASSIGN_OPTIONAL(style.bgColour, bgColour); ---- src/lib/VSDXTheme.cpp -+++ src/lib/VSDXTheme.cpp -@@ -63,7 +63,8 @@ libvisio::VSDXFontScheme::VSDXFontScheme() - - libvisio::VSDXTheme::VSDXTheme() - : m_clrScheme(), -- m_fontScheme() -+ m_fontScheme(), -+ m_fillStyleLst(std::vector>(6)) - { - } - -@@ -102,6 +103,9 @@ bool libvisio::VSDXTheme::parse(librevenge::RVNGInputStream *input) - case XML_A_FONTSCHEME: - readFontScheme(reader.get()); - break; -+ case XML_A_FMTSCHEME: -+ readFmtScheme(reader.get()); -+ break; - default: - break; - } -@@ -320,7 +324,7 @@ void libvisio::VSDXTheme::readClrScheme(xmlTextReaderPtr reader) - while ((XML_A_CLRSCHEME != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); - } - --void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr) -+bool libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr) - { - int ret = 1; - int tokenId = XML_TOKEN_INVALID; -@@ -350,7 +354,11 @@ void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, - while ((idToken != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); - - if (colour) -+ { - clr = *colour; -+ return true; -+ } -+ return false; - } - - void libvisio::VSDXTheme::readVariationClrSchemeLst(xmlTextReaderPtr reader) -@@ -491,4 +499,96 @@ boost::optional libvisio::VSDXTheme::getThemeColour(unsigned v - return boost::optional(); - } - -+void libvisio::VSDXTheme::readFmtScheme(xmlTextReaderPtr reader) -+{ -+ VSD_DEBUG_MSG(("VSDXTheme::readFmtScheme\n")); -+ int ret = 1; -+ int tokenId = XML_TOKEN_INVALID; -+ int tokenType = -1; -+ do -+ { -+ ret = xmlTextReaderRead(reader); -+ tokenId = getElementToken(reader); -+ if (XML_TOKEN_INVALID == tokenId) -+ { -+ VSD_DEBUG_MSG(("VSDXTheme::readFmtScheme: unknown token %s\n", xmlTextReaderConstName(reader))); -+ } -+ tokenType = xmlTextReaderNodeType(reader); -+ switch (tokenId) -+ { -+ case XML_A_FILLSTYLELST: -+ { -+ readFillStyleLst(reader); -+ break; -+ } -+ default: -+ // Other style lists not implemented -+ break; -+ } -+ } while ((XML_A_FMTSCHEME != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); -+} -+ -+void libvisio::VSDXTheme::skipUnimplemented(xmlTextReaderPtr reader, int idToken) -+{ -+ int ret = 1; -+ int tokenId = XML_TOKEN_INVALID; -+ int tokenType = -1; -+ do -+ { -+ ret = xmlTextReaderRead(reader); -+ tokenId = getElementToken(reader); -+ if (XML_TOKEN_INVALID == tokenId) -+ { -+ VSD_DEBUG_MSG(("VSDXTheme::skipUnimplemented: unknown token %s\n", xmlTextReaderConstName(reader))); -+ } -+ tokenType = xmlTextReaderNodeType(reader); -+ } while ((idToken != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); -+} -+ -+void libvisio::VSDXTheme::readFillStyleLst(xmlTextReaderPtr reader) -+{ -+ VSD_DEBUG_MSG(("VSDXTheme::readFillStyleLst\n")); -+ int ret = xmlTextReaderRead(reader); -+ int tokenId = getElementToken(reader); -+ if (XML_TOKEN_INVALID == tokenId) -+ { -+ VSD_DEBUG_MSG(("VSDXTheme::readFillStyleLst: unknown token %s\n", xmlTextReaderConstName(reader))); -+ } -+ int tokenType = xmlTextReaderNodeType(reader); -+ int i = 0; -+ while ((XML_A_FILLSTYLELST != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret) -+ { -+ switch (tokenId) -+ { -+ case XML_A_SOLIDFILL: -+ { -+ Colour colour; -+ if (readThemeColour(reader, tokenId, colour)) -+ { -+ m_fillStyleLst[i] = colour; -+ } -+ break; -+ } -+ default: -+ // Skip unimplemented fill type -+ skipUnimplemented(reader, tokenId); -+ break; -+ } -+ ret = xmlTextReaderRead(reader); -+ tokenId = getElementToken(reader); -+ if (XML_TOKEN_INVALID == tokenId) -+ { -+ VSD_DEBUG_MSG(("VSDXTheme::readFillStyleLst: unknown token %s\n", xmlTextReaderConstName(reader))); -+ } -+ tokenType = xmlTextReaderNodeType(reader); -+ } -+} -+ -+boost::optional libvisio::VSDXTheme::getFillStyleColour(unsigned value) const -+{ -+ if (value == 0 || value > m_fillStyleLst.size()) -+ return boost::optional(); -+ return m_fillStyleLst[value - 1]; -+} -+ - /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ ---- src/lib/VSDXTheme.h -+++ src/lib/VSDXTheme.h -@@ -80,6 +80,7 @@ public: - ~VSDXTheme(); - bool parse(librevenge::RVNGInputStream *input); - boost::optional getThemeColour(unsigned value, unsigned variationIndex = 0) const; -+ boost::optional getFillStyleColour(unsigned value) const; - - private: - VSDXTheme(const VSDXTheme &); -@@ -89,18 +90,22 @@ private: - boost::optional readSysClr(xmlTextReaderPtr reader); - - void readClrScheme(xmlTextReaderPtr reader); -- void readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr); -+ bool readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr); - void readVariationClrSchemeLst(xmlTextReaderPtr reader); - void readVariationClrScheme(xmlTextReaderPtr reader, VSDXVariationClrScheme &varClrSch); - void readFontScheme(xmlTextReaderPtr reader); - void readFont(xmlTextReaderPtr reader, int idToken, VSDXFont &font); - bool readTypeFace(xmlTextReaderPtr reader, librevenge::RVNGString &typeFace); - bool readTypeFace(xmlTextReaderPtr reader, int &script, librevenge::RVNGString &typeFace); -+ void readFmtScheme(xmlTextReaderPtr reader); -+ void readFillStyleLst(xmlTextReaderPtr reader); - - int getElementToken(xmlTextReaderPtr reader); -+ void skipUnimplemented(xmlTextReaderPtr reader, int idToken); - - VSDXClrScheme m_clrScheme; - VSDXFontScheme m_fontScheme; -+ std::vector> m_fillStyleLst; - }; - - } // namespace libvisio diff --git a/external/libvisio/ubsan.patch b/external/libvisio/ubsan.patch deleted file mode 100644 index c9ffbd98f4b6..000000000000 --- a/external/libvisio/ubsan.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- src/lib/VSDContentCollector.cpp -+++ src/lib/VSDContentCollector.cpp -@@ -3220,7 +3220,7 @@ - } - if (U_SUCCESS(status) && conv) - { -- const auto *src = (const char *)&characters[0]; -+ const auto *src = (const char *)characters.data(); - const char *srcLimit = (const char *)src + characters.size(); - while (src < srcLimit) - { diff --git a/filter/qa/data/ca.pem b/filter/qa/data/ca.pem new file mode 100644 index 000000000000..d08c9c67bcae --- /dev/null +++ b/filter/qa/data/ca.pem @@ -0,0 +1,70 @@ +-----BEGIN CERTIFICATE----- +MIIGADCCA+igAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgYsxCzAJBgNVBAYTAlVL +MRAwDgYDVQQIDAdFbmdsYW5kMTAwLgYDVQQKDCdDcHB1bml0VGVzdF94bWxzZWN1 +cml0eV94bWxzZWMgUlNBIFRlc3QxODA2BgNVBAMML0NwcHVuaXRUZXN0X3htbHNl +Y3VyaXR5X3htbHNlYyBSU0EgVGVzdCBSb290IENBMCAXDTI0MDkyMzEzMzA0MloY +DzIxMjQwODMwMTMzMDQyWjCBjzELMAkGA1UEBhMCVUsxEDAOBgNVBAgMB0VuZ2xh +bmQxMDAuBgNVBAoMJ0NwcHVuaXRUZXN0X3htbHNlY3VyaXR5X3htbHNlYyBSU0Eg +VGVzdDE8MDoGA1UEAwwzQ3BwdW5pdFRlc3RfeG1sc2VjdXJpdHlfeG1sc2VjIElu +dGVybWVkaWF0ZSBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKC +AgEAj9kribqN994fmGGnL7l3Y4DEVEBUBV2kNlq9fM9wJmOEtaNyKIjYxzCFUAnt +vKp0youu3tu48duDUez4I+Nc4gyez6IlyfPCXiEJulo0g6F3WZZg/xtk56JZnHFe +aBHq3vm3L7a5y8c9j9Y26/BPRAqY1CtBSFUWV1uGPCQkNGNsO7qqtOdcKn7dFJq3 +K2sRaXp4J3QUhtlsEQ4/sWtXjuV7f4wqep0PEjFJ8oF6Jao5QYFHuLx4YZmo9vfX +NSjv1TJbdQ+1zvw8sr3/SYyNt3B7Q3jXq8IC+Tfc1R9t/FaDeS9AiMuDJgq+aHWV +ej8sspl2+d7mFXCuOoy9nE9aCWAwD1v6Ce1nK97qVUKRKxBxlKSM3TULWaJT8VC9 +UK0nsfK9OocCeybOa+irzVcgvVDlD8fPoM82bGAaA5z2SvSyrjk5/h2aHtG9U1tJ +ke6GwxzyVlIySo4EC9SvW8Pu3v0vaHAeDAjUnA8aEPGmuKOMHsYq/Jgy3hkRLKuX +iRENrshP/q0Vfso2NtfErSzqcBV5UWcYUhoCOiQXRo2Q9sy7lJDtRU5yFxlGtqRU +ORY1LI9NMXi5pJioZftPZIMPJeDLeaEaNHD1vH9i/e/bN11/mYzM2SWuKdQbiYFX +pZO8gDkp960R1VG3O0TKz7U678ZrjY0Y3t0uNhPFEOZgoCkCAwEAAaNmMGQwHQYD +VR0OBBYEFFE6wan2eGv91MRbH6vbE4W3cMYNMB8GA1UdIwQYMBaAFOJn33YP7tq0 +45qRr2pHFpbwKe+7MBIGA1UdEwEB/wQIMAYBAf8CAQAwDgYDVR0PAQH/BAQDAgGG +MA0GCSqGSIb3DQEBCwUAA4ICAQAeNJClgszw5HQysHfoDe8YClRt9NI4b2obxRXY +FGX4TgLNcXGBctOoB0B/kLK6TXSPNJqHQ2+cjm1Ol9vEr4iTuRDRBp1UPp6DycLO +9moTnlw6IKj4Nq+OJ4NVPAl0FED2KWKW9fKHOSn2kqJ7Vf4owAGf3fSy6opeqLxg +GlnwmDSuevdbiKUCTOL4XwAfl1YN7Jj+4lEKSQmJB786MUvb9YzCPXEBDPg0uN8w +Jm/ToiKhN53rpXLToYAidJBJ1TyqKb0i9ohETrgiBHgLI5evd+5YrhEjkKdSsK4T +qiodkiUb5UIEcw21D5M/kjimKQrOKWahOKZCjh3xkkRsJyaeoBetZyW79d6JvB5j +sifp86HQPtohHo8XM6cEXhhQhwAbIoiD4JPoTtQefTvpBCVlh2RIMYgeSKSq/y3E +aoWEt8OinvZw+JhJbK7oNNPsglIJtax8Jqdc3C4PTFrIA1PnWmr/+EbdMcwnYJjn +uyUlSajOmTL50XBHJ4krgNTOCjS42obZ4/W7Z/INVhthqIy33fEq8CKaKKytCjDN +wkZ6dqmMg/9+X/+ClWlr+Q7EPCUw5aW6Qc95aEv59kgct84wxqTQ2jaGuUv2DxNV ++hy8bsFGwPYc6yqbVm+Eu2ibyw+QV3jYJ3t6HdVJGntgRjeumRB/XuhwVwPaIijp +jZWvGw== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIGCzCCA/OgAwIBAgIUf0E/LAmzIuu4Y81pnWRf+XARWkowDQYJKoZIhvcNAQEL +BQAwgYsxCzAJBgNVBAYTAlVLMRAwDgYDVQQIDAdFbmdsYW5kMTAwLgYDVQQKDCdD +cHB1bml0VGVzdF94bWxzZWN1cml0eV94bWxzZWMgUlNBIFRlc3QxODA2BgNVBAMM +L0NwcHVuaXRUZXN0X3htbHNlY3VyaXR5X3htbHNlYyBSU0EgVGVzdCBSb290IENB +MCAXDTI0MDkyMzEzMzA0MVoYDzIxMjQwODMwMTMzMDQxWjCBizELMAkGA1UEBhMC +VUsxEDAOBgNVBAgMB0VuZ2xhbmQxMDAuBgNVBAoMJ0NwcHVuaXRUZXN0X3htbHNl +Y3VyaXR5X3htbHNlYyBSU0EgVGVzdDE4MDYGA1UEAwwvQ3BwdW5pdFRlc3RfeG1s +c2VjdXJpdHlfeG1sc2VjIFJTQSBUZXN0IFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQDICUjHlgDCX741a9qvNgs2ba7nxLwb350hNzu7JbrP +8R4NUpTgbJwbsxdqPPozXQP2Uos/F5zdLk7ZA5e7tH/sa7ZPbeL6LzSiMvR+Cl4T +DKisr+C/3ASd3d78kLw0UPNpRyVLirxKT9ht10GYBLAgV9kUtQ9lLejOpHDtRq1q +8TlX0c3N6tw4T7PWq52Hym4XaTtxJc1g7CHddg4CqsTVXf4HdooMVH5AECD52Uv7 +hjEQgY+hrNEQE7lN6gp3HtxANbZusL4N0kSXAH1N6A1JDw+V0Cd020CUxCOWN/SV +gX9rV67t+ACbObRNLlSkiGQyaPd2UTlMa1zQbpPQuvxsmtBbh50gIlM5qYuCPT+X +aI93IbGMRp8be7J2QU2T5nrb0wasVKVzaYcIs/fOBi+EL2t+Jd9a8IPrUkHVdcsx +WW8Y/WA95s+G4M0/5uVWmaeraBJRUo/suu08v4w0ShGBlVdfPe5iTMQWVLmAAZ16 +icvcgtdCr7nyi3tl2Bv/VFNqi+T7lqyL1i+91sr2Stca4wfRmqE0KiU5npFjxkh4 +sbzpuZAfjCvF3ltIZ9TFlmxQ2edf95CrPfw8u0MjEh2sWflgZwzSAdThEyMEIty4 +ZomCqqJ76Fw2kJwMq++9uTJTVXsepqA/jQg0WgK2Tyz3/2eY99twcldXVXuMc7Ge +AQIDAQABo2MwYTAdBgNVHQ4EFgQU4mffdg/u2rTjmpGvakcWlvAp77swHwYDVR0j +BBgwFoAU4mffdg/u2rTjmpGvakcWlvAp77swDwYDVR0TAQH/BAUwAwEB/zAOBgNV +HQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAC4errXBxYjJGtxT+5+VwISk +4ve5nGna8/SNxt7VB0mREG91gnsu3uJvW05zoU+UUOHaaDvAuox2GGEAq/vKJN5y +TpgnSYSgzFYxd8N+GqFqE3xwIPa02ntPwwLozF3aph4YcqrtCdPPNIXK5CRopnvQ +LuUHwFvmz/nkoCPg/VlwFjxNvwGehy5wrhd3zmqd9dga8k3MWA+cVVtNnZld5HZu +rpHOb3H7SCG+3l/kMdnMQCLvUrbKGSVKX6bOaW+FGm+oTTwLen/HHB21wxfPLySQ +QDEyR1qGNj7sKgGaWU8334boSSjW3OrnHDLlMBr/XQAMgvHfy43qxOmww47xg685 +HNQYtbHIgVLZ6ou8vgzrjzV+Wpu8H7by2HH/yAHwRqsy2nmVPwkrdmCfSwYfZdAW ++Jzazg4gYVnBE89t8HarOXSiSh/YUS0V6F4koQKVv3b8MzmqO3ldRW2JcktrmZmU +BYCh5UaK3X+Yyeus1UGrYCl6Yqj5M1JEmYmX/3EVeIcEK+H6Kx9Aeqr1WyJss0GT +KVA5t+mOZ+SSvF3mFLxTo6ydTLOWA63NGuiLnhU1lbQRkTC0Dq0qenECx2gmG8XG +FHlVbVsYqiaU6FdkFGzm+Scsl8UwygLV5KP0Y/54X8J6ZSRPHNRvBtRnZoRrjNFM +wSJZ4vw/iDJO03o31TJ3 +-----END CERTIFICATE----- diff --git a/filter/qa/data/cert.pem b/filter/qa/data/cert.pem new file mode 100644 index 000000000000..e5bd58abc2a0 --- /dev/null +++ b/filter/qa/data/cert.pem @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFZjCCA06gAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwgY8xCzAJBgNVBAYTAlVL +MRAwDgYDVQQIDAdFbmdsYW5kMTAwLgYDVQQKDCdDcHB1bml0VGVzdF94bWxzZWN1 +cml0eV94bWxzZWMgUlNBIFRlc3QxPDA6BgNVBAMMM0NwcHVuaXRUZXN0X3htbHNl +Y3VyaXR5X3htbHNlYyBJbnRlcm1lZGlhdGUgUm9vdCBDQTAgFw0yNDA5MjMxMzMw +NDJaGA8yMTI0MDgzMDEzMzA0MlowgZExCzAJBgNVBAYTAlVLMRAwDgYDVQQIDAdF +bmdsYW5kMTAwLgYDVQQKDCdDcHB1bml0VGVzdF94bWxzZWN1cml0eV94bWxzZWMg +UlNBIFRlc3QxPjA8BgNVBAMMNUNwcHVuaXRUZXN0X3htbHNlY3VyaXR5X3htbHNl +YyBSU0EgVGVzdCBleGFtcGxlIEFsaWNlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAlSfDFDdlDJv1YY6ANc3RuiGu3oduoDFFJL//l0j52J8btQRQrtp5 +P0OaplTYdLi1hK2cj/XV7KWB+E5p/IwgqNZdOXR+RY1jNkQFiSLdMbkwEoPtaPVh +DAxfSLyIazSsrERgGOBn6EbomVyc87UrVj6QgwzofDRmPtgOFBlDSfFiqIKfxU4T +lntLOnFiGLFGcVDSsRA/UQiy9o0bAfaS68IB7FpW9NoLTEgzGE/PzCFkGAmgC5yB +rvk8/tfCVsx8FeqdZqlBZhrD+sP+rItRRXdSiH52C+XMXqowNxJhPBP4HFv5LVQo +l9oXK5QXieYrFmMpwTJrkNdFXkm+2iJFAQIDAQABo4HFMIHCMAkGA1UdEwQCMAAw +EQYJYIZIAYb4QgEBBAQDAgWgMDMGCWCGSAGG+EIBDQQmFiRPcGVuU1NMIEdlbmVy +YXRlZCBDbGllbnQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFKcwU0F2IER917YAPm5S +FjaVtYHpMB8GA1UdIwQYMBaAFFE6wan2eGv91MRbH6vbE4W3cMYNMA4GA1UdDwEB +/wQEAwIF4DAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwQwDQYJKoZIhvcN +AQELBQADggIBABtgvYTKyfIZobgnsrO8PjbQIFdyx5YV0RJ8fshcSzSFSZYN0qbC +J4U2i84Hx9HvzzFtHHEgJ4ot6VXsfEGqFkf8dvafqi1gAQ4cbIazdHQoELgFKJwL +U5X/NGl0PQ46/l4vKHKrpAN1TRu7MGE0SwxRYM5KlzibXRL485ck/dzap8qSaxt/ +sSW6YxpttM3umPRL+5Mc+ttJBPYKAwfu/dHkBxGC47E/h2oazNOI2nhLsfbT2YmW +yJpgt/hnqxB7LtZbnAnaMVEWGdlBp79vU6V0+JSznMmc4t1eX6mUl5tXQF+BSmpw +f4agwi+uSE9WEXfhChjLfEtEGgK/+/tl012EqY8qt1SdwDDH8usEcrK2iyd14Wgs +uH3swGqYdBaHnNaAgtuMDlQmJYaq5cKbaTj+PGLr5WU9VIXFSIM03dkyGA13I3ts +cBpWfh3f89q6YoAqdgwUlCg1OqU4LsfS8n8EKvyM1+zb45JlNxzXpFp+/CwR7I2D +Tk4QXELeFOl1KU7X9eTftliwAqctRGLCvr2VXA4FbkFhtreCctCQm/FUgIr01YrW +mhr29Wwaz3DBeymbFXUdYQZqI0OSBBc1bDJkMHftpTBp79EoglKXqMb1/7jcV3bT +oWXfkHN//B4B2gpv7DxHyP7H6teW/hGuCZeIhYDiL0TR1E68RO1sHRT1 +-----END CERTIFICATE----- diff --git a/filter/qa/data/key.pem b/filter/qa/data/key.pem new file mode 100644 index 000000000000..6407bb9ab319 --- /dev/null +++ b/filter/qa/data/key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCVJ8MUN2UMm/Vh +joA1zdG6Ia7eh26gMUUkv/+XSPnYnxu1BFCu2nk/Q5qmVNh0uLWErZyP9dXspYH4 +Tmn8jCCo1l05dH5FjWM2RAWJIt0xuTASg+1o9WEMDF9IvIhrNKysRGAY4GfoRuiZ +XJzztStWPpCDDOh8NGY+2A4UGUNJ8WKogp/FThOWe0s6cWIYsUZxUNKxED9RCLL2 +jRsB9pLrwgHsWlb02gtMSDMYT8/MIWQYCaALnIGu+Tz+18JWzHwV6p1mqUFmGsP6 +w/6si1FFd1KIfnYL5cxeqjA3EmE8E/gcW/ktVCiX2hcrlBeJ5isWYynBMmuQ10Ve +Sb7aIkUBAgMBAAECggEAANSKkIWiWjAZnRSjRzdkTtN5ZAJd4toK24h+v+wIZV61 +e3n66C4BzHzGDP2wMbJB8wdZjZvmqCxLvGTk+EqUM4Xj0Xwp8DWUQCf3zhuYvrI4 +PbRkok3KO7w7dRvk7FA4A0aHOJi6TdbEFHdVbaIqK9L93FeicTdsQ7aRkZ46UZRu +YcOc//qIy4nD7O4UXaZoV/WKp2c9KJliED7QqnCGGUQpUsY5zvx6LQwWeXzrgCsT +am6Hi38/o66Ikel1aMACeq6lGmYqyqNIzHgihuyfcZKoMIYZrLQd2P6aC45H81DS +gQuMQVZBLDFoUX1ARAvvT8heNB38xPevQBo0uqOvAQKBgQDSdZogxv4c6quIY8xX +3Bf8H+FKD3v82B++c88IUMGKyqZUp7eJoqivKEWDd/vsxEg3SewnRV2OpYgP2ekz +seTzVPu877Kv+S/cZFlKYeKDovgCamWeDHR+PSasadk/7pG7izC3Khf9cdzWwgno +OJKJBKlRwMYAvBNwkK026nTRgQKBgQC1bjimwPjUdtogaIfRqR/9KcShavjMWayh +1QhH3oYoLIEuzIjd0S+zNSOe35fSslr2ss6NEu0yfERW1q/8HWl2TrNEp2oMn2FO +Mg6OkwhsTbjWbr/mHae4stXpNIPO8UbuxpNx5qGkmcdAgbOsQJ4m7BERrVQItDsv +mbNpo4gzgQKBgBVmb+21TlGSay7LNxQYBThV5YqqWGk1cMTk8cBetc9vG8qv4zHT +oGNvLOJZaPyCWPWGRsUXgJPosRUri1L+W9GCarajiP/rzroSWiH+IhJQl/dm6j5P +9eiAP1Z4zOZ7U8ZGOQXm+dmDonkT8f3zArN8DduKRpf8h92CWJqk7IwBAoGAa7m7 +V3/i/zxmvbFzW5DhFo+zWejLO4LPVvPHy+ybmcT7G0+EwLhRa0XVFaNLYWZXTn3S +2L7xKfXRGgK1UawhD4chOFVzSXVk8GoWbJ9u8+eeJWxy8u6OxMMi8iolTT3D0UkF +CS9YsQRB49JfXZqsjQ3EAMv6xoRFVDkd506bM4ECgYBPN8B6QpENSsVoVGcS/gpR +hLno9fIvIhABCDoYNTkNT6ILJ8BcU7+lv/zs8UQacqf6Fy7JozbBeEY/Dxr97DKg +e5djZvWYLqmvAiPilN5YEt5WvuswzrGaTcol/E3X5B3aACFFE8+O9i8T2q0VlAot +hC+h7nh0KmPyzL73JUX2Jg== +-----END PRIVATE KEY----- diff --git a/filter/qa/pdf.cxx b/filter/qa/pdf.cxx index d9dfc4ef17dd..293d79a46368 100644 --- a/filter/qa/pdf.cxx +++ b/filter/qa/pdf.cxx @@ -372,6 +372,66 @@ CPPUNIT_TEST_FIXTURE(Test, testWatermarkRotateAngle) // i.e. the rotation angle was 270 for an A4 page, not the requested 45 degrees. CPPUNIT_ASSERT_EQUAL(nExpectedRotateAngle, nActualRotateAngle); } + +#ifdef UNX +CPPUNIT_TEST_FIXTURE(Test, testSignCertificatePEM) +{ + // Given an empty document: + std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get(); + if (!pPDFium) + return; + + uno::Reference xSEInitializer + = xml::crypto::SEInitializer::create(m_xContext); + uno::Reference xSecurityContext + = xSEInitializer->createSecurityContext(OUString()); + uno::Reference xSecurityEnvironment + = xSecurityContext->getSecurityEnvironment(); + OUString aKeyPath = createFileURL(u"key.pem"); + SvFileStream aKeyStream(aKeyPath, StreamMode::READ); + OUString aKeyPem + = OUString::fromUtf8(read_uInt8s_ToOString(aKeyStream, aKeyStream.remainingSize())); + OUString aCertPath = createFileURL(u"cert.pem"); + SvFileStream aCertStream(aCertPath, StreamMode::READ); + OUString aCertPem + = OUString::fromUtf8(read_uInt8s_ToOString(aCertStream, aCertStream.remainingSize())); + OUString aCaPath = createFileURL(u"ca.pem"); + SvFileStream aCaStream(aCaPath, StreamMode::READ); + OUString aCaPem + = OUString::fromUtf8(read_uInt8s_ToOString(aCaStream, aCaStream.remainingSize())); + uno::Sequence aFilterData{ + comphelper::makePropertyValue("SignPDF", true), + comphelper::makePropertyValue("SignCertificateCertPem", aCertPem), + comphelper::makePropertyValue("SignCertificateKeyPem", aKeyPem), + comphelper::makePropertyValue("aSignCertificateCaPem", aCaPem), + }; + mxComponent.set(loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument")); + + // When exporting to PDF, and referring to a certificate using a cert/key/ca PEM, which is not + // in the NSS database: + uno::Reference xFactory = getMultiServiceFactory(); + uno::Reference xFilter( + xFactory->createInstance("com.sun.star.document.PDFFilter"), uno::UNO_QUERY); + uno::Reference xExporter(xFilter, uno::UNO_QUERY); + xExporter->setSourceDocument(mxComponent); + SvMemoryStream aStream; + uno::Reference xOutputStream(new utl::OStreamWrapper(aStream)); + uno::Sequence aDescriptor{ + comphelper::makePropertyValue("FilterName", OUString("writer_pdf_Export")), + comphelper::makePropertyValue("FilterData", aFilterData), + comphelper::makePropertyValue("OutputStream", xOutputStream), + }; + xFilter->filter(aDescriptor); + + // Then make sure the resulting PDF has a signature: + std::unique_ptr pPdfDocument + = pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), OString()); + // Without the accompanying fix in place, this test would have failed, as signing was enabled + // without configured certificate, so the whole export failed. + CPPUNIT_ASSERT(pPdfDocument); + CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getSignatureCount()); +} +#endif } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 2cc3cda31fb0..043f8bb2f0b3 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -698,12 +698,6 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) break; case EnhancedCustomShapeSegmentCommand::CURVETO : - { - nC--; - nPt += 3; - } - break; - case EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO : case EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE : { diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index d1705e9eb1cf..141f4fed9a20 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -1726,7 +1726,7 @@ bool PPTConvertOCXControls::InsertControl( { xControlShape->setControl( xControlModel ); if (pShape) - *pShape = xShape; + *pShape = std::move(xShape); bRetValue = true; } } diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 708891deab7d..470a53cc38c5 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include "pdfexport.hxx" #include @@ -526,6 +527,9 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& aContext.DocumentInfo.Creator = aCreator; OUString aSignCertificateSubjectName; + OUString aSignCertificateCertPem; + OUString aSignCertificateKeyPem; + OUString aSignCertificateCaPem; for ( const beans::PropertyValue& rProp : rFilterData ) { if ( rProp.Name == "PageRange" ) @@ -689,6 +693,12 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& rProp.Value >>= aSignCertificate; else if (rProp.Name == "SignCertificateSubjectName") rProp.Value >>= aSignCertificateSubjectName; + else if (rProp.Name == "SignCertificateCertPem") + rProp.Value >>= aSignCertificateCertPem; + else if (rProp.Name == "SignCertificateKeyPem") + rProp.Value >>= aSignCertificateKeyPem; + else if (rProp.Name == "SignCertificateCaPem") + rProp.Value >>= aSignCertificateCaPem; else if ( rProp.Name == "SignatureTSA" ) rProp.Value >>= sSignTSA; else if ( rProp.Name == "ExportPlaceholders" ) @@ -716,6 +726,24 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& aSignCertificate = GetCertificateFromSubjectName(aSignCertificateSubjectName); } + if (!aSignCertificate.is()) + { + // Still no signing certificate configured, see if we got a ca/cert/key in PEM + // format: + if (!aSignCertificateCaPem.isEmpty()) + { + std::string aSignatureCa(aSignCertificateCaPem.toUtf8()); + std::vector aCerts = SfxLokHelper::extractCertificates(aSignatureCa); + SfxLokHelper::addCertificates(aCerts); + } + if (!aSignCertificateCertPem.isEmpty() && !aSignCertificateKeyPem.isEmpty()) + { + std::string aSignatureCert(aSignCertificateCertPem.toUtf8()); + std::string aSignatureKey(aSignCertificateKeyPem.toUtf8()); + aSignCertificate = SfxLokHelper::getSigningCertificate(aSignatureCert, aSignatureKey); + } + } + aContext.URL = aURL.GetMainURL(INetURLObject::DecodeMechanism::ToIUri); // set the correct version, depending on user request @@ -969,7 +997,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& aContext.SignContact = sSignContact; aContext.SignReason = sSignReason; aContext.SignPassword = sSignPassword; - aContext.SignCertificate = aSignCertificate; + aContext.SignCertificate = std::move(aSignCertificate); aContext.SignTSA = sSignTSA; aContext.UseReferenceXObject = bUseReferenceXObject; diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 45f766dd1231..edf07421e956 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -646,7 +646,7 @@ Reference< XComponent > XMLFilterTestDialog::getFrontMostDocument( const OUStrin Reference< XComponent > xTest( mxLastFocusModel ); if( checkComponent( xTest, rServiceName ) ) { - xRet = xTest; + xRet = std::move(xTest); } else { @@ -654,7 +654,7 @@ Reference< XComponent > XMLFilterTestDialog::getFrontMostDocument( const OUStrin if( checkComponent( xTest, rServiceName ) ) { - xRet = xTest; + xRet = std::move(xTest); } else { diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 0c32492954b0..b36329283262 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -1747,7 +1747,7 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co throw css::lang::IllegalArgumentException(); } - m_xLabelControl = xAsPropSet; + m_xLabelControl = std::move(xAsPropSet); Reference xComp(m_xLabelControl, UNO_QUERY); if (xComp.is()) xComp->addEventListener(static_cast(static_cast(this))); diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx index 724c5a4a240b..6040549af736 100644 --- a/forms/source/component/Grid.cxx +++ b/forms/source/component/Grid.cxx @@ -284,7 +284,7 @@ sal_Bool SAL_CALL OGridControlModel::select(const Any& rElement) } if ( xSel != m_xSelection ) { - m_xSelection = xSel; + m_xSelection = std::move(xSel); aGuard.clear(); m_aSelectListeners.notifyEach( &XSelectionChangeListener::selectionChanged, EventObject( *this ) ); return true; diff --git a/forms/source/helper/controlfeatureinterception.cxx b/forms/source/helper/controlfeatureinterception.cxx index c83b61308395..924a1a0041fc 100644 --- a/forms/source/helper/controlfeatureinterception.cxx +++ b/forms/source/helper/controlfeatureinterception.cxx @@ -99,7 +99,7 @@ namespace frm break; } - xChainWalk = xSlave; + xChainWalk = std::move(xSlave); } } diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index c8653b153b3c..758cae8a1de4 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -748,7 +748,7 @@ void OInterfaceContainer::approveNewElement( const Reference< XPropertySet >& _r if ( _pElement ) { _pElement->xPropertySet = _rxObject; - _pElement->xChild = xChild; + _pElement->xChild = std::move(xChild); _pElement->aElementTypeInterface = aCorrectType; _pElement->xInterface = Reference< XInterface >( _rxObject, UNO_QUERY ); // normalized XInterface } diff --git a/forms/source/xforms/model.cxx b/forms/source/xforms/model.cxx index 04db24d1fb4c..105f7f449963 100644 --- a/forms/source/xforms/model.cxx +++ b/forms/source/xforms/model.cxx @@ -272,7 +272,7 @@ bool Model::setSimpleContent( const XNode_t& xConstNode, UNO_QUERY_THROW ); xNode->appendChild( xChild ); } - xNode = xChild; + xNode = std::move(xChild); OSL_ENSURE( xNode.is() && xNode->getNodeType() == NodeType_TEXT_NODE, diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx index 986ed951f9ea..8b14158aee6e 100644 --- a/framework/inc/uielement/menubarmanager.hxx +++ b/framework/inc/uielement/menubarmanager.hxx @@ -152,6 +152,7 @@ class MenuBarManager final : }; void RetrieveShortcuts( std::vector< std::unique_ptr >& aMenuShortCuts ); + void SetAcceleratorKeys(Menu* pMenu); static void FillMenuImages( css::uno::Reference< css::frame::XFrame > const & xFrame, Menu* _pMenu, bool bShowMenuImages ); static void impl_RetrieveShortcutsFromConfiguration( const css::uno::Reference< css::ui::XAcceleratorConfiguration >& rAccelCfg, const css::uno::Sequence< OUString >& rCommands, diff --git a/framework/source/accelerators/documentacceleratorconfiguration.cxx b/framework/source/accelerators/documentacceleratorconfiguration.cxx index 729136823d1d..48155a2f6408 100644 --- a/framework/source/accelerators/documentacceleratorconfiguration.cxx +++ b/framework/source/accelerators/documentacceleratorconfiguration.cxx @@ -97,7 +97,7 @@ DocumentAcceleratorConfiguration::DocumentAcceleratorConfiguration( css::uno::Reference xRoot; if (lArguments.getLength() == 1 && (lArguments[0] >>= xRoot)) { - m_xDocumentRoot = xRoot; + m_xDocumentRoot = std::move(xRoot); } else { diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx index bb4b8830d46a..3ab1b65abb87 100644 --- a/framework/source/accelerators/presethandler.cxx +++ b/framework/source/accelerators/presethandler.cxx @@ -427,9 +427,9 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType { SolarMutexGuard g; - m_xWorkingStorageShare = xShare; - m_xWorkingStorageNoLang= xNoLang; - m_xWorkingStorageUser = xUser; + m_xWorkingStorageShare = std::move(xShare); + m_xWorkingStorageNoLang= std::move(xNoLang); + m_xWorkingStorageUser = std::move(xUser); m_sRelPathShare = sRelPathShare; m_sRelPathUser = sRelPathUser; } diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index 5c1826fb8b4a..98aa117de13a 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -605,7 +605,7 @@ css::uno::Reference< css::frame::XFrame > CloseDispatcher::static_impl_searchRig return xTarget; // c1) check parent frame inside next loop ... - xTarget = xParent; + xTarget = std::move(xParent); } } diff --git a/framework/source/fwe/classes/framelistanalyzer.cxx b/framework/source/fwe/classes/framelistanalyzer.cxx index d524d23fdf2f..64f11a7674ed 100644 --- a/framework/source/fwe/classes/framelistanalyzer.cxx +++ b/framework/source/fwe/classes/framelistanalyzer.cxx @@ -230,12 +230,12 @@ void FrameListAnalyzer::impl_analyze() if (bHidden) { - m_lOtherHiddenFrames[nHiddenStep] = xFrame; + m_lOtherHiddenFrames[nHiddenStep] = std::move(xFrame); ++nHiddenStep; } else { - m_lOtherVisibleFrames[nVisibleStep] = xFrame; + m_lOtherVisibleFrames[nVisibleStep] = std::move(xFrame); ++nVisibleStep; } } diff --git a/framework/source/fwe/helper/propertysetcontainer.cxx b/framework/source/fwe/helper/propertysetcontainer.cxx index c766b40db56b..e2768f1cec64 100644 --- a/framework/source/fwe/helper/propertysetcontainer.cxx +++ b/framework/source/fwe/helper/propertysetcontainer.cxx @@ -126,7 +126,7 @@ void SAL_CALL PropertySetContainer::replaceByIndex( sal_Int32 Index, const css:: static_cast(this), 2 ); } - m_aPropertySetVector[ Index ] = aPropertySetElement; + m_aPropertySetVector[ Index ] = std::move(aPropertySetElement); } // XIndexAccess diff --git a/framework/source/fwe/xml/xmlnamespaces.cxx b/framework/source/fwe/xml/xmlnamespaces.cxx index c4fffaf89fe8..d8afe175a159 100644 --- a/framework/source/fwe/xml/xmlnamespaces.cxx +++ b/framework/source/fwe/xml/xmlnamespaces.cxx @@ -33,17 +33,15 @@ void XMLNamespaces::addNamespace( const OUString& aName, const OUString& aValue OUString aNamespaceName( aName ); // delete preceding "xmlns" - constexpr char aXMLAttributeNamespace[] = "xmlns"; - if ( aNamespaceName.startsWith( aXMLAttributeNamespace ) ) + if (std::u16string_view rest; aNamespaceName.startsWith("xmlns", &rest)) { - constexpr sal_Int32 nXMLNamespaceLength = RTL_CONSTASCII_LENGTH(aXMLAttributeNamespace); - if ( aNamespaceName.getLength() == nXMLNamespaceLength ) + if (rest.empty()) { aNamespaceName.clear(); } - else if ( aNamespaceName.getLength() >= nXMLNamespaceLength+2 ) + else if (rest.size() > 1) { - aNamespaceName = aNamespaceName.copy( nXMLNamespaceLength+1 ); + aNamespaceName = rest.substr(1); } else { diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index a2a91e6f32fe..b4b1366554d7 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -319,7 +319,7 @@ void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed() if (xFrame.is()) xParentWindow = xFrame->getContainerWindow(); else - xParentWindow = xPluggWindow; + xParentWindow = std::move(xPluggWindow); // don't disturb user in case he put the loading document into the background! // Suppress any setVisible() or toFront() call in case the initial show was @@ -436,7 +436,7 @@ void StatusIndicatorFactory::impl_createProgress() } std::scoped_lock g(m_mutex); - m_xProgress = xProgress; + m_xProgress = std::move(xProgress); } void StatusIndicatorFactory::impl_showProgress() @@ -477,7 +477,7 @@ void StatusIndicatorFactory::impl_showProgress() } std::scoped_lock g(m_mutex); - m_xProgress = xProgress; + m_xProgress = std::move(xProgress); } void StatusIndicatorFactory::impl_hideProgress() diff --git a/framework/source/helper/tagwindowasmodified.cxx b/framework/source/helper/tagwindowasmodified.cxx index 5776d5cee19e..8f4fb11f02ec 100644 --- a/framework/source/helper/tagwindowasmodified.cxx +++ b/framework/source/helper/tagwindowasmodified.cxx @@ -135,7 +135,7 @@ void TagWindowAsModified::impl_update (const css::uno::Reference< css::frame::XF // Note: frame was set as member outside ! we have to refresh connections // regarding window and model only here. m_xWindow = std::move(pWindow); - m_xModel = xModel; + m_xModel = std::move(xModel); } m_xModel->addModifyListener (this); diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 12dcf29f6b0a..9f41150543d9 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -1668,7 +1668,7 @@ Sequence< Reference< ui::XUIElement > > SAL_CALL LayoutManager::getElements() if ( nMenuBarIndex >= 0 ) pSeq[nMenuBarIndex] = xMenuBar; if ( nStatusBarIndex >= 0 ) - pSeq[nStatusBarIndex] = xStatusBar; + pSeq[nStatusBarIndex] = std::move(xStatusBar); return aSeq; } diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 6e75d3c2691a..a4f6a70e651f 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -516,7 +516,7 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL ) // Reuse a local entry so we are able to use the latest // UI changes for this document. implts_setElementData(rElement, xDockWindow); - rElement.m_xUIElement = xUIElement; + rElement.m_xUIElement = std::move(xUIElement); bVisible = rElement.m_bVisible; bFloating = rElement.m_bFloating; } diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 57f2715c4121..8644415d015a 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -159,7 +159,6 @@ css::uno::Reference< css::lang::XComponent > LoadEnv::loadComponentFromURL(const try { LoadEnv aEnv(xContext); - LoadEnvFeatures loadEnvFeatures = LoadEnvFeatures::WorkWithUI; // tdf#118238 Only disable UI interaction when loading as hidden if (comphelper::NamedValueCollection::get(lArgs, u"Hidden") == uno::Any(true) || Application::IsHeadlessModeEnabled()) @@ -1103,8 +1102,9 @@ bool LoadEnv::impl_loadContent() bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN, false); bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_MINIMIZED, false); bool bPreview = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW, false); + bool bStartPres = m_lMediaDescriptor.contains("StartPresentation"); - if (!bHidden && !bMinimized && !bPreview) + if (!bHidden && !bMinimized && !bPreview && !bStartPres) { css::uno::Reference xProgress = m_lMediaDescriptor.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_STATUSINDICATOR, css::uno::Reference()); @@ -1417,9 +1417,9 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded() css::uno::Reference< css::frame::XFrame > xResult; if (xTask.is()) - xResult = xTask; + xResult = std::move(xTask); else if (xHiddenTask.is()) - xResult = xHiddenTask; + xResult = std::move(xHiddenTask); if (xResult.is()) { @@ -1596,6 +1596,8 @@ void LoadEnv::impl_reactForLoadingState() css::uno::Reference< css::awt::XWindow > xWindow = m_xTargetFrame->getContainerWindow(); bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN, false); bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_MINIMIZED, false); + bool bStartPres = m_lMediaDescriptor.contains("StartPresentation"); + VclPtr pWindow = VCLUnoHelper::GetWindow(xWindow); if (bMinimized) @@ -1605,7 +1607,7 @@ void LoadEnv::impl_reactForLoadingState() if (pWindow && pWindow->IsSystemWindow()) static_cast(pWindow.get())->Minimize(); } - else if (!bHidden) + else if (!bHidden && !bStartPres) { // show frame ... if it's not still visible ... // But do nothing if it's already visible! diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index c0f2dca96d0e..aa9568700a5c 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -994,7 +994,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL XFrameImpl::findFrame( const else if ( sTargetFrameName==SPECIALTARGET_PARENT ) { - xTarget = xParent; + xTarget = std::move(xParent); } // I.III) "_top" @@ -1165,7 +1165,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL XFrameImpl::findFrame( const ) { if (xParent->getName() == sTargetFrameName) - xTarget = xParent; + xTarget = std::move(xParent); else { sal_Int32 nRightFlags = nSearchFlags & ~css::frame::FrameSearchFlag::CHILDREN; diff --git a/framework/source/services/taskcreatorsrv.cxx b/framework/source/services/taskcreatorsrv.cxx index 2a53c0b0031d..1af36d0c0754 100644 --- a/framework/source/services/taskcreatorsrv.cxx +++ b/framework/source/services/taskcreatorsrv.cxx @@ -251,7 +251,7 @@ css::uno::Reference< css::awt::XWindow > TaskCreatorService::implts_createContai aDescriptor.Type = css::awt::WindowClass_TOP; aDescriptor.WindowServiceName = "dockingwindow"; aDescriptor.ParentIndex = 1; - aDescriptor.Parent = xParentWindowPeer; + aDescriptor.Parent = std::move(xParentWindowPeer); aDescriptor.Bounds = aPosSize; aDescriptor.WindowAttributes = css::awt::VclWindowPeerAttribute::CLIPCHILDREN; } diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index 25cd0841efe9..3dcfe40d764f 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -818,7 +818,7 @@ void ImageManagerImpl::replaceImages( ConfigurationEvent aReplaceEvent; aReplaceEvent.aInfo <<= nImageType; aReplaceEvent.Accessor <<= xOwner; - aReplaceEvent.Source = xOwner; + aReplaceEvent.Source = std::move(xOwner); aReplaceEvent.ResourceURL = m_aResourceString; aReplaceEvent.ReplacedElement = Any(); aReplaceEvent.Element <<= uno::Reference< XNameAccess >(pReplacedImages); @@ -916,7 +916,7 @@ void ImageManagerImpl::removeImages( ::sal_Int16 nImageType, const Sequence< OUS ConfigurationEvent aReplaceEvent; aReplaceEvent.aInfo <<= nImageType; aReplaceEvent.Accessor <<= xOwner; - aReplaceEvent.Source = xOwner; + aReplaceEvent.Source = std::move(xOwner); aReplaceEvent.ResourceURL = m_aResourceString; aReplaceEvent.ReplacedElement = Any(); aReplaceEvent.Element <<= uno::Reference< XNameAccess >(pReplacedImages); @@ -1062,7 +1062,7 @@ void ImageManagerImpl::reload() ConfigurationEvent aRemoveEvent; aRemoveEvent.aInfo <<= static_cast(i); aRemoveEvent.Accessor <<= xOwner; - aRemoveEvent.Source = xOwner; + aRemoveEvent.Source = std::move(xOwner); aRemoveEvent.ResourceURL = m_aResourceString; aRemoveEvent.Element <<= uno::Reference< XNameAccess >( pRemovedImages ); implts_notifyContainerListener( aRemoveEvent, NotifyOp_Remove ); diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 66cc6a3c2d52..eeebdfc73730 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -795,7 +795,7 @@ void ModuleUIConfigurationManager::impl_Initialize() m_aUIElements[LAYER_USERDEFINED][i].nElementType = i; m_aUIElements[LAYER_USERDEFINED][i].bModified = false; - m_aUIElements[LAYER_USERDEFINED][i].xStorage = xElementTypeStorage; + m_aUIElements[LAYER_USERDEFINED][i].xStorage = std::move(xElementTypeStorage); } } @@ -821,7 +821,7 @@ void ModuleUIConfigurationManager::impl_Initialize() m_aUIElements[LAYER_DEFAULT][i].nElementType = i; m_aUIElements[LAYER_DEFAULT][i].bModified = false; - m_aUIElements[LAYER_DEFAULT][i].xStorage = xElementTypeStorage; + m_aUIElements[LAYER_DEFAULT][i].xStorage = std::move(xElementTypeStorage); } } @@ -1313,7 +1313,7 @@ void SAL_CALL ModuleUIConfigurationManager::removeSettings( const OUString& Reso aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xIfac; + aEvent.Source = std::move(xIfac); aEvent.Element <<= xRemovedSettings; aEvent.ReplacedElement <<= pDefaultDataSettings->xSettings; @@ -1328,7 +1328,7 @@ void SAL_CALL ModuleUIConfigurationManager::removeSettings( const OUString& Reso aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xIfac; + aEvent.Source = std::move(xIfac); aEvent.Element <<= xRemovedSettings; aGuard.clear(); diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 91b4624595ec..29be73cc0a72 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -660,7 +660,7 @@ void UIConfigurationManager::impl_Initialize() m_aUIElements[i].nElementType = i; m_aUIElements[i].bModified = false; - m_aUIElements[i].xStorage = xElementTypeStorage; + m_aUIElements[i].xStorage = std::move(xElementTypeStorage); } } else diff --git a/framework/source/uielement/complextoolbarcontroller.cxx b/framework/source/uielement/complextoolbarcontroller.cxx index 610af1abf362..f3a00b305701 100644 --- a/framework/source/uielement/complextoolbarcontroller.cxx +++ b/framework/source/uielement/complextoolbarcontroller.cxx @@ -110,7 +110,7 @@ void SAL_CALL ComplexToolbarController::execute( sal_Int16 KeyModifier ) { // Execute dispatch asynchronously ExecuteInfo* pExecuteInfo = new ExecuteInfo; - pExecuteInfo->xDispatch = xDispatch; + pExecuteInfo->xDispatch = std::move(xDispatch); pExecuteInfo->aTargetURL = std::move(aTargetURL); pExecuteInfo->aArgs = aArgs; Application::PostUserEvent( LINK(nullptr, ComplexToolbarController , ExecuteHdl_Impl), pExecuteInfo ); @@ -254,7 +254,7 @@ void ComplexToolbarController::addNotifyInfo( NotifyInfo* pNotifyInfo = new NotifyInfo; pNotifyInfo->aEventName = aEventName; - pNotifyInfo->xNotifyListener = xControlNotify; + pNotifyInfo->xNotifyListener = std::move(xControlNotify); pNotifyInfo->aSourceURL = getInitializedURL(); // Add frame as source to the information sequence diff --git a/framework/source/uielement/genericstatusbarcontroller.cxx b/framework/source/uielement/genericstatusbarcontroller.cxx index fefcbc381f16..5c149eaeb4f2 100644 --- a/framework/source/uielement/genericstatusbarcontroller.cxx +++ b/framework/source/uielement/genericstatusbarcontroller.cxx @@ -101,7 +101,7 @@ void SAL_CALL GenericStatusbarController::statusChanged( } else if ( ( rEvent.State >>= aGraphic ) && m_bOwnerDraw ) { - m_xGraphic = aGraphic; + m_xGraphic = std::move(aGraphic); } // when the status is updated, and the controller is responsible for diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index e672ce7d4ca8..8e72962018d8 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -166,7 +166,7 @@ void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier ) // Execute dispatch asynchronously ExecuteInfo* pExecuteInfo = new ExecuteInfo; - pExecuteInfo->xDispatch = xDispatch; + pExecuteInfo->xDispatch = std::move(xDispatch); pExecuteInfo->aTargetURL = std::move(aTargetURL); // Add key modifier to argument list pExecuteInfo->aArgs = { comphelper::makePropertyValue(u"KeyModifier"_ustr, KeyModifier) }; diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 53fbf41aad41..7264eab1fcde 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -560,8 +560,6 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool ) bool bDontHide = officecfg::Office::Common::View::Menu::DontHideDisabledEntry::get(); const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); bool bShowMenuImages = rSettings.GetUseImagesInMenus(); - bool bShowShortcuts = m_bHasMenuBar || rSettings.GetContextMenuShortcuts(); - bool bHasDisabledEntries = SvtCommandOptions().HasEntriesDisabled(); SolarMutexGuard g; @@ -605,27 +603,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool ) } // Try to set accelerator keys - { - if ( bShowShortcuts ) - RetrieveShortcuts( m_aMenuItemHandlerVector ); - - for (auto const& menuItemHandler : m_aMenuItemHandlerVector) - { - if ( !bShowShortcuts ) - { - pMenu->SetAccelKey( menuItemHandler->nItemId, vcl::KeyCode() ); - } - else if ( menuItemHandler->aMenuItemURL == aCmdHelpIndex ) - { - // Set key code, workaround for hard-coded shortcut F1 mapped to .uno:HelpIndex - // Only non-popup menu items can have a short-cut - vcl::KeyCode aKeyCode( KEY_F1 ); - pMenu->SetAccelKey( menuItemHandler->nItemId, aKeyCode ); - } - else if ( pMenu->GetPopupMenu( menuItemHandler->nItemId ) == nullptr ) - pMenu->SetAccelKey( menuItemHandler->nItemId, menuItemHandler->aKeyCode ); - } - } + SetAcceleratorKeys(pMenu); URL aTargetURL; @@ -653,7 +631,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool ) m_xURLTransformer->parseStrict( aTargetURL ); - if ( bHasDisabledEntries ) + if (SvtCommandOptions().HasEntriesDisabled()) { if ( aCmdOptions.LookupDisabled( aTargetURL.Path )) pMenu->HideItem( menuItemHandler->nItemId ); @@ -1104,21 +1082,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF } if ( m_bHasMenuBar && bAccessibilityEnabled ) - { - RetrieveShortcuts( m_aMenuItemHandlerVector ); - for (auto const& menuItemHandler : m_aMenuItemHandlerVector) - { - // Set key code, workaround for hard-coded shortcut F1 mapped to .uno:HelpIndex - // Only non-popup menu items can have a short-cut - if ( menuItemHandler->aMenuItemURL == aCmdHelpIndex ) - { - vcl::KeyCode aKeyCode( KEY_F1 ); - pMenu->SetAccelKey( menuItemHandler->nItemId, aKeyCode ); - } - else if ( pMenu->GetPopupMenu( menuItemHandler->nItemId ) == nullptr ) - pMenu->SetAccelKey( menuItemHandler->nItemId, menuItemHandler->aKeyCode ); - } - } + SetAcceleratorKeys(pMenu); SetHdl(); } @@ -1231,6 +1195,31 @@ void MenuBarManager::RetrieveShortcuts( std::vector< std::unique_ptrSetAccelKey( menuItemHandler->nItemId, vcl::KeyCode() ); + } + else if ( menuItemHandler->aMenuItemURL == aCmdHelpIndex ) + { + // Set key code, workaround for hard-coded shortcut F1 mapped to .uno:HelpIndex + // Only non-popup menu items can have a short-cut + vcl::KeyCode aKeyCode( KEY_F1 ); + pMenu->SetAccelKey( menuItemHandler->nItemId, aKeyCode ); + } + else if ( pMenu->GetPopupMenu( menuItemHandler->nItemId ) == nullptr ) + pMenu->SetAccelKey( menuItemHandler->nItemId, menuItemHandler->aKeyCode ); + } +} + void MenuBarManager::RetrieveImageManagers() { if ( !m_xDocImageManager.is() ) diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx index 6fffe753653e..170acdc20d68 100644 --- a/framework/source/uielement/subtoolbarcontroller.cxx +++ b/framework/source/uielement/subtoolbarcontroller.cxx @@ -326,7 +326,7 @@ VclPtr SubToolBarController::createVclPopupWindow(vcl::Window* /*pP // keep reference to UIElement to avoid its destruction disposeUIElement(); - m_xUIElement = xUIElement; + m_xUIElement = std::move(xUIElement); VclPtr pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar ); if ( pTbxWindow && pTbxWindow->GetType() == WindowType::TOOLBOX ) diff --git a/helpcontent2 b/helpcontent2 index b1d8f7ad8119..0568f35bf55b 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit b1d8f7ad81193f3a7ef7b5358edafcbf82cf604c +Subproject commit 0568f35bf55b1b028875f84a2108bc209c630eab diff --git a/hwpfilter/source/attributes.hxx b/hwpfilter/source/attributes.hxx index 09dc26a03b1f..5b363e784327 100644 --- a/hwpfilter/source/attributes.hxx +++ b/hwpfilter/source/attributes.hxx @@ -17,9 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef INCLUDED_HWPFILTER_SOURCE_ATTRIBUTES_HXX -#define INCLUDED_HWPFILTER_SOURCE_ATTRIBUTES_HXX +#pragma once #include #include @@ -55,7 +53,4 @@ private: std::unique_ptr m_pImpl; }; -#endif // INCLUDED_HWPFILTER_SOURCE_ATTRIBUTES_HXX - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index b43efe2625a0..2b301efdb4e1 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -317,12 +317,12 @@ private: bool isIsoODF() const; bool isValidBcp47() const; - void convertLocaleToBcp47(); + void convertLocaleToBcp47() const; bool convertLocaleToLang( bool bAllowOnTheFlyID ); void convertBcp47ToLocale(); void convertBcp47ToLang(); - void convertLangToLocale(); - void convertLangToBcp47(); + void convertLangToLocale() const; + void convertLangToBcp47() const; /** @return whether BCP 47 language tag string was changed. */ bool canonicalize(); @@ -1029,6 +1029,7 @@ LanguageTagImpl const * LanguageTag::getImpl() const return mpImpl.get(); } + LanguageTagImpl * LanguageTag::getImpl() { if (!mpImpl) @@ -1039,6 +1040,7 @@ LanguageTagImpl * LanguageTag::getImpl() return mpImpl.get(); } + void LanguageTag::resetVars() { mpImpl.reset(); @@ -1303,9 +1305,9 @@ bool LanguageTagImpl::synCanonicalize() } -void LanguageTag::syncFromImpl() +void LanguageTag::syncFromImpl() const { - LanguageTagImpl* pImpl = getImpl(); + const LanguageTagImpl* pImpl = getImpl(); bool bRegister = ((mbInitializedBcp47 && maBcp47 != pImpl->maBcp47) || (mbInitializedLangID && mnLangID != pImpl->mnLangID)); SAL_INFO_IF( bRegister, "i18nlangtag", @@ -1352,7 +1354,7 @@ bool LanguageTag::synCanonicalize() } -void LanguageTagImpl::convertLocaleToBcp47() +void LanguageTagImpl::convertLocaleToBcp47() const { if (mbSystemLocale && !mbInitializedLocale) convertLangToLocale(); @@ -1499,7 +1501,7 @@ void LanguageTag::convertBcp47ToLang() } -void LanguageTagImpl::convertLangToLocale() +void LanguageTagImpl::convertLangToLocale() const { if (mbSystemLocale && !mbInitializedLangID) { @@ -1512,14 +1514,14 @@ void LanguageTagImpl::convertLangToLocale() } -void LanguageTag::convertLangToLocale() +void LanguageTag::convertLangToLocale() const { getImpl()->convertLangToLocale(); syncFromImpl(); } -void LanguageTagImpl::convertLangToBcp47() +void LanguageTagImpl::convertLangToBcp47() const { if (!mbInitializedLocale) convertLangToLocale(); @@ -1573,9 +1575,9 @@ const OUString & LanguageTagImpl::getBcp47() const if (!mbInitializedBcp47) { if (mbInitializedLocale) - const_cast(this)->convertLocaleToBcp47(); + convertLocaleToBcp47(); else - const_cast(this)->convertLangToBcp47(); + convertLangToBcp47(); } return maBcp47; } @@ -1592,7 +1594,7 @@ const OUString & LanguageTag::getBcp47( bool bResolveSystem ) const if (!mbInitializedBcp47) { getImpl()->getBcp47(); - const_cast(this)->syncFromImpl(); + syncFromImpl(); } return maBcp47; } @@ -1733,7 +1735,7 @@ const css::lang::Locale & LanguageTag::getLocale( bool bResolveSystem ) const if (mbInitializedBcp47) const_cast(this)->convertBcp47ToLocale(); else - const_cast(this)->convertLangToLocale(); + convertLangToLocale(); } return maLocale; } @@ -1864,7 +1866,7 @@ OUString LanguageTag::getLanguage() const if (pImpl->mbCachedLanguage) return pImpl->maCachedLanguage; OUString aRet( pImpl->getLanguage()); - const_cast(this)->syncFromImpl(); + syncFromImpl(); return aRet; } @@ -1886,7 +1888,7 @@ OUString LanguageTag::getScript() const if (pImpl->mbCachedScript) return pImpl->maCachedScript; OUString aRet( pImpl->getScript()); - const_cast(this)->syncFromImpl(); + syncFromImpl(); return aRet; } @@ -1922,7 +1924,7 @@ OUString LanguageTag::getCountry() const if (pImpl->mbCachedCountry) return pImpl->maCachedCountry; OUString aRet( pImpl->getCountry()); - const_cast(this)->syncFromImpl(); + syncFromImpl(); return aRet; } @@ -1950,7 +1952,7 @@ OUString LanguageTag::getVariants() const if (pImpl->mbCachedVariants) return pImpl->maCachedVariants; OUString aRet( pImpl->getVariants()); - const_cast(this)->syncFromImpl(); + syncFromImpl(); return aRet; } @@ -2011,7 +2013,7 @@ bool LanguageTagImpl::hasScript() const bool LanguageTag::hasScript() const { bool bRet = getImpl()->hasScript(); - const_cast(this)->syncFromImpl(); + syncFromImpl(); return bRet; } @@ -2076,7 +2078,7 @@ bool LanguageTagImpl::isIsoLocale() const bool LanguageTag::isIsoLocale() const { bool bRet = getImpl()->isIsoLocale(); - const_cast(this)->syncFromImpl(); + syncFromImpl(); return bRet; } @@ -2111,7 +2113,7 @@ bool LanguageTagImpl::isIsoODF() const bool LanguageTag::isIsoODF() const { bool bRet = getImpl()->isIsoODF(); - const_cast(this)->syncFromImpl(); + syncFromImpl(); return bRet; } @@ -2131,7 +2133,7 @@ bool LanguageTagImpl::isValidBcp47() const bool LanguageTag::isValidBcp47() const { bool bRet = getImpl()->isValidBcp47(); - const_cast(this)->syncFromImpl(); + syncFromImpl(); return bRet; } diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index 650629cf69cb..4fcaeba18224 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -109,7 +109,7 @@ CalendarImpl::loadCalendarTZ( const OUString& uniqueID, const css::lang::Locale& } catch ( Exception& ) { // restore previous calendar and re-throw - xCalendar = xOldCalendar; + xCalendar = std::move(xOldCalendar); throw; } diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index ad6be9d12633..2689e9a5dc8a 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -588,7 +588,13 @@ void LCFormatNode::generateCode (const OFileWriter &of) const if (mnSection > 0) incError( "DateAcceptancePattern only handled in LC_FORMAT, not LC_FORMAT_1"); else - theDateAcceptancePatterns.push_back( currNode->getValue()); + { + auto val = currNode->getValue(); + if (std::find(theDateAcceptancePatterns.begin(), theDateAcceptancePatterns.end(), val) == theDateAcceptancePatterns.end()) + theDateAcceptancePatterns.push_back(val); + else + incErrorStr( "Error: Duplicated DateAcceptancePattern: %s\n", val); + } --formatCount; continue; // for } @@ -1170,8 +1176,11 @@ void LCFormatNode::generateCode (const OFileWriter &of) const OSTR( aPattern), OSTR( sTheDateEditFormat), int(cssi::NumberFormatIndex::DATE_SYS_DDMMYYYY), OSTR( OUString(&cDateSep, 1))); - // Insert at front so full date pattern is first in checks. - theDateAcceptancePatterns.insert( theDateAcceptancePatterns.begin(), aPattern); + + if (std::find(theDateAcceptancePatterns.begin(), theDateAcceptancePatterns.end(), aPattern) == theDateAcceptancePatterns.end()) + theDateAcceptancePatterns.push_back(aPattern); + else + incErrorStr( "Error: Duplicated DateAcceptancePattern: %s\n", aPattern); } if (!aPatternBuf2.isEmpty()) { @@ -1188,7 +1197,11 @@ void LCFormatNode::generateCode (const OFileWriter &of) const fprintf( stderr, "Generated 2nd acceptance pattern: '%s' from '%s' (formatindex=\"%d\")\n", OSTR( aPattern2), OSTR( sTheDateEditFormat), int(cssi::NumberFormatIndex::DATE_SYS_DDMMYYYY)); - theDateAcceptancePatterns.insert( theDateAcceptancePatterns.begin(), aPattern2); + + if (std::find(theDateAcceptancePatterns.begin(), theDateAcceptancePatterns.end(), aPattern2) == theDateAcceptancePatterns.end()) + theDateAcceptancePatterns.push_back(aPattern2); + else + incErrorStr( "Error: Duplicated DateAcceptancePattern: %s\n", aPattern2); } } @@ -1211,23 +1224,6 @@ void LCFormatNode::generateCode (const OFileWriter &of) const } } - // Check for duplicates. - for (std::vector::const_iterator aIt = theDateAcceptancePatterns.begin(); - aIt != theDateAcceptancePatterns.end(); ++aIt) - { - for (std::vector::iterator aComp = theDateAcceptancePatterns.begin(); - aComp != theDateAcceptancePatterns.end(); /*nop*/) - { - if (aIt != aComp && *aIt == *aComp) - { - incErrorStr( "Error: Duplicated DateAcceptancePattern: %s\n", *aComp); - aComp = theDateAcceptancePatterns.erase( aComp); - } - else - ++aComp; - } - } - sal_Int16 nbOfDateAcceptancePatterns = static_cast(theDateAcceptancePatterns.size()); for (sal_Int16 i = 0; i < nbOfDateAcceptancePatterns; ++i) diff --git a/icon-themes/colibre/sw/res/colbreak.png b/icon-themes/colibre/sw/res/colbreak.png new file mode 100644 index 000000000000..00e28e5e73f6 Binary files /dev/null and b/icon-themes/colibre/sw/res/colbreak.png differ diff --git a/icon-themes/colibre/sw/res/linebreak_full.png b/icon-themes/colibre/sw/res/linebreak_full.png new file mode 100644 index 000000000000..062da32d7838 Binary files /dev/null and b/icon-themes/colibre/sw/res/linebreak_full.png differ diff --git a/icon-themes/colibre/sw/res/linebreak_left.png b/icon-themes/colibre/sw/res/linebreak_left.png new file mode 100644 index 000000000000..80357bc3c926 Binary files /dev/null and b/icon-themes/colibre/sw/res/linebreak_left.png differ diff --git a/icon-themes/colibre/sw/res/linebreak_none.png b/icon-themes/colibre/sw/res/linebreak_none.png new file mode 100644 index 000000000000..813932dc67fb Binary files /dev/null and b/icon-themes/colibre/sw/res/linebreak_none.png differ diff --git a/icon-themes/colibre/sw/res/linebreak_right.png b/icon-themes/colibre/sw/res/linebreak_right.png new file mode 100644 index 000000000000..6f2bd317cd86 Binary files /dev/null and b/icon-themes/colibre/sw/res/linebreak_right.png differ diff --git a/icon-themes/colibre/sw/res/pagebreak.png b/icon-themes/colibre/sw/res/pagebreak.png new file mode 100644 index 000000000000..bff5c452f728 Binary files /dev/null and b/icon-themes/colibre/sw/res/pagebreak.png differ diff --git a/include/codemaker/global.hxx b/include/codemaker/global.hxx index e62e1a973273..96a4a5238b87 100644 --- a/include/codemaker/global.hxx +++ b/include/codemaker/global.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CODEMAKER_GLOBAL_HXX -#define INCLUDED_CODEMAKER_GLOBAL_HXX +#pragma once #include #include @@ -91,6 +90,4 @@ private: OUString message_; }; -#endif // INCLUDED_CODEMAKER_GLOBAL_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/comphelper/propertysequence.hxx b/include/comphelper/propertysequence.hxx index e788f56f428f..787f96f3e855 100644 --- a/include/comphelper/propertysequence.hxx +++ b/include/comphelper/propertysequence.hxx @@ -53,7 +53,7 @@ namespace comphelper return vResult; } - COMPHELPER_DLLPUBLIC std::vector JsonToPropertyValues(const OString& rJson); + COMPHELPER_DLLPUBLIC std::vector JsonToPropertyValues(std::string_view rJson); } // namespace comphelper diff --git a/include/connectivity/sqlparse.hxx b/include/connectivity/sqlparse.hxx index 4ccd5ebbea95..790da073aad5 100644 --- a/include/connectivity/sqlparse.hxx +++ b/include/connectivity/sqlparse.hxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include @@ -140,7 +140,7 @@ namespace connectivity sal_Int32 m_nDateFormatKey; css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::i18n::XCharacterClassification> m_xCharClass; - static vcl::DeleteOnDeinit> s_xLocaleData; + static tools::DeleteOnDeinit>& getLocaleData(); // convert a string into double trim it to scale of _nscale and then transform it back to string OUString stringToDouble(const OUString& _rValue,sal_Int16 _nScale); diff --git a/include/editeng/fieldupdater.hxx b/include/editeng/fieldupdater.hxx index e15754ffdd0c..61d6570741e2 100644 --- a/include/editeng/fieldupdater.hxx +++ b/include/editeng/fieldupdater.hxx @@ -11,6 +11,8 @@ #define INCLUDED_EDITENG_FIELDUPDATER_HXX #include +#include +#include #include class EditTextObject; @@ -18,6 +20,7 @@ class EditTextObject; namespace editeng { class FieldUpdaterImpl; +class SvxFieldItemUpdater; /** * Wrapper for EditTextObject to handle updating of fields without exposing @@ -38,6 +41,20 @@ public: * @param nTab new table ID */ void updateTableFields(int nTab); + + void UpdatePageRelativeURLs( + const std::function& rItemCallback); +}; + +// helper for updating the items we find via UpdatePageRelativeURLs +class EDITENG_DLLPUBLIC SvxFieldItemUpdater +{ +public: + virtual ~SvxFieldItemUpdater(); + + // write-access when SvxFieldItem needs to be modified + virtual void SetItem(const SvxFieldItem&) = 0; }; } diff --git a/include/filter/msfilter/classids.hxx b/include/filter/msfilter/classids.hxx index 8394a716b0f7..2d3274273dab 100644 --- a/include/filter/msfilter/classids.hxx +++ b/include/filter/msfilter/classids.hxx @@ -7,8 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_FILTER_MSFILTER_CLASSIDS_HXX -#define INCLUDED_FILTER_MSFILTER_CLASSIDS_HXX +#pragma once #define MSO_EQUATION2_CLASSID \ 0x00021700L, 0x0000, 0x0000, \ @@ -42,6 +41,4 @@ 0x64818d11L, 0x4f9b, 0x11cf, \ 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8 -#endif // INCLUDED_FILTER_MSFILTER_CLASSIDS_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/i18nlangtag/languagetag.hxx b/include/i18nlangtag/languagetag.hxx index 39982148bcbb..fc77c5e285d4 100644 --- a/include/i18nlangtag/languagetag.hxx +++ b/include/i18nlangtag/languagetag.hxx @@ -569,16 +569,16 @@ private: bool mbIsFallback : 1; LanguageTagImpl* getImpl(); - LanguageTagImpl const* getImpl() const; + LanguageTagImpl const * getImpl() const; ImplPtr registerImpl() const; - void syncFromImpl(); + void syncFromImpl() const; void syncVarsFromRawImpl() const; void syncVarsFromImpl() const; void convertLocaleToLang(); void convertBcp47ToLocale(); void convertBcp47ToLang(); - void convertLangToLocale(); + void convertLangToLocale() const; void convertFromRtlLocale(); diff --git a/include/svl/nfengine.hxx b/include/svl/nfengine.hxx index f8ec16f28fbb..a057ebef3bee 100644 --- a/include/svl/nfengine.hxx +++ b/include/svl/nfengine.hxx @@ -349,11 +349,11 @@ public: static sal_uInt16 GetFormatPrecision(SvNFLanguageData& rCurrentLanguage, const SvNFFormatData& rFormatData, sal_uInt32 nFormat); - static void GetInputLineString(SvNFLanguageData& rCurrentLanguage, - const SvNFFormatData& rFormatData, - const NativeNumberWrapper& rNatNum, const Accessor& rFuncs, - const double& fOutNumber, sal_uInt32 nFIndex, - OUString& sOutString, bool bFiltering, bool bForceSystemLocale); + static OUString GetInputLineString(SvNFLanguageData& rCurrentLanguage, + const SvNFFormatData& rFormatData, + const NativeNumberWrapper& rNatNum, const Accessor& rFuncs, + const double& fOutNumber, sal_uInt32 nFIndex, + bool bFiltering, bool bForceSystemLocale); static sal_uInt32 GetEditFormat(SvNFLanguageData& rCurrentLanguage, const SvNFFormatData& rFormatData, diff --git a/include/svl/numformat.hxx b/include/svl/numformat.hxx index 92746e033e61..e82be6e27d22 100644 --- a/include/svl/numformat.hxx +++ b/include/svl/numformat.hxx @@ -188,8 +188,8 @@ public: a number rounded by the cell format, which rounded value is used in the filtering condition now), instead of the EditFormat string (e.g a not rounded value, which is visible during editing).*/ - void GetInputLineString(const double& fOutNumber, sal_uInt32 nFIndex, OUString& rOutString, - bool bFiltering = false, bool bForceSystemLocale = false); + OUString GetInputLineString(const double& fOutNumber, sal_uInt32 nFIndex, + bool bFiltering = false, bool bForceSystemLocale = false); /** Format a number according to a format code string to be scanned. @return diff --git a/include/svl/style.hxx b/include/svl/style.hxx index 9f765bcaf1b0..1882a1a2f5e8 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -130,7 +130,8 @@ protected: bool bMySet; // sal_True: delete Set in dtor bool bHidden; - SfxStyleSheetBase( const OUString&, SfxStyleSheetBasePool*, SfxStyleFamily eFam, SfxStyleSearchBits mask ); + SfxStyleSheetBase( const OUString&, SfxStyleSheetBasePool*, SfxStyleFamily eFam, + SfxStyleSearchBits mask, const OUString& rParentStyleSheetName ); SfxStyleSheetBase( const SfxStyleSheetBase& ); virtual ~SfxStyleSheetBase() override; @@ -236,7 +237,7 @@ protected: SfxItemPool& rPool; void ChangeParent(std::u16string_view rOld, const OUString& rNew, SfxStyleFamily eFamily, bool bVirtual = true); - virtual rtl::Reference Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits ); + virtual rtl::Reference Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits, const OUString& rParentStyleSheetName ); virtual rtl::Reference Create( const SfxStyleSheetBase& ); virtual ~SfxStyleSheetBasePool() override; @@ -260,7 +261,8 @@ public: virtual SfxStyleSheetBase& Make(const OUString&, SfxStyleFamily eFam, - SfxStyleSearchBits nMask = SfxStyleSearchBits::All); + SfxStyleSearchBits nMask = SfxStyleSearchBits::All, + const OUString& rParentStyleSheetName = u""_ustr); virtual void Remove( SfxStyleSheetBase* ); void Insert( SfxStyleSheetBase* ); @@ -287,7 +289,8 @@ class SVL_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase, { public: - SfxStyleSheet( const OUString&, const SfxStyleSheetBasePool&, SfxStyleFamily, SfxStyleSearchBits ); + SfxStyleSheet( const OUString&, const SfxStyleSheetBasePool&, SfxStyleFamily, + SfxStyleSearchBits, const OUString& rParentStyleSheetName = u""_ustr ); SfxStyleSheet( const SfxStyleSheet& ); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; @@ -306,7 +309,8 @@ class SVL_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool { protected: using SfxStyleSheetBasePool::Create; - virtual rtl::Reference Create(const OUString&, SfxStyleFamily, SfxStyleSearchBits mask) override; + virtual rtl::Reference Create(const OUString&, SfxStyleFamily, + SfxStyleSearchBits mask, const OUString& rParentStyleSheetName) override; public: SfxStyleSheetPool( SfxItemPool const& ); @@ -342,7 +346,9 @@ public: class SVL_DLLPUBLIC SfxUnoStyleSheet : public cppu::ImplInheritanceHelper { public: - SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, SfxStyleSearchBits _nMask ); + SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, + SfxStyleSearchBits _nMask, + const OUString& rParentStyleSheetName = u""_ustr ); static SfxUnoStyleSheet* getUnoStyleSheet( const css::uno::Reference< css::style::XStyle >& xStyle ); }; diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx index 88296f4a2629..fae28c0a72dc 100644 --- a/include/svx/svdograf.hxx +++ b/include/svx/svdograf.hxx @@ -78,9 +78,6 @@ private: SAL_DLLPRIVATE virtual std::unique_ptr CreateObjectSpecificViewContact() override; SAL_DLLPRIVATE virtual std::unique_ptr CreateObjectSpecificProperties() override; - SAL_DLLPRIVATE void ImpSetAttrToGrafInfo(); // Copy values from the pool - GraphicAttr m_aGrafInfo; - OUString m_aFileName; // If it's a Link, the filename can be found in here OUString m_aFilterName; std::unique_ptr mpGraphicObject; // In order to speed up output of bitmaps, especially rotated ones diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx index f64af22e1353..8371d080cbe2 100644 --- a/include/svx/svdpage.hxx +++ b/include/svx/svdpage.hxx @@ -528,8 +528,6 @@ public: const SdrLayerAdmin& GetLayerAdmin() const; SdrLayerAdmin& GetLayerAdmin(); - virtual OUString GetLayoutName() const; - /// for snap-to-grid in Writer, also for AlignObjects if 1 object is marked /// if pRect != null, then the pages that are intersected by this Rect, /// otherwise the visible pages diff --git a/include/vcl/lazydelete.hxx b/include/tools/lazydelete.hxx similarity index 90% rename from include/vcl/lazydelete.hxx rename to include/tools/lazydelete.hxx index 9488030a3369..db820ec75d6e 100644 --- a/include/vcl/lazydelete.hxx +++ b/include/tools/lazydelete.hxx @@ -19,18 +19,18 @@ #pragma once -#include +#include #include #include #include -namespace vcl +namespace tools { /* - You may not access vcl objects after DeInitVCL has been called this includes their destruction - therefore disallowing the existence of static vcl object like e.g. a static BitmapEx + You may not access some objects after DeInitVCL has been called this includes their destruction + therefore disallowing the existence of static object like e.g. a static BitmapEx To work around this use DeleteOnDeinit which will allow you to have a static object container, that will have its contents destroyed on DeinitVCL. The single drawback is that you need to check on the container object whether it still contains content before actually accessing it. @@ -46,17 +46,17 @@ namespace vcl SomeWindow::Paint() { - static vcl::DeleteOnDeinit< BitmapEx > aBmp( ... ); + static tools::DeleteOnDeinit< BitmapEx > aBmp( ... ); if( aBmp.get() ) // check whether DeInitVCL has been called already DrawBitmapEx( Point( 10, 10 ), *aBmp ); } */ - class VCL_DLLPUBLIC DeleteOnDeinitBase + class TOOLS_DLLPUBLIC DeleteOnDeinitBase { public: - static void SAL_DLLPRIVATE ImplDeleteOnDeInit(); + static void ImplDeleteOnDeInit(); virtual ~DeleteOnDeinitBase(); protected: static void addDeinitContainer( DeleteOnDeinitBase* i_pContainer ); @@ -109,7 +109,7 @@ namespace vcl \ */ template - class DeleteUnoReferenceOnDeinit final : public vcl::DeleteOnDeinitBase + class DeleteUnoReferenceOnDeinit final : public tools::DeleteOnDeinitBase { css::uno::Reference m_xI; virtual void doCleanup() override { set(nullptr); } @@ -144,7 +144,7 @@ namespace vcl \ */ template - class DeleteRtlReferenceOnDeinit final : public vcl::DeleteOnDeinitBase + class DeleteRtlReferenceOnDeinit final : public tools::DeleteOnDeinitBase { rtl::Reference m_xI; virtual void doCleanup() override { set(nullptr); } diff --git a/include/vcl/builderbase.hxx b/include/vcl/builderbase.hxx index 909792d2ca52..f7216864c11e 100644 --- a/include/vcl/builderbase.hxx +++ b/include/vcl/builderbase.hxx @@ -44,6 +44,8 @@ public: typedef stringmap Adjustment; typedef stringmap TextBuffer; + static sal_Int32 extractActive(stringmap& rMap); + protected: BuilderBase(std::u16string_view sUIDir, const OUString& rUIFile, bool bLegacy); virtual ~BuilderBase() = default; @@ -80,6 +82,7 @@ protected: static void collectAccelerator(xmlreader::XmlReader& reader, accelmap& rMap); stringmap collectPackingProperties(xmlreader::XmlReader& reader); void collectProperty(xmlreader::XmlReader& rReader, stringmap& rMap) const; + static bool extractEntry(stringmap& rMap); static bool extractVisible(stringmap& rMap); void extractClassAndIdAndCustomProperty(xmlreader::XmlReader& reader, OUString& rClass, OUString& rId, OUString& rCustomProperty); diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx index 373f270a65bc..4abcfb6e93c7 100644 --- a/include/vcl/glyphitemcache.hxx +++ b/include/vcl/glyphitemcache.hxx @@ -67,7 +67,7 @@ public: void SetCacheGlyphsWhenDoingFallbackFonts(bool bOK); static SalLayoutGlyphsCache* self(); - SalLayoutGlyphsCache(int size) // needs to be public for vcl::DeleteOnDeinit + SalLayoutGlyphsCache(int size) // needs to be public for tools::DeleteOnDeinit : mCachedGlyphs(size) { } diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index 9d1499ea98c1..838b870bd7e7 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -83,6 +83,7 @@ class VCL_DLLPUBLIC Graphic private: std::shared_ptr mxImpGraphic; SAL_DLLPRIVATE void ImplTestRefCount(); + basegfx::B2DSize GetPPUnit(const MapMode& unit) const; public: SAL_DLLPRIVATE ImpGraphic* ImplGetImpGraphic() const { return mxImpGraphic.get(); } @@ -140,7 +141,10 @@ public: MapMode GetPrefMapMode() const; void SetPrefMapMode( const MapMode& rPrefMapMode ); + /** pixels per inch i.e. DPI */ basegfx::B2DSize GetPPI() const; + /** pixels per meter */ + basegfx::B2DSize GetPPM() const; Size GetSizePixel( const OutputDevice* pRefDevice = nullptr ) const; diff --git a/include/vcl/qt/QtUtils.hxx b/include/vcl/qt/QtUtils.hxx new file mode 100644 index 000000000000..95f31e97ce63 --- /dev/null +++ b/include/vcl/qt/QtUtils.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +/** + * Utilities/helpers for use in Qt-specific LO code used in multiple modules + * (e.g. avmedia and vcl). + * + * Helpers only needed in a specific module should be defined + * in that module instead, e.g. helper functions only relevant for the Qt-based + * VCL plugins are defined in `vcl/inc/qt5/QtTools.hxx`. + **/ + +#include +#include +#include + +#include +#include + +inline QString toQString(const OUString& rStr) +{ + return QString::fromUtf16(rStr.getStr(), rStr.getLength()); +} + +inline QPixmap toQPixmap(const BitmapEx& rBitmapEx) +{ + SvMemoryStream aMemoryStream; + vcl::PngImageWriter aWriter(aMemoryStream); + aWriter.write(rBitmapEx); + QPixmap aPixmap; + aPixmap.loadFromData(static_cast(aMemoryStream.GetData()), + aMemoryStream.TellEnd()); + assert(!aPixmap.isNull() && "Failed to create icon pixmap"); + return aPixmap; +} + +inline QPixmap toQPixmap(const css::uno::Reference& rImage) +{ + if (!rImage.is()) + return QPixmap(); + + Image aImage(rImage); + return toQPixmap(aImage.GetBitmapEx()); +} + +inline QPixmap loadQPixmapIcon(const OUString& rIconName) +{ + BitmapEx aIcon(rIconName); + return toQPixmap(aIcon); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index 57836fc59794..c22daf19fcc2 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -1434,7 +1434,7 @@ VCL_DLLPUBLIC bool IsVCLInit(); VCL_DLLPUBLIC bool InitVCL(); VCL_DLLPUBLIC void DeInitVCL(); -VCL_DLLPUBLIC bool InitAccessBridge(); +VCL_DLLPUBLIC void InitAccessBridge(); // only allowed to call, if no thread is running. You must call JoinMainLoopThread to free all memory. VCL_DLLPUBLIC void CreateMainLoopThread( oslWorkerFunction pWorker, void * pThreadData ); diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index c375a7e0c03b..cc60c8f351e7 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1540,7 +1540,7 @@ public: set_accessible_name if you do. */ virtual void set_custom_button(VirtualDevice* pDevice) = 0; - void connect_clicked(const Link& rLink) { m_aClickHdl = rLink; } + virtual void connect_clicked(const Link& rLink) { m_aClickHdl = rLink; } }; class VCL_DLLPUBLIC Toggleable : virtual public Widget diff --git a/io/source/stm/odata.cxx b/io/source/stm/odata.cxx index 7391a2062cce..f55be79dc4c0 100644 --- a/io/source/stm/odata.cxx +++ b/io/source/stm/odata.cxx @@ -888,7 +888,7 @@ void OObjectOutputStream::connectToMarkable() Reference < XMarkableStream > markable( rTry , UNO_QUERY ); if( markable.is() ) { - m_rMarkable = markable; + m_rMarkable = std::move(markable); break; } Reference < XActiveDataSource > source( rTry , UNO_QUERY ); @@ -1149,7 +1149,7 @@ void OObjectInputStream::connectToMarkable() Reference< XMarkableStream > markable( rTry , UNO_QUERY ); if( markable.is() ) { - m_rMarkable = markable; + m_rMarkable = std::move(markable); break; } Reference < XActiveDataSink > sink( rTry , UNO_QUERY ); diff --git a/l10ntools/source/helpex.cxx b/l10ntools/source/helpex.cxx index 97e574fc7dde..a5406d9b9c71 100644 --- a/l10ntools/source/helpex.cxx +++ b/l10ntools/source/helpex.cxx @@ -84,8 +84,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) pMergeDataFile.reset(new MergeDataFile(aArgs.m_sMergeSrc, "", false, false )); } std::string sTemp; - aInput >> sTemp; - while( !aInput.eof() ) + while ( aInput >> sTemp ) { // coverity[tainted_data] - this is a build time tool const OString sXhpFile( sTemp.data(), static_cast(sTemp.length()) ); @@ -98,7 +97,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { hasNoError = false; } - aInput >> sTemp; } aInput.close(); } diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx index 7d3587e68067..9a1b172a0981 100644 --- a/l10ntools/source/lngmerge.cxx +++ b/l10ntools/source/lngmerge.cxx @@ -67,8 +67,7 @@ LngParser::LngParser(OString sLngFile) bool bFirstLine = true; std::string s; - std::getline(aStream, s); - while (!aStream.eof()) + while (std::getline(aStream, s)) { OString sLine(s.data(), s.length()); @@ -80,7 +79,6 @@ LngParser::LngParser(OString sLngFile) } mvLines.push_back( sLine ); - std::getline(aStream, s); } mvLines.push_back( OString() ); } diff --git a/l10ntools/source/propmerge.cxx b/l10ntools/source/propmerge.cxx index e17b2dd9c153..d3b6314ba0af 100644 --- a/l10ntools/source/propmerge.cxx +++ b/l10ntools/source/propmerge.cxx @@ -99,8 +99,7 @@ PropParser::PropParser( if( aIfstream.is_open() ) { std::string s; - std::getline( aIfstream, s ); - while( !aIfstream.eof() ) + while( std::getline( aIfstream, s ) ) { OString sLine( s.data(), s.length() ); if( bMergeMode || @@ -108,7 +107,6 @@ PropParser::PropParser( { m_vLines.push_back( sLine ); } - std::getline( aIfstream, s ); } } else diff --git a/l10ntools/source/ulfconv/msi-encodinglist.txt b/l10ntools/source/ulfconv/msi-encodinglist.txt index 5e61ce23c961..6f6cb0f644be 100644 --- a/l10ntools/source/ulfconv/msi-encodinglist.txt +++ b/l10ntools/source/ulfconv/msi-encodinglist.txt @@ -162,6 +162,7 @@ tg 0 1064 # Tajik th 0 1054 ti 0 1139 # Tigrinya ti-ER 0 1139 # Tigrinya +tl 0 1592 # Tagalog, fake LCID tn 0 1074 # Setsuana tr 0 1055 # Turkish ts 0 1073 # Tsonga diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 5dddaa2d0e37..6d34f263733d 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -2456,6 +2456,25 @@ postCommandInThread (gpointer data) priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pLOEvent->m_pCommand, pLOEvent->m_pArguments, pLOEvent->m_bNotifyWhenFinished); } +static void +paintTile(LOKDocViewPrivate& priv, + unsigned char* pBuffer, + const GdkRectangle& rTileRectangle, + gint nTileSizePixelsScaled, + LOEvent* pLOEvent, + gint nScaleFactor) +{ + std::unique_lock aGuard(g_aLOKMutex); + setDocumentView(priv->m_pDocument, priv->m_nViewId); + + priv->m_pDocument->pClass->paintTile(priv->m_pDocument, + pBuffer, + nTileSizePixelsScaled, nTileSizePixelsScaled, + rTileRectangle.x, rTileRectangle.y, + pixelToTwip(nTileSizePixelsScaled, pLOEvent->m_fPaintTileZoom * nScaleFactor), + pixelToTwip(nTileSizePixelsScaled, pLOEvent->m_fPaintTileZoom * nScaleFactor)); +} + static void paintTileInThread (gpointer data) { @@ -2496,8 +2515,6 @@ paintTileInThread (gpointer data) aTileRectangle.x = pixelToTwip(nTileSizePixelsScaled, pLOEvent->m_fPaintTileZoom * nScaleFactor) * pLOEvent->m_nPaintTileY; aTileRectangle.y = pixelToTwip(nTileSizePixelsScaled, pLOEvent->m_fPaintTileZoom * nScaleFactor) * pLOEvent->m_nPaintTileX; - std::unique_lock aGuard(g_aLOKMutex); - setDocumentView(priv->m_pDocument, priv->m_nViewId); std::stringstream ss; GTimer* aTimer = g_timer_new(); gulong nElapsedMs; @@ -2507,13 +2524,7 @@ paintTileInThread (gpointer data) << pixelToTwip(nTileSizePixelsScaled, pLOEvent->m_fPaintTileZoom * nScaleFactor) << ", " << pixelToTwip(nTileSizePixelsScaled, pLOEvent->m_fPaintTileZoom * nScaleFactor) << ")"; - priv->m_pDocument->pClass->paintTile(priv->m_pDocument, - pBuffer, - nTileSizePixelsScaled, nTileSizePixelsScaled, - aTileRectangle.x, aTileRectangle.y, - pixelToTwip(nTileSizePixelsScaled, pLOEvent->m_fPaintTileZoom * nScaleFactor), - pixelToTwip(nTileSizePixelsScaled, pLOEvent->m_fPaintTileZoom * nScaleFactor)); - aGuard.unlock(); + paintTile(priv, pBuffer, aTileRectangle, nTileSizePixelsScaled, pLOEvent, nScaleFactor); g_timer_elapsed(aTimer, &nElapsedMs); ss << " rendered in " << (nElapsedMs / 1000.) << " milliseconds"; diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx index 8ec888e38660..ac1f7436e572 100644 --- a/linguistic/source/convdic.cxx +++ b/linguistic/source/convdic.cxx @@ -86,7 +86,7 @@ static void ReadThroughDic( const OUString &rMainURL, ConvDicXMLImport &rImport // prepare ParserInputSource xml::sax::InputSource aParserInput; - aParserInput.aInputStream = xIn; + aParserInput.aInputStream = std::move(xIn); // finally, parser the stream try diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx index 3fa5cdc07081..e032f3cd2480 100644 --- a/linguistic/source/convdiclist.cxx +++ b/linguistic/source/convdiclist.cxx @@ -213,7 +213,7 @@ void SAL_CALL ConvDicNameContainer::replaceByName( rElement >>= xNew; if (!xNew.is() || xNew->getName() != rName) throw IllegalArgumentException(); - aConvDics[ nRplcIdx ] = xNew; + aConvDics[ nRplcIdx ] = std::move(xNew); } void SAL_CALL ConvDicNameContainer::insertByName( diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx index 2077c4dc4328..36bcdcc72119 100644 --- a/linguistic/source/gciterator.cxx +++ b/linguistic/source/gciterator.cxx @@ -694,7 +694,7 @@ void GrammarCheckingIterator::DequeueAndCheck() aRes.nBehindEndOfSentencePosition = nSuggestedEnd; } - aRes.xFlatParagraph = xFlatPara; + aRes.xFlatParagraph = std::move(xFlatPara); aRes.nStartOfSentencePosition = nStartPos; } else @@ -702,7 +702,7 @@ void GrammarCheckingIterator::DequeueAndCheck() // no grammar checker -> no error // but we need to provide the data below in order to continue with the next sentence aRes.aDocumentIdentifier = aCurDocId; - aRes.xFlatParagraph = xFlatPara; + aRes.xFlatParagraph = std::move(xFlatPara); aRes.aText = aCurTxt; aRes.aLocale = std::move(aCurLocale); aRes.nStartOfSentencePosition = nStartPos; diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index a66697f61789..32bdb21803d1 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -236,13 +236,13 @@ static Reference< XDictionaryEntry > lcl_GetRulingDictionaryEntry( Reference< XDictionaryEntry > xNegEntry( SearchDicList( xDList, rWord, nLanguage, false, true ) ); if (xNegEntry.is()) - xRes = xNegEntry; + xRes = std::move(xNegEntry); else { Reference< XDictionaryEntry > xPosEntry( SearchDicList( xDList, rWord, nLanguage, true, true ) ); if (xPosEntry.is()) - xRes = xPosEntry; + xRes = std::move(xPosEntry); } } diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 30dbe69773a6..34c1d2bfdf9c 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -3292,7 +3292,9 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/sdbc,\ ProcedureResult \ ResultSetConcurrency \ ResultSetType \ + RowIdLifetime \ SQLException \ + SQLState \ SQLWarning \ TransactionIsolation \ XArray \ @@ -3306,6 +3308,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/sdbc,\ XDataSource \ XDatabaseMetaData \ XDatabaseMetaData2 \ + XDatabaseMetaData3 \ XDriver \ XDriverAccess \ XDriverManager \ diff --git a/offapi/com/sun/star/drawing/ConnectorShape.idl b/offapi/com/sun/star/drawing/ConnectorShape.idl index 2d3fbbf836cd..e0222704493b 100644 --- a/offapi/com/sun/star/drawing/ConnectorShape.idl +++ b/offapi/com/sun/star/drawing/ConnectorShape.idl @@ -67,15 +67,15 @@ published service ConnectorShape [property] com::sun::star::drawing::XShape EndShape; - /** this property holds the index of the gluepoint the end point of - this connector is glued on. + /** this is the position of the connectors end point in 100th/mm. For + unconnected end points you can get and set the position. For + connected end points you can only get the position. */ [property] com::sun::star::awt::Point EndPosition; - /** this is the position of the connectors end point in 100th/mm. For - unconnected end points you can get and set the position. For - connected end points you can only get the position. + /** this property holds the index of the gluepoint the end point of + this connector is glued on. */ [property] long EndGluePointIndex; diff --git a/offapi/com/sun/star/sdbc/RowIdLifetime.idl b/offapi/com/sun/star/sdbc/RowIdLifetime.idl new file mode 100644 index 000000000000..dad3ff14c6b6 --- /dev/null +++ b/offapi/com/sun/star/sdbc/RowIdLifetime.idl @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + + module com { module sun { module star { module sdbc { + + +/** determines RowId life-time values. + @since LibreOffice 25.2 + */ +constants RowIdLifetime +{ + /** Indicates that this data source does not support the ROWID type. + */ + const long ROWID_UNSUPPORTED = 0; + + /** Indicates that the lifetime of a RowId from this data source is, effectively, unlimited. + */ + const long ROWID_VALID_FOREVER = 1; + + /** Indicates that the lifetime of a RowId from this data source is indeterminate; but not one of ROWID_VALID_TRANSACTION, ROWID_VALID_SESSION, or, ROWID_VALID_FOREVER. + */ + const long ROWID_VALID_OTHER = 2; + + /** Indicates that the lifetime of a RowId from this data source is at least the containing session. + */ + const long ROWID_VALID_SESSION = 3; + + /** Indicates that the lifetime of a RowId from this data source is at least the containing transaction. + */ + const long ROWID_VALID_TRANSACTION = 4; +}; + + +}; }; }; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/offapi/com/sun/star/sdbc/SQLState.idl b/offapi/com/sun/star/sdbc/SQLState.idl new file mode 100644 index 000000000000..0ad319e91c10 --- /dev/null +++ b/offapi/com/sun/star/sdbc/SQLState.idl @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + + module com { module sun { module star { module sdbc { + + +/** determines SQL State values. + @since LibreOffice 25.2 + */ +constants SQLState +{ + /** + * A possible return value for the method + * {@code DatabaseMetaData.getSQLStateType} which is used to indicate + * whether the value returned by the method + * {@code SQLException.getSQLState} is an + * X/Open (now know as Open Group) SQL CLI SQLSTATE value. + * + */ + const long sqlStateXOpen = 1; + + /** + * A possible return value for the method + * {@code DatabaseMetaData.getSQLStateType} which is used to indicate + * whether the value returned by the method + * {@code SQLException.getSQLState} is an SQLSTATE value. + * + */ + const long sqlStateSQL = 2; + + /** + * A possible return value for the method + * {@code DatabaseMetaData.getSQLStateType} which is used to indicate + * whether the value returned by the method + * {@code SQLException.getSQLState} is an SQL99 SQLSTATE value. + *

+ * Note:This constant remains only for compatibility reasons. Developers + * should use the constant {@code sqlStateSQL} instead. + * + */ + const long sqlStateSQL99 = sqlStateSQL; +}; + + +}; }; }; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/offapi/com/sun/star/sdbc/XDatabaseMetaData3.idl b/offapi/com/sun/star/sdbc/XDatabaseMetaData3.idl new file mode 100644 index 000000000000..d1d741ceaab1 --- /dev/null +++ b/offapi/com/sun/star/sdbc/XDatabaseMetaData3.idl @@ -0,0 +1,614 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +module com { module sun { module star { module sdbc { + + +/** extends the XDatabaseMetaData interface to allow retrieval of additional + information. + @since LibreOffice 25.2 + */ +interface XDatabaseMetaData3 : XDatabaseMetaData2 +{ + /** + * Retrieves whether a {@code SQLException} while autoCommit is {@code true} indicates + * that all open ResultSets are closed, even ones that are holdable. When a {@code SQLException} occurs while + * autocommit is {@code true}, it is vendor specific whether the JDBC driver responds with a commit operation, a + * rollback operation, or by doing neither a commit nor a rollback. A potential result of this difference + * is in whether or not holdable ResultSets are closed. + * + * @return {@code true} if so; {@code false} otherwise + * @throws SQLException if a database access error occurs + */ + boolean autoCommitFailureClosesAllResultSets() raises (SQLException); + + /** + * Retrieves whether a generated key will always be returned if the column + * name(s) or index(es) specified for the auto generated key column(s) + * are valid and the statement succeeds. The key that is returned may or + * may not be based on the column(s) for the auto generated key. + * Consult your JDBC driver documentation for additional details. + * @return {@code true} if so; {@code false} otherwise + * @throws SQLException if a database access error occurs + */ + boolean generatedKeyAlwaysReturned() raises (SQLException); + + /** + * Retrieves a description of the given attribute of the given type + * for a user-defined type (UDT) that is available in the given schema + * and catalog. + *

+ * Descriptions are returned only for attributes of UDTs matching the + * catalog, schema, type, and attribute name criteria. They are ordered by + * {@code TYPE_CAT}, {@code TYPE_SCHEM}, + * {@code TYPE_NAME} and {@code ORDINAL_POSITION}. This description + * does not contain inherited attributes. + *

+ * The {@code ResultSet} object that is returned has the following + * columns: + *

    + *
  1. TYPE_CAT String {@code =>} type catalog (may be {@code null}) + *
  2. TYPE_SCHEM String {@code =>} type schema (may be {@code null}) + *
  3. TYPE_NAME String {@code =>} type name + *
  4. ATTR_NAME String {@code =>} attribute name + *
  5. DATA_TYPE int {@code =>} attribute type SQL type from com::sun::star::sdbc::DataType + *
  6. ATTR_TYPE_NAME String {@code =>} Data source dependent type name. + * For a UDT, the type name is fully qualified. For a REF, the type name is + * fully qualified and represents the target type of the reference type. + *
  7. ATTR_SIZE int {@code =>} column size. For char or date + * types this is the maximum number of characters; for numeric or + * decimal types this is precision. + *
  8. DECIMAL_DIGITS int {@code =>} the number of fractional digits. Null is returned for data types where + * DECIMAL_DIGITS is not applicable. + *
  9. NUM_PREC_RADIX int {@code =>} Radix (typically either 10 or 2) + *
  10. NULLABLE int {@code =>} whether NULL is allowed + *
      + *
    • attributeNoNulls - might not allow NULL values + *
    • attributeNullable - definitely allows NULL values + *
    • attributeNullableUnknown - nullability unknown + *
    + *
  11. REMARKS String {@code =>} comment describing column (may be {@code null}) + *
  12. ATTR_DEF String {@code =>} default value (may be {@code null}) + *
  13. SQL_DATA_TYPE int {@code =>} unused + *
  14. SQL_DATETIME_SUB int {@code =>} unused + *
  15. CHAR_OCTET_LENGTH int {@code =>} for char types the + * maximum number of bytes in the column + *
  16. ORDINAL_POSITION int {@code =>} index of the attribute in the UDT + * (starting at 1) + *
  17. IS_NULLABLE String {@code =>} ISO rules are used to determine + * the nullability for a attribute. + *
      + *
    • YES --- if the attribute can include NULLs + *
    • NO --- if the attribute cannot include NULLs + *
    • empty string --- if the nullability for the + * attribute is unknown + *
    + *
  18. SCOPE_CATALOG String {@code =>} catalog of table that is the + * scope of a reference attribute ({@code null} if DATA_TYPE isn't REF) + *
  19. SCOPE_SCHEMA String {@code =>} schema of table that is the + * scope of a reference attribute ({@code null} if DATA_TYPE isn't REF) + *
  20. SCOPE_TABLE String {@code =>} table name that is the scope of a + * reference attribute ({@code null} if the DATA_TYPE isn't REF) + *
  21. SOURCE_DATA_TYPE short {@code =>} source type of a distinct type or user-generated + * Ref type, SQL type from com::sun::star::sdbc::DataType ({@code null} if DATA_TYPE + * isn't DISTINCT or user-generated REF) + *
+ * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * {@code null} means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema name pattern; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * {@code null} means that the schema name should not be used to narrow + * the search + * @param typeNamePattern a type name pattern; must match the + * type name as it is stored in the database + * @param attributeNamePattern an attribute name pattern; must match the attribute + * name as it is declared in the database + * @return a {@code ResultSet} object in which each row is an + * attribute description + * @throws SQLException + * if a database access error occurs. + */ + XResultSet getAttributes([in]string catalog, [in]string schemaPattern, [in]string typeNamePattern, [in]string attributeNamePattern) raises (SQLException); + + /** + * Retrieves a list of the client info properties + * that the driver supports. The result set contains the following columns + * + *
    + *
  1. NAME String{@code =>} The name of the client info property
    + *
  2. MAX_LEN int{@code =>} The maximum length of the value for the property
    + *
  3. DEFAULT_VALUE String{@code =>} The default value of the property
    + *
  4. DESCRIPTION String{@code =>} A description of the property. This will typically + * contain information as to where this property is + * stored in the database. + *
+ *

+ * The {@code ResultSet} is sorted by the NAME column + * + * @return A {@code ResultSet} object; each row is a supported client info + * property + * + * @throws SQLException if a database access error occurs + */ + XResultSet getClientInfoProperties() raises (SQLException); + + /** + * Retrieves the major version number of the underlying database. + * + * @return the underlying database's major version + * @throws SQLException if a database access error occurs + */ + long getDatabaseMajorVersion(); + + /** + * Retrieves the minor version number of the underlying database. + * + * @return underlying database's minor version + * @throws SQLException if a database access error occurs + */ + long getDatabaseMinorVersion(); + + /** + * Retrieves a description of the system and user functions available + * in the given catalog. + *

+ * Only system and user function descriptions matching the schema and + * function name criteria are returned. They are ordered by + * {@code FUNCTION_CAT}, {@code FUNCTION_SCHEM}, + * {@code FUNCTION_NAME} and + * {@code SPECIFIC_NAME}. + * + *

Each function description has the following columns: + *

    + *
  1. FUNCTION_CAT String {@code =>} function catalog (may be {@code null}) + *
  2. FUNCTION_SCHEM String {@code =>} function schema (may be {@code null}) + *
  3. FUNCTION_NAME String {@code =>} function name. This is the name + * used to invoke the function + *
  4. REMARKS String {@code =>} explanatory comment on the function + *
  5. FUNCTION_TYPE short {@code =>} kind of function: + *
      + *
    • functionResultUnknown - Cannot determine if a return value + * or table will be returned + *
    • functionNoTable- Does not return a table + *
    • functionReturnsTable - Returns a table + *
    + *
  6. SPECIFIC_NAME String {@code =>} the name which uniquely identifies + * this function within its schema. This is a user specified, or DBMS + * generated, name that may be different from the {@code FUNCTION_NAME} + * for example with overload functions + *
+ *

+ * A user may not have permission to execute any of the functions that are + * returned by {@code getFunctions} + * + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * {@code null} means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema name pattern; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * {@code null} means that the schema name should not be used to narrow + * the search + * @param functionNamePattern a function name pattern; must match the + * function name as it is stored in the database + * @return {@code ResultSet} - each row is a function description + * @throws SQLException if a database access error occurs + */ + XResultSet getFunctions([in]string catalog, [in]string schemaPattern, [in]string functionNamePattern) raises (SQLException); + + /** + /** + * Retrieves a description of the given catalog's system or user + * function parameters and return type. + * + *

Only descriptions matching the schema, function and + * parameter name criteria are returned. They are ordered by + * {@code FUNCTION_CAT}, {@code FUNCTION_SCHEM}, + * {@code FUNCTION_NAME} and + * {@code SPECIFIC_NAME}. Within this, the return value, + * if any, is first. Next are the parameter descriptions in call + * order. The column descriptions follow in column number order. + * + *

Each row in the {@code ResultSet} + * is a parameter description, column description or + * return type description with the following fields: + *

    + *
  1. FUNCTION_CAT String {@code =>} function catalog (may be {@code null}) + *
  2. FUNCTION_SCHEM String {@code =>} function schema (may be {@code null}) + *
  3. FUNCTION_NAME String {@code =>} function name. This is the name + * used to invoke the function + *
  4. COLUMN_NAME String {@code =>} column/parameter name + *
  5. COLUMN_TYPE Short {@code =>} kind of column/parameter: + *
      + *
    • functionColumnUnknown - nobody knows + *
    • functionColumnIn - IN parameter + *
    • functionColumnInOut - INOUT parameter + *
    • functionColumnOut - OUT parameter + *
    • functionReturn - function return value + *
    • functionColumnResult - Indicates that the parameter or column + * is a column in the {@code ResultSet} + *
    + *
  6. DATA_TYPE int {@code =>} SQL type from com::sun::star::sdbc::DataType + *
  7. TYPE_NAME String {@code =>} SQL type name, for a UDT type the + * type name is fully qualified + *
  8. PRECISION int {@code =>} precision + *
  9. LENGTH int {@code =>} length in bytes of data + *
  10. SCALE short {@code =>} scale - null is returned for data types where + * SCALE is not applicable. + *
  11. RADIX short {@code =>} radix + *
  12. NULLABLE short {@code =>} can it contain NULL. + *
      + *
    • functionNoNulls - does not allow NULL values + *
    • functionNullable - allows NULL values + *
    • functionNullableUnknown - nullability unknown + *
    + *
  13. REMARKS String {@code =>} comment describing column/parameter + *
  14. CHAR_OCTET_LENGTH int {@code =>} the maximum length of binary + * and character based parameters or columns. For any other datatype the returned value + * is a NULL + *
  15. ORDINAL_POSITION int {@code =>} the ordinal position, starting + * from 1, for the input and output parameters. A value of 0 + * is returned if this row describes the function's return value. + * For result set columns, it is the + * ordinal position of the column in the result set starting from 1. + *
  16. IS_NULLABLE String {@code =>} ISO rules are used to determine + * the nullability for a parameter or column. + *
      + *
    • YES --- if the parameter or column can include NULLs + *
    • NO --- if the parameter or column cannot include NULLs + *
    • empty string --- if the nullability for the + * parameter or column is unknown + *
    + *
  17. SPECIFIC_NAME String {@code =>} the name which uniquely identifies + * this function within its schema. This is a user specified, or DBMS + * generated, name that may be different from the {@code FUNCTION_NAME} + * for example with overload functions + *
+ * + *

The PRECISION column represents the specified column size for the given + * parameter or column. + * For numeric data, this is the maximum precision. For character data, this is the length in characters. + * For datetime datatypes, this is the length in characters of the String representation (assuming the + * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, + * this is the length in bytes. Null is returned for data types where the + * column size is not applicable. + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * {@code null} means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema name pattern; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * {@code null} means that the schema name should not be used to narrow + * the search + * @param functionNamePattern a procedure name pattern; must match the + * function name as it is stored in the database + * @param columnNamePattern a parameter name pattern; must match the + * parameter or column name as it is stored in the database + * @return {@code ResultSet} - each row describes a + * user function parameter, column or return type + * + * @throws SQLException if a database access error occurs + */ + XResultSet getFunctionColumns([in]string catalog, [in]string schemaPattern, [in]string functionNamePattern, [in]string columnNamePattern) raises (SQLException); + + + /** + * + * Retrieves the maximum number of bytes this database allows for + * the logical size for a {@code LOB}. + *

+ * The default implementation will return {@code 0} + * + * @return the maximum number of bytes allowed; a result of zero + * means that there is no limit or the limit is not known + * @throws SQLException if a database access error occurs + */ + long getMaxLogicalLobSize() raises (SQLException); + + /** + * Retrieves a description of the pseudo or hidden columns available + * in a given table within the specified catalog and schema. + * Pseudo or hidden columns may not always be stored within + * a table and are not visible in a ResultSet unless they are + * specified in the query's outermost SELECT list. Pseudo or hidden + * columns may not necessarily be able to be modified. If there are + * no pseudo or hidden columns, an empty ResultSet is returned. + * + *

Only column descriptions matching the catalog, schema, table + * and column name criteria are returned. They are ordered by + * {@code TABLE_CAT},{@code TABLE_SCHEM}, {@code TABLE_NAME} + * and {@code COLUMN_NAME}. + * + *

Each column description has the following columns: + *

    + *
  1. TABLE_CAT String {@code =>} table catalog (may be {@code null}) + *
  2. TABLE_SCHEM String {@code =>} table schema (may be {@code null}) + *
  3. TABLE_NAME String {@code =>} table name + *
  4. COLUMN_NAME String {@code =>} column name + *
  5. DATA_TYPE int {@code =>} SQL type from com::sun::star::sdbc::DataType + *
  6. COLUMN_SIZE int {@code =>} column size. + *
  7. DECIMAL_DIGITS int {@code =>} the number of fractional digits. Null is returned for data types where + * DECIMAL_DIGITS is not applicable. + *
  8. NUM_PREC_RADIX int {@code =>} Radix (typically either 10 or 2) + *
  9. COLUMN_USAGE String {@code =>} The allowed usage for the column. The + * value returned will correspond to the enum name returned by {@link PseudoColumnUsage#name PseudoColumnUsage.name()} + *
  10. REMARKS String {@code =>} comment describing column (may be {@code null}) + *
  11. CHAR_OCTET_LENGTH int {@code =>} for char types the + * maximum number of bytes in the column + *
  12. IS_NULLABLE String {@code =>} ISO rules are used to determine the nullability for a column. + *
      + *
    • YES --- if the column can include NULLs + *
    • NO --- if the column cannot include NULLs + *
    • empty string --- if the nullability for the column is unknown + *
    + *
+ * + *

The COLUMN_SIZE column specifies the column size for the given column. + * For numeric data, this is the maximum precision. For character data, this is the length in characters. + * For datetime datatypes, this is the length in characters of the String representation (assuming the + * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, + * this is the length in bytes. Null is returned for data types where the + * column size is not applicable. + * + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * {@code null} means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema name pattern; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * {@code null} means that the schema name should not be used to narrow + * the search + * @param tableNamePattern a table name pattern; must match the + * table name as it is stored in the database + * @param columnNamePattern a column name pattern; must match the column + * name as it is stored in the database + * @return {@code ResultSet} - each row is a column description + * @throws SQLException if a database access error occurs + */ + XResultSet getPseudoColumns([in]string catalog, [in]string schemaPattern, [in]string tableNamePattern, [in]string columnNamePattern) raises (SQLException); + + /** + * Retrieves this database's default holdability for {@code ResultSet} + * objects. + * + * @return the default holdability; either + * {@code ResultSet.HOLD_CURSORS_OVER_COMMIT} or + * {@code ResultSet.CLOSE_CURSORS_AT_COMMIT} + * @throws SQLException if a database access error occurs + */ + long getResultSetHoldability() raises (SQLException); + + /** + * Indicates whether this data source supports the SQL {@code ROWID} type, + * and the lifetime for which a {@link RowId} object remains valid. + * + * @return the status indicating the lifetime of a {@code RowId} + * @throws SQLException if a database access error occurs + * @see RowIdLifetime.idl + */ + long getRowIdLifetime() raises (SQLException); + + /** + * Retrieves the schema names available in this database. The results + * are ordered by {@code TABLE_CATALOG} and + * {@code TABLE_SCHEM}. + * + *

The schema columns are: + *

    + *
  1. TABLE_SCHEM String {@code =>} schema name + *
  2. TABLE_CATALOG String {@code =>} catalog name (may be {@code null}) + *
+ * + * @param catalog an optional catalog name; + * if absent (catalog.IsPresent is false), catalog name is not used to narrow down the search. + * if present, then only the results for which catalog.Value matches the catalog name as it + * is stored in the database; + * Note that catalog.IsPresent and catalog.Value == "" retrieves those without a catalog + * @param schemaPattern a optional schema name; + * if absent means it should not be used to narrow down the search + * if present, must match the schema name as it is stored in the database + * @return a {@code ResultSet} object in which each row is a + * schema description + * @throws SQLException if a database access error occurs + */ + XResultSet getSchemasFiltered([in] com::sun::star::beans::Optional catalog, [in] com::sun::star::beans::Optional schemaPattern) raises (SQLException); + + /** + * Indicates whether the SQLSTATE returned by {@code SQLException.getSQLState} + * is X/Open (now known as Open Group) SQL CLI or SQL:2003. + * @return the type of SQLSTATE; one of: + * sqlStateXOpen or + * sqlStateSQL + * @throws SQLException if a database access error occurs + */ + long getSQLStateType() raises (SQLException); + + /** + * Retrieves a description of the table hierarchies defined in a particular + * schema in this database. + * + *

Only supertable information for tables matching the catalog, schema + * and table name are returned. The table name parameter may be a fully- + * qualified name, in which case, the catalog and schemaPattern parameters + * are ignored. If a table does not have a super table, it is not listed here. + * Supertables have to be defined in the same catalog and schema as the + * sub tables. Therefore, the type description does not need to include + * this information for the supertable. + * + *

Each type description has the following columns: + *

    + *
  1. TABLE_CAT String {@code =>} the type's catalog (may be {@code null}) + *
  2. TABLE_SCHEM String {@code =>} type's schema (may be {@code null}) + *
  3. TABLE_NAME String {@code =>} type name + *
  4. SUPERTABLE_NAME String {@code =>} the direct super type's name + *
+ * + *

Note: If the driver does not support type hierarchies, an + * empty result set is returned. + * + * @param catalog a catalog name; "" retrieves those without a catalog; + * {@code null} means drop catalog name from the selection criteria + * @param schemaPattern a schema name pattern; "" retrieves those + * without a schema + * @param tableNamePattern a table name pattern; may be a fully-qualified + * name + * @return a {@code ResultSet} object in which each row is a type description + * @throws SQLException if a database access error occurs + */ + XResultSet getSuperTables([in]string catalog, [in]string schemaPattern, [in]string tableNamePattern) raises (SQLException); + + /** + * Retrieves a description of the user-defined type (UDT) hierarchies defined in a + * particular schema in this database. Only the immediate super type/ + * sub type relationship is modeled. + *

+ * Only supertype information for UDTs matching the catalog, + * schema, and type name is returned. The type name parameter + * may be a fully-qualified name. When the UDT name supplied is a + * fully-qualified name, the catalog and schemaPattern parameters are + * ignored. + *

+ * If a UDT does not have a direct super type, it is not listed here. + * A row of the {@code ResultSet} object returned by this method + * describes the designated UDT and a direct supertype. A row has the following + * columns: + *

    + *
  1. TYPE_CAT String {@code =>} the UDT's catalog (may be {@code null}) + *
  2. TYPE_SCHEM String {@code =>} UDT's schema (may be {@code null}) + *
  3. TYPE_NAME String {@code =>} type name of the UDT + *
  4. SUPERTYPE_CAT String {@code =>} the direct super type's catalog + * (may be {@code null}) + *
  5. SUPERTYPE_SCHEM String {@code =>} the direct super type's schema + * (may be {@code null}) + *
  6. SUPERTYPE_NAME String {@code =>} the direct super type's name + *
+ * + *

Note: If the driver does not support type hierarchies, an + * empty result set is returned. + * + * @param catalog a catalog name; "" retrieves those without a catalog; + * {@code null} means drop catalog name from the selection criteria + * @param schemaPattern a schema name pattern; "" retrieves those + * without a schema + * @param typeNamePattern a UDT name pattern; may be a fully-qualified + * name + * @return a {@code ResultSet} object in which a row gives information + * about the designated UDT + * @throws SQLException if a database access error occurs + */ + XResultSet getSuperTypes([in]string catalog, [in]string schemaPattern, [in]string typeNamePattern) raises (SQLException); + + /** + * Indicates whether updates made to a LOB are made on a copy or directly + * to the LOB. + * @return {@code true} if updates are made to a copy of the LOB; + * {@code false} if updates are made directly to the LOB + * @throws SQLException if a database access error occurs + */ + boolean locatorsUpdateCopy() raises (SQLException); + + /** + * Retrieves whether this database supports the SQL function CONVERT for the conversion + * between the data types defined in com::sun::star::sdbc::DataType + * (see supportsConvert in com::sun::star::sdbc::XDatabaseMetadata to test for support between specific types) + * @return true if so; false otherwise + * @throws SQLException if a database access error occurs. + */ + boolean supportsConvertInGeneral() + raises (SQLException); + + /** + * Retrieves whether auto-generated keys can be retrieved after + * a statement has been executed + * + * @return {@code true} if auto-generated keys can be retrieved + * after a statement has executed; {@code false} otherwise + *

If {@code true} is returned, the JDBC driver must support the + * returning of auto-generated keys for at least SQL INSERT statements + * + * @throws SQLException if a database access error occurs + */ + boolean supportsGetGeneratedKeys() raises (SQLException); + + /** + * Retrieves whether it is possible to have multiple {@code ResultSet} objects + * returned from a {@code CallableStatement} object + * simultaneously. + * + * @return {@code true} if a {@code CallableStatement} object + * can return multiple {@code ResultSet} objects + * simultaneously; {@code false} otherwise + * @throws SQLException if a database access error occurs + */ + boolean supportsMultipleOpenResults() raises (SQLException); + + /** + * Retrieves whether this database supports named parameters to callable + * statements. + * + * @return {@code true} if named parameters are supported; + * {@code false} otherwise + * @throws SQLException if a database access error occurs + */ + boolean supportsNamedParameters() raises (SQLException); + + /** + * Retrieves whether this database supports REF CURSOR. + *

+ * The default implementation will return {@code false} + * + * @return {@code true} if this database supports REF CURSOR; + * {@code false} otherwise + * @throws SQLException if a database access error occurs + */ + boolean supportsRefCursors() raises (SQLException); + + /** + * Retrieves whether this database supports savepoints. + * + * @return {@code true} if savepoints are supported; + * {@code false} otherwise + * @throws SQLException if a database access error occurs + */ + boolean supportsSavepoints() raises (SQLException); + + /** + * Retrieves whether this database supports sharding. + * @implSpec + * The default implementation will return {@code false} + * + * @return {@code true} if this database supports sharding; + * {@code false} otherwise + * @throws SQLException if a database access error occurs + */ + boolean supportsSharding() raises (SQLException); + + /** + * Retrieves whether this database supports statement pooling. + * + * @return {@code true} if so; {@code false} otherwise + * @throws SQLException if a database access error occurs + */ + boolean supportsStatementPooling() raises (SQLException); + + /** + * Retrieves whether this database supports invoking user-defined or vendor functions + * using the stored procedure escape syntax. + * + * @return {@code true} if so; {@code false} otherwise + * @throws SQLException if a database access error occurs + */ + boolean supportsStoredFunctionsUsingCallSyntax() raises (SQLException); +}; + + +}; }; }; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/offapi/com/sun/star/sheet/Spreadsheet.idl b/offapi/com/sun/star/sheet/Spreadsheet.idl index d1a1dfcd0f18..605055c7b4ec 100644 --- a/offapi/com/sun/star/sheet/Spreadsheet.idl +++ b/offapi/com/sun/star/sheet/Spreadsheet.idl @@ -169,6 +169,19 @@ service Spreadsheet /** specifies all conditional formats of that sheet */ [optional, property] com::sun::star::sheet::XConditionalFormats ConditionalFormats; + + /** specifies whether summary rows appear below detail in an outline, + when applying an outline. + +

When true a summary row is inserted below the detailed data being + summarized and a new outline level is established on that row.

+ +

When false a summary row is inserted above the detailed data being + summarized and a new outline level is established on that row.

+ + @since LibreOffice 25.2 + */ + [optional, property] boolean TotalsRowBelow; }; diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index e2d06989c0f1..3e378f8a8f3b 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -660,6 +660,9 @@ Insert Hyperlink + + .uno:HyperlinkDialog + diff --git a/oox/source/crypto/CryptTools.cxx b/oox/source/crypto/CryptTools.cxx index e8e842abeb43..a7d76b375c39 100644 --- a/oox/source/crypto/CryptTools.cxx +++ b/oox/source/crypto/CryptTools.cxx @@ -286,9 +286,6 @@ struct CryptoImpl mechanism = CKM_AES_ECB; break; case Crypto::CryptoType::AES_128_CBC: - mechanism = CKM_AES_CBC; - pIvItem = &ivItem; - break; case Crypto::CryptoType::AES_256_CBC: mechanism = CKM_AES_CBC; pIvItem = &ivItem; diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index efa7f303662e..cc80c202f90d 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -399,7 +399,7 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat xCustomLabel->setString( pRun->getText() ); xCustomLabel->setFieldType( DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT ); } - aSequenceRange[ nPos++ ] = xCustomLabel; + aSequenceRange[ nPos++ ] = std::move(xCustomLabel); } if( nParagraphs > 1 && nPos < nSequenceSize ) @@ -407,7 +407,7 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat css::uno::Reference< XDataPointCustomLabelField > xCustomLabel = DataPointCustomLabelField::create( xContext ); xCustomLabel->setFieldType( DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_NEWLINE ); xCustomLabel->setString(u"\n"_ustr); - aSequenceRange[ nPos++ ] = xCustomLabel; + aSequenceRange[ nPos++ ] = std::move(xCustomLabel); } } diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index 9207c6244e9c..85de7df3fffc 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -84,7 +84,7 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( sal_Int32 aElementToken, Reference xMediaStream = lcl_GetMediaStream(path, getFilter()); if (xMediaStream.is()) { - mpShapePtr->getGraphicProperties().m_xMediaStream = xMediaStream; + mpShapePtr->getGraphicProperties().m_xMediaStream = std::move(xMediaStream); mpShapePtr->getGraphicProperties().m_sMediaPackageURL = lcl_GetMediaReference(path); } } diff --git a/oox/source/drawingml/misccontexts.cxx b/oox/source/drawingml/misccontexts.cxx index a9070ae8da30..e080f3840e90 100644 --- a/oox/source/drawingml/misccontexts.cxx +++ b/oox/source/drawingml/misccontexts.cxx @@ -323,7 +323,7 @@ BlipContext::BlipContext(ContextHandler2Helper const & rParent, const AttributeL auto xGraphic = aGraphic.GetXGraphic(); mrBlipProps.mxFillGraphic = xGraphic; if (mpBlipFill) - mpBlipFill->mxGraphic = xGraphic; + mpBlipFill->mxGraphic = std::move(xGraphic); } } @@ -632,7 +632,7 @@ ContextHandlerRef BlipExtensionContext::onCreateContext(sal_Int32 nElement, cons // Overwrite the fill graphic with the one containing SVG mrBlipProps.mxFillGraphic = xGraphic; if (mpBlipFill) - mpBlipFill->mxGraphic = xGraphic; + mpBlipFill->mxGraphic = std::move(xGraphic); } } // TODO - link diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index f01c4b90a7a6..991a37c99be0 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -506,7 +506,7 @@ void Shape::addShape( { // Our drawingml::Shape is in the list of an internal name, remember the now // inserted XShape. - it->second = xShape; + it->second = std::move(xShape); } } } diff --git a/oox/source/export/DMLPresetShapeExport.cxx b/oox/source/export/DMLPresetShapeExport.cxx index f74399eb95e7..05f1f92a4f0e 100644 --- a/oox/source/export/DMLPresetShapeExport.cxx +++ b/oox/source/export/DMLPresetShapeExport.cxx @@ -36,7 +36,7 @@ DMLPresetShapeExporter::DMLPresetShapeExporter(DrawingML* pDMLExporter, // This class only work with custom shapes! OSL_ASSERT(xShape->getShapeType() == "com.sun.star.drawing.CustomShape"); - m_xShape = xShape; + m_xShape = std::move(xShape); m_bHasHandleValues = false; uno::Reference xShapeProps(m_xShape, uno::UNO_QUERY); css::uno::Sequence aCustomShapeGeometry diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 189f62ab249a..990b94e350a1 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -2740,7 +2740,7 @@ Reference< XControlModel > EmbeddedForm::convertAndInsert( const EmbeddedControl // convert the control properties if( rControl.convertProperties( xCtrlModel, maControlConv ) ) - xRet = xCtrlModel; + xRet = std::move(xCtrlModel); // insert the control into the form Reference< XIndexContainer > xFormIC( createXForm(), UNO_SET_THROW ); rnCtrlIndex = xFormIC->getCount(); diff --git a/oox/source/ppt/slidetransitioncontext.cxx b/oox/source/ppt/slidetransitioncontext.cxx index e3e77cbeb6a9..a3ad670a676d 100644 --- a/oox/source/ppt/slidetransitioncontext.cxx +++ b/oox/source/ppt/slidetransitioncontext.cxx @@ -80,6 +80,8 @@ SlideTransitionContext::~SlideTransitionContext() noexcept return this; case PPT_TOKEN( cover ): case PPT_TOKEN( pull ): + case PPT_TOKEN( push ): + case PPT_TOKEN( wipe ): if (!mbHasTransition) { mbHasTransition = true; @@ -94,14 +96,6 @@ SlideTransitionContext::~SlideTransitionContext() noexcept maTransition.setOoxTransitionType( aElementToken, sal_Int32(rAttribs.getBool( XML_thruBlk, false )), 0); } return this; - case PPT_TOKEN( push ): - case PPT_TOKEN( wipe ): - if (!mbHasTransition) - { - mbHasTransition = true; - maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_l ), 0 ); - } - return this; case PPT_TOKEN( split ): if (!mbHasTransition) { diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 6140d192b55d..0cb978129ccc 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -613,6 +613,7 @@ TopBorderComplexColor TopBorderDistance TopMargin TotalsRow +TotalsRowBelow Transformation TransitionDirection TransitionDuration diff --git a/osx/soffice.xcodeproj/project.pbxproj b/osx/soffice.xcodeproj/project.pbxproj index eb75e9124779..bc4cb09c9647 100644 --- a/osx/soffice.xcodeproj/project.pbxproj +++ b/osx/soffice.xcodeproj/project.pbxproj @@ -67,7 +67,6 @@ 29F88FB22A554D6F00C77A3F /* udkapi */ = {isa = PBXFileReference; lastKnownFileType = folder; name = udkapi; path = ../udkapi; sourceTree = ""; }; 29F88FB32A554D7000C77A3F /* shell */ = {isa = PBXFileReference; lastKnownFileType = folder; name = shell; path = ../shell; sourceTree = ""; }; 29F88FB42A554D7000C77A3F /* sdext */ = {isa = PBXFileReference; lastKnownFileType = folder; name = sdext; path = ../sdext; sourceTree = ""; }; - 29F88FB52A554D7000C77A3F /* xmerge */ = {isa = PBXFileReference; lastKnownFileType = folder; name = xmerge; path = ../xmerge; sourceTree = ""; }; 29F88FB62A554D7000C77A3F /* qadevOOo */ = {isa = PBXFileReference; lastKnownFileType = folder; name = qadevOOo; path = ../qadevOOo; sourceTree = ""; }; 29F88FB72A554D7000C77A3F /* setup_native */ = {isa = PBXFileReference; lastKnownFileType = folder; name = setup_native; path = ../setup_native; sourceTree = ""; }; 29F88FB82A554D7000C77A3F /* sysui */ = {isa = PBXFileReference; lastKnownFileType = folder; name = sysui; path = ../sysui; sourceTree = ""; }; @@ -285,7 +284,6 @@ 29F88FA92A554D6F00C77A3F /* wizards */, 29F88F8D2A554D6C00C77A3F /* writerfilter */, 29F88FE22A554D7600C77A3F /* writerperfect */, - 29F88FB52A554D7000C77A3F /* xmerge */, 29F88F972A554D6D00C77A3F /* xmlhelp */, 29F88FEB2A554D7800C77A3F /* xmloff */, 29F88FF02A554D7800C77A3F /* xmlreader */, diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 16e04ac6ce76..88c2a4fd5e10 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -500,7 +500,7 @@ void OWriteStream_Impl::FillTempGetFileName() uno::Reference< io::XStream > xCacheStream = CreateMemoryStream( m_xContext ); SAL_WARN_IF( !xCacheStream.is(), "package.xstor", "If the stream can not be created an exception must be thrown!" ); m_xCacheSeek.set( xCacheStream, uno::UNO_QUERY_THROW ); - m_xCacheStream = xCacheStream; + m_xCacheStream = std::move(xCacheStream); } else { @@ -521,7 +521,7 @@ void OWriteStream_Impl::FillTempGetFileName() xOutStream->writeBytes( aData ); } m_xCacheSeek.set( xCacheStream, uno::UNO_QUERY_THROW ); - m_xCacheStream = xCacheStream; + m_xCacheStream = std::move(xCacheStream); m_xCacheSeek->seek( 0 ); } else if ( !m_oTempFile.has_value() ) @@ -801,7 +801,7 @@ void OWriteStream_Impl::Commit() } // the stream should be free soon, after package is stored - m_xPackageStream = xNewPackageStream; + m_xPackageStream = std::move(xNewPackageStream); m_bHasDataToFlush = false; m_bFlushed = true; // will allow to use transaction on stream level if will need it } @@ -2849,7 +2849,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const OUString& aPropertyName, con throw lang::IllegalArgumentException(); // TODO } - m_pImpl->m_xNewRelInfoStream = xInRelStream; + m_pImpl->m_xNewRelInfoStream = std::move(xInRelStream); m_pImpl->m_aNewRelInfo = uno::Sequence< uno::Sequence< beans::StringPair > >(); m_pImpl->m_nRelInfoStatus = RELINFO_CHANGED_STREAM; } diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index e0550695e1dd..c85a83a3f8e1 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1172,7 +1172,7 @@ void OStorage_Impl::Commit() } else if ( !m_bCommited ) { - m_xPackageFolder = xNewPackageFolder; + m_xPackageFolder = std::move(xNewPackageFolder); m_bCommited = true; } @@ -4383,7 +4383,7 @@ void SAL_CALL OStorage::setPropertyValue( const OUString& aPropertyName, const u throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 0 ); } - m_pImpl->m_xNewRelInfoStream = xInRelStream; + m_pImpl->m_xNewRelInfoStream = std::move(xInRelStream); m_pImpl->m_aRelInfo = uno::Sequence< uno::Sequence< beans::StringPair > >(); m_pImpl->m_nRelInfoStatus = RELINFO_CHANGED_STREAM; m_pImpl->m_bBroadcastModified = true; diff --git a/package/source/zipapi/Deflater.cxx b/package/source/zipapi/Deflater.cxx index 9439e3f56bcb..c14765c00ec7 100644 --- a/package/source/zipapi/Deflater.cxx +++ b/package/source/zipapi/Deflater.cxx @@ -47,8 +47,6 @@ void Deflater::init (sal_Int32 nLevelArg, bool bNowrap) case Z_OK: break; case Z_MEM_ERROR: - pStream.reset(); - break; case Z_STREAM_ERROR: pStream.reset(); break; diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 371f37807be9..1b79a3808d95 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1419,7 +1419,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() aZipOut.finish(); if( bUseTemp ) - xResult = xTempIn; + xResult = std::move(xTempIn); // Update our References to point to the new temp file if( !bUseTemp ) diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 536f6658edb1..cc365b63bc50 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -1123,7 +1123,7 @@ void SAL_CALL ZipPackageStream::setRawStream( const uno::Reference< io::XInputSt uno::Reference< io::XSeekable > xSeek( xNewStream, UNO_QUERY_THROW ); xSeek->seek( 0 ); uno::Reference< io::XInputStream > xOldStream = m_xStream; - m_xStream = xNewStream; + m_xStream = std::move(xNewStream); if ( !ParsePackageRawStream() ) { m_xStream = std::move(xOldStream); diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index 56836aed7498..0266afb200a7 100644 --- a/pyuno/source/module/pyuno.cxx +++ b/pyuno/source/module/pyuno.cxx @@ -1725,7 +1725,7 @@ PyRef PyUNO_new ( if (self == nullptr) return PyRef(); // == error self->members = new PyUNOInternals; - self->members->xInvocation = xInvocation; + self->members->xInvocation = std::move(xInvocation); self->members->wrappedObject = targetInterface; return PyRef( reinterpret_cast(self), SAL_NO_ACQUIRE ); diff --git a/pyuno/source/module/pyuno_struct.cxx b/pyuno/source/module/pyuno_struct.cxx index e1592eac929d..977ac8d70e69 100644 --- a/pyuno/source/module/pyuno_struct.cxx +++ b/pyuno/source/module/pyuno_struct.cxx @@ -407,7 +407,7 @@ PyRef PyUNOStruct_new ( if (self == nullptr) return PyRef(); // == error self->members = new PyUNOInternals; - self->members->xInvocation = xInvocation; + self->members->xInvocation = std::move(xInvocation); self->members->wrappedObject = targetInterface; return PyRef( reinterpret_cast(self), SAL_NO_ACQUIRE ); diff --git a/reportdesign/source/core/api/Functions.cxx b/reportdesign/source/core/api/Functions.cxx index 3d8bd6b6d61f..4ac080febf1f 100644 --- a/reportdesign/source/core/api/Functions.cxx +++ b/reportdesign/source/core/api/Functions.cxx @@ -125,7 +125,7 @@ void SAL_CALL OFunctions::replaceByIndex( ::sal_Int32 Index, const uno::Any& Ele TFunctions::iterator aPos = m_aFunctions.begin(); ::std::advance(aPos,Index); aOldElement <<= *aPos; - *aPos = xFunction; + *aPos = std::move(xFunction); } container::ContainerEvent aEvent(static_cast(this), uno::Any(Index), Element, aOldElement); diff --git a/reportdesign/source/core/api/Groups.cxx b/reportdesign/source/core/api/Groups.cxx index 4a1170e4c6b8..a6d9b0633e15 100644 --- a/reportdesign/source/core/api/Groups.cxx +++ b/reportdesign/source/core/api/Groups.cxx @@ -128,7 +128,7 @@ void SAL_CALL OGroups::replaceByIndex( ::sal_Int32 Index, const uno::Any& Elemen TGroups::iterator aPos = m_aGroups.begin(); ::std::advance(aPos,Index); aOldElement <<= *aPos; - *aPos = xGroup; + *aPos = std::move(xGroup); } container::ContainerEvent aEvent(static_cast(this), uno::Any(Index), Element, aOldElement); diff --git a/reportdesign/source/core/api/ReportControlModel.cxx b/reportdesign/source/core/api/ReportControlModel.cxx index 16dee9bd17bc..097e6dbfb322 100644 --- a/reportdesign/source/core/api/ReportControlModel.cxx +++ b/reportdesign/source/core/api/ReportControlModel.cxx @@ -93,7 +93,7 @@ void OReportControlModel::replaceByIndex(::sal_Int32 Index, const uno::Any& Elem ::osl::MutexGuard aGuard(m_rMutex); xBroadcaster = m_pOwner; checkIndex(Index); - m_aFormatConditions[Index] = xElement; + m_aFormatConditions[Index] = std::move(xElement); } container::ContainerEvent aEvent(xBroadcaster, uno::Any(Index), Element, uno::Any()); aContainerListeners.notifyEach(&container::XContainerListener::elementReplaced, aEvent); diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index d899534957d0..e6d0496a9548 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -1201,18 +1201,17 @@ uno::Reference< style::XStyle> getUsedStyle(const uno::Reference< report::XRepor uno::Reference xStyles = _xReport->getStyleFamilies(); uno::Reference xPageStyles(xStyles->getByName(u"PageStyles"_ustr),uno::UNO_QUERY); - uno::Reference< style::XStyle> xReturn; const uno::Sequence< OUString> aSeq = xPageStyles->getElementNames(); for(const OUString& rName : aSeq) { uno::Reference< style::XStyle> xStyle(xPageStyles->getByName(rName),uno::UNO_QUERY); if ( xStyle->isInUse() ) { - xReturn = xStyle; + return xStyle; break; } } - return xReturn; + return nullptr; } diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index 8080f5d1a33b..a067cf166795 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -1093,9 +1093,8 @@ void OGroupsSortingDialog::displayGroup(const uno::Reference& _x case report::GroupOn::DEFAULT: nPos = 0; break; + case report::GroupOn::INTERVAL: case report::GroupOn::PREFIX_CHARACTERS: - nPos = 1; - break; case report::GroupOn::YEAR: nPos = 1; break; @@ -1117,9 +1116,6 @@ void OGroupsSortingDialog::displayGroup(const uno::Reference& _x case report::GroupOn::MINUTE: nPos = 7; break; - case report::GroupOn::INTERVAL: - nPos = 1; - break; default: nPos = 0; } diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index d21e40262464..bc572efa2224 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -2517,7 +2517,7 @@ sal_Bool SAL_CALL OReportController::attachModel(const uno::Reference< frame::XM if ( !xTestSuppUndo.is() ) return false; - m_xReportDefinition = xReportDefinition; + m_xReportDefinition = std::move(xReportDefinition); return true; } @@ -2954,7 +2954,7 @@ uno::Reference< sdbc::XRowSet > const & OReportController::getRowSet() aPropertyMediation.emplace( PROPERTY_FILTER, TPropertyConverter(PROPERTY_FILTER,aNoConverter) ); m_xRowSetMediator = new OPropertyMediator( m_xReportDefinition, xRowSetProp, std::move(aPropertyMediation) ); - m_xRowSet = xRowSet; + m_xRowSet = std::move(xRowSet); } catch(const uno::Exception&) { @@ -3393,7 +3393,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) OSL_VERIFY( xParamCol->getPropertyValue(u"Name"_ustr) >>= sParamName ); if ( sParamName == sColumnName ) { - xField = xParamCol; + xField = std::move(xParamCol); break; } } diff --git a/xmerge/Makefile b/sc/CppunitTest_sc_ucalc_nanpayload.mk similarity index 64% rename from xmerge/Makefile rename to sc/CppunitTest_sc_ucalc_nanpayload.mk index 0997e628485b..08900a217f6d 100644 --- a/xmerge/Makefile +++ b/sc/CppunitTest_sc_ucalc_nanpayload.mk @@ -1,4 +1,5 @@ # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#************************************************************************* # # This file is part of the LibreOffice project. # @@ -6,9 +7,8 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # +#************************************************************************* -module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) - -include $(module_directory)/../solenv/gbuild/partial_build.mk +$(eval $(call sc_ucalc_test,_nanpayload)) # vim: set noet sw=4 ts=4: diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 4d9f7c9618a6..63dc4b92b90d 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -43,6 +43,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\ Library_scqahelper \ $(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \ CppunitTest_sc_ucalc) \ + CppunitTest_sc_ucalc_nanpayload \ CppunitTest_sc_ucalc_condformat \ CppunitTest_sc_ucalc_copypaste \ CppunitTest_sc_ucalc_datatransformation \ diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx index a4a985e2d9cc..5227001a76e3 100644 --- a/sc/inc/cellform.hxx +++ b/sc/inc/cellform.hxx @@ -28,6 +28,7 @@ class ScAddress; class ScDocument; struct ScInterpreterContext; struct ScRefCellValue; +namespace svl { class SharedStringPool; } class SC_DLLPUBLIC ScCellFormat { @@ -43,18 +44,22 @@ public: const Color** ppColor, ScInterpreterContext* pContext, bool bNullVals = true, bool bFormula = false ); - // Note that if pShared is set and a value is returned that way, the returned OUString is empty. - static OUString GetInputString( + static svl::SharedString GetInputSharedString( const ScRefCellValue& rCell, sal_uInt32 nFormat, ScInterpreterContext* pContext, - const ScDocument& rDoc, const svl::SharedString** pShared = nullptr, bool bFiltering = false, - bool bForceSystemLocale = false ); + const ScDocument& rDoc, svl::SharedStringPool& rStrPool, + bool bFiltering = false, bool bForceSystemLocale = false ); + + // Similar to GetInputSharedString, but can be used to visit the source of the + // svl::SharedString to avoid reference counting overhead + template + static auto visitInputSharedString( + const ScRefCellValue& rCell, sal_uInt32 nFormat, ScInterpreterContext* pContext, + const ScDocument& rDoc, svl::SharedStringPool& rStrPool, + bool bFiltering, bool bForceSystemLocale, const TFunctor& rOper); static OUString GetInputString( const ScRefCellValue& rCell, sal_uInt32 nFormat, ScInterpreterContext* pContext, - const ScDocument& rDoc, bool bFiltering, bool bForceSystemLocale = false ) - { - return GetInputString( rCell, nFormat, pContext, rDoc, nullptr, bFiltering, bForceSystemLocale ); - } + const ScDocument& rDoc, bool bFiltering = false, bool bForceSystemLocale = false ); static OUString GetOutputString( ScDocument& rDoc, const ScAddress& rPos, const ScRefCellValue& rCell ); diff --git a/sc/inc/cellformtmpl.hxx b/sc/inc/cellformtmpl.hxx new file mode 100644 index 000000000000..a36ba17a8bbb --- /dev/null +++ b/sc/inc/cellformtmpl.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "cellform.hxx" + +#include +#include +#include + +#include "formulacell.hxx" +#include "document.hxx" +#include "cellvalue.hxx" +#include +#include "editutil.hxx" + +template +auto ScCellFormat::visitInputSharedString(const ScRefCellValue& rCell, sal_uInt32 nFormat, + ScInterpreterContext* pContext, const ScDocument& rDoc, + svl::SharedStringPool& rStrPool, bool bFiltering, + bool bForceSystemLocale, const TFunctor& rOper) +{ + ScInterpreterContext& rContext = pContext ? *pContext : rDoc.GetNonThreadedContext(); + + switch (rCell.getType()) + { + case CELLTYPE_STRING: + case CELLTYPE_EDIT: + return rOper(rCell.getSharedString(&rDoc, rStrPool)); + case CELLTYPE_VALUE: + return rOper(rStrPool.intern(rContext.NFGetInputLineString( + rCell.getDouble(), nFormat, bFiltering, bForceSystemLocale))); + break; + case CELLTYPE_FORMULA: + { + ScFormulaCell* pFC = rCell.getFormula(); + const FormulaError nErrCode = pFC->GetErrCode(); + if (nErrCode != FormulaError::NONE) + return rOper(svl::SharedString::getEmptyString()); + else if (pFC->IsEmptyDisplayedAsString()) + return rOper(svl::SharedString::getEmptyString()); + else if (pFC->IsValue()) + return rOper(rStrPool.intern(rContext.NFGetInputLineString( + pFC->GetValue(), nFormat, bFiltering, bForceSystemLocale))); + else + return rOper(pFC->GetString()); + } + case CELLTYPE_NONE: + default: + return rOper(svl::SharedString::getEmptyString()); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx index d5a29c607c90..531f477acb2e 100644 --- a/sc/inc/cellvalue.hxx +++ b/sc/inc/cellvalue.hxx @@ -22,6 +22,7 @@ struct ScRefCellValue; namespace sc { struct ColumnBlockPosition; } +namespace svl { class SharedStringPool; } /** * Store arbitrary cell value of any kind. It only stores cell value and @@ -174,6 +175,7 @@ public: * ScEditUtil::GetString(). */ SC_DLLPUBLIC OUString getString( const ScDocument* pDoc ) const; + SC_DLLPUBLIC svl::SharedString getSharedString( const ScDocument* pDoc, svl::SharedStringPool& rStrPool ) const; /** * Retrieve a string value without modifying the states of any objects in diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 33fe7ca97361..04aa7ea18d2d 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -412,6 +412,23 @@ public: SC_DLLPUBLIC static void CheckTabQuotes( OUString& aTabName, const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO ); + /** Concatenates two sheet names in Excel syntax, i.e. 'Sheet1:Sheet2' + instead of 'Sheet1':'Sheet2' or 'Sheet1':Sheet2 or Sheet1:'Sheet2'. + + @param rBuf + Contains the first sheet name already, in the correct quoted 'Sheet''1' or + unquoted Sheet1 form if plain name. + + @param nQuotePos + Start position, of the first sheet name if unquoted, or its + opening quote. + + @param rEndTabName + Second sheet name to append, in the correct quoted 'Sheet''2' + or unquoted Sheet2 form if plain name. + */ + static void FormExcelSheetRange( OUStringBuffer& rBuf, sal_Int32 nQuotePos, const OUString& rEndTabName ); + /** Analyzes a string for a 'Doc'#Tab construct, or 'Do''c'#Tab etc... @returns the position of the unquoted # hash mark in 'Doc'#Tab, or diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 43a08fcdc7b0..bf8eaa34f2f2 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -982,6 +982,8 @@ public: SC_DLLPUBLIC bool GetName( SCTAB nTab, OUString& rName ) const; SC_DLLPUBLIC bool GetCodeName( SCTAB nTab, OUString& rName ) const; SC_DLLPUBLIC bool SetCodeName( SCTAB nTab, const OUString& rName ); + SC_DLLPUBLIC bool GetTotalsRowBelow( SCTAB nTab ) const; + SC_DLLPUBLIC bool SetTotalsRowBelow( SCTAB nTab, bool bVal ); SC_DLLPUBLIC bool GetTable( const OUString& rName, SCTAB& rTab ) const; SC_DLLPUBLIC SCCOL MaxCol() const { return mxSheetLimits->mnMaxCol; } SC_DLLPUBLIC SCROW MaxRow() const { return mxSheetLimits->mnMaxRow; } diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index e2174c4e5c80..743a57913196 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -536,7 +536,7 @@ #define STR_UNDO_CONDFORMAT NC_("STR_UNDO_CONDFORMAT", "Conditional Format") #define STR_UNDO_CONDFORMAT_LIST NC_("STR_UNDO_CONDFORMAT_LIST", "Conditional Formats") #define STR_UNDO_FORMULA_TO_VALUE NC_("STR_UNDO_FORMULA_TO_VALUE", "Convert Formula To Value") -#define STR_UNQUOTED_STRING NC_("STR_UNQUOTED_STRING", "Strings without quotes are interpreted as defined names or references or column/row labels.") +#define STR_UNQUOTED_STRING NC_("STR_UNQUOTED_STRING", "Strings without double quotes are interpreted as defined names or references or column/row labels.") #define STR_ENTER_VALUE NC_("STR_ENTER_VALUE", "Enter a value!") #define STR_TABLE_COUNT NC_("STR_TABLE_COUNT", "Sheet %1 of %2") #define STR_FUNCTIONS_FOUND NC_("STR_FUNCTIONS_FOUND", "%1 and %2 more") @@ -582,11 +582,11 @@ #define STR_SENSITIVITY_VARCELLS NC_("STR_SENSITIVITY_VARCELLS", "Variable Cells") #define STR_SENSITIVITY_CONSTRAINTS NC_("STR_SENSITIVITY_CONSTRAINTS", "Constraints") #define STR_SENSITIVITY_CELL NC_("STR_SENSITIVITY_CELL", "Cell") -#define STR_SENSITIVITY_FINALVALUE NC_("STR_SENSITIVITY_CELL", "Final Value") -#define STR_SENSITIVITY_REDUCED NC_("STR_SENSITIVITY_CELL", "Reduced Cost") -#define STR_SENSITIVITY_OBJCOEFF NC_("STR_SENSITIVITY_CELL", "Objective Coefficient") -#define STR_SENSITIVITY_DECREASE NC_("STR_SENSITIVITY_CELL", "Allowable Decrease") -#define STR_SENSITIVITY_INCREASE NC_("STR_SENSITIVITY_CELL", "Allowable Increase") +#define STR_SENSITIVITY_FINALVALUE NC_("STR_SENSITIVITY_FINALVALUE", "Final Value") +#define STR_SENSITIVITY_REDUCED NC_("STR_SENSITIVITY_REDUCED", "Reduced Cost") +#define STR_SENSITIVITY_OBJCOEFF NC_("STR_SENSITIVITY_OBJCOEFF", "Objective Coefficient") +#define STR_SENSITIVITY_DECREASE NC_("STR_SENSITIVITY_DECREASE", "Allowable Decrease") +#define STR_SENSITIVITY_INCREASE NC_("STR_SENSITIVITY_INCREASE", "Allowable Increase") #define STR_SENSITIVITY_SHADOWPRICE NC_("STR_SENSITIVITY_SHADOWPRICE", "Shadow Price") #define STR_SENSITIVITY_RHS NC_("STR_SENSITIVITY_RHS", "Constraint R.H. Side") diff --git a/sc/inc/interpretercontext.hxx b/sc/inc/interpretercontext.hxx index cd72d19eb9b6..4f66f29e31b6 100644 --- a/sc/inc/interpretercontext.hxx +++ b/sc/inc/interpretercontext.hxx @@ -79,8 +79,8 @@ struct ScInterpreterContext bool NFIsNumberFormat(const OUString& sString, sal_uInt32& F_Index, double& fOutNumber, SvNumInputOptions eInputOptions = SvNumInputOptions::NONE); - void NFGetInputLineString(const double& fOutNumber, sal_uInt32 nFIndex, OUString& rOutString, - bool bFiltering = false, bool bForceSystemLocale = false) const; + OUString NFGetInputLineString(const double& fOutNumber, sal_uInt32 nFIndex, + bool bFiltering = false, bool bForceSystemLocale = false) const; void NFGetOutputString(const double& fOutNumber, sal_uInt32 nFIndex, OUString& sOutString, const Color** ppColor, bool bUseStarFormat = false) const; diff --git a/sc/inc/queryevaluator.hxx b/sc/inc/queryevaluator.hxx index 6d3012141db8..ff086e9fa8bf 100644 --- a/sc/inc/queryevaluator.hxx +++ b/sc/inc/queryevaluator.hxx @@ -91,9 +91,9 @@ class ScQueryEvaluator bool isFastCompareByString(const ScQueryEntry& rEntry) const; template - std::pair - compareByString(const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem, - const svl::SharedString* pValueSource1, const OUString* pValueSource2); + std::pair compareByString(const ScQueryEntry& rEntry, + const ScQueryEntry::Item& rItem, + const ScRefCellValue& rCell, SCROW nRow); std::pair compareByTextColor(SCCOL nCol, SCROW nRow, const ScQueryEntry::Item& rItem); std::pair compareByBackgroundColor(SCCOL nCol, SCROW nRow, @@ -106,6 +106,13 @@ class ScQueryEvaluator std::pair processEntry(SCROW nRow, SCCOL nCol, ScRefCellValue& aCell, const ScQueryEntry& rEntry, size_t nEntryIndex); + bool equalCellSharedString(const ScRefCellValue& rCell, SCROW nRow, SCCOLROW nField, + bool bCaseSens, const svl::SharedString& rString); + + template + auto visitCellSharedString(const ScRefCellValue& rCell, SCROW nRow, SCCOL nCol, + const TFunctor& rOper); + public: ScQueryEvaluator(ScDocument& rDoc, const ScTable& rTab, const ScQueryParam& rParam, ScInterpreterContext* pContext = nullptr, bool* pTestEqualCondition = nullptr, @@ -118,8 +125,8 @@ public: const ScRefCellValue& rCell); static bool isQueryByString(ScQueryOp eOp, ScQueryEntry::QueryType eType, const ScRefCellValue& rCell); - OUString getCellString(const ScRefCellValue& rCell, SCROW nRow, SCCOL nCol, - const svl::SharedString** sharedString); + OUString getCellString(const ScRefCellValue& rCell, SCROW nRow, SCCOL nCol); + svl::SharedString getCellSharedString(const ScRefCellValue& rCell, SCROW nRow, SCCOL nCol); static bool isMatchWholeCell(const ScDocument& rDoc, ScQueryOp eOp); }; diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx index 2d31c4ee8024..206ec79dc507 100644 --- a/sc/inc/stlpool.hxx +++ b/sc/inc/stlpool.hxx @@ -57,7 +57,8 @@ public: ScStyleSheet* FindAutoStyle(const OUString& rName); SC_DLLPUBLIC virtual SfxStyleSheetBase& Make( const OUString&, SfxStyleFamily eFam, - SfxStyleSearchBits nMask = SfxStyleSearchBits::All) override; + SfxStyleSearchBits nMask = SfxStyleSearchBits::All, + const OUString& rParentStyleSheetName = u""_ustr) override; void setAllParaStandard(); @@ -68,7 +69,8 @@ private: virtual rtl::Reference Create( const OUString& rName, SfxStyleFamily eFamily, - SfxStyleSearchBits nMask) override; + SfxStyleSearchBits nMask, + const OUString& rParentStyleSheetName) override; virtual rtl::Reference Create( const SfxStyleSheetBase& rStyle ) override; SfxStyleSheetBase* pActualStyleSheet; diff --git a/sc/inc/stlsheet.hxx b/sc/inc/stlsheet.hxx index e1e2c5b85ef5..6eab3e5a1128 100644 --- a/sc/inc/stlsheet.hxx +++ b/sc/inc/stlsheet.hxx @@ -60,7 +60,8 @@ private: ScStyleSheet( const OUString& rName, const ScStyleSheetPool& rPool, SfxStyleFamily eFamily, - SfxStyleSearchBits nMask ); + SfxStyleSearchBits nMask, + const OUString& rParentStyleSheetName ); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; diff --git a/sc/inc/subtotalparam.hxx b/sc/inc/subtotalparam.hxx index 8e36dad83987..3b379edb167d 100644 --- a/sc/inc/subtotalparam.hxx +++ b/sc/inc/subtotalparam.hxx @@ -24,6 +24,7 @@ struct SC_DLLPUBLIC ScSubTotalParam bool bPagebreak:1; ///< page break at change of group bool bCaseSens:1; bool bDoSort:1; ///< presort + bool bSummaryBelow:1; ///< Summary below or above (default: below) bool bAscending:1; ///< sort ascending bool bUserDef:1; ///< sort user defined bool bIncludePattern:1; ///< sort formats diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 7da55e4cb3ee..b70f77c95445 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -253,6 +253,7 @@ private: bool bActiveScenario:1; bool mbPageBreaksValid:1; bool mbForceBreaks:1; + bool mbTotalsRowBelow:1; /** this is touched from formula group threading context */ std::atomic bStreamValid; @@ -394,6 +395,9 @@ public: const OUString& GetCodeName() const { return aCodeName; } void SetCodeName( const OUString& rNewName ) { aCodeName = rNewName; } + bool GetTotalsRowBelow() const { return mbTotalsRowBelow; } + void SetTotalsRowBelow( bool bNewVal ) { mbTotalsRowBelow = bNewVal; } + const OUString& GetUpperName() const; const OUString& GetPageStyle() const { return aPageStyle; } diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 916fd839d4b7..0d8fd9dbd696 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -192,6 +192,7 @@ inline constexpr OUString SC_UNONAME_TABLAYOUT = u"TableLayout"_ustr; inline constexpr OUString SC_UNONAME_AUTOPRINT = u"AutomaticPrintArea"_ustr; inline constexpr OUString SC_UNONAME_TABCOLOR = u"TabColor"_ustr; inline constexpr OUString SC_UNONAME_CONDFORMAT = u"ConditionalFormats"_ustr; +inline constexpr OUString SC_UNONAME_TOTALBELOW = u"TotalsRowBelow"_ustr; inline constexpr OUString SC_UNONAME_VISFLAG = u"VisibleFlag"_ustr; diff --git a/sc/inc/unowids.hxx b/sc/inc/unowids.hxx index b5de8f1f292c..389b2dda0da2 100644 --- a/sc/inc/unowids.hxx +++ b/sc/inc/unowids.hxx @@ -75,7 +75,8 @@ #define SC_WID_UNO_FORMRT2 ( SC_WID_UNO_START + 46 ) #define SC_WID_UNO_CELLCONTENTTYPE ( SC_WID_UNO_START + 47 ) #define SC_WID_UNO_SOLVERSETTINGS ( SC_WID_UNO_START + 48 ) -#define SC_WID_UNO_END ( SC_WID_UNO_START + 48 ) +#define SC_WID_UNO_TOTALBELOW ( SC_WID_UNO_START + 49 ) +#define SC_WID_UNO_END ( SC_WID_UNO_START + 49 ) inline bool IsScUnoWid( sal_uInt16 nWid ) { diff --git a/sc/qa/uitest/calc_tests8/tdf144457.py b/sc/qa/uitest/calc_tests8/tdf144457.py index 575171580a4f..d4a1f4d31f2a 100644 --- a/sc/qa/uitest/calc_tests8/tdf144457.py +++ b/sc/qa/uitest/calc_tests8/tdf144457.py @@ -26,7 +26,7 @@ class tdf144457(UITestCase): xDatePatterns = xDialog.getChild("datepatterns") - self.assertEqual("M/D/Y;M/D", get_state_as_dict(xDatePatterns)['Text']) + self.assertEqual("M/D;M/D/Y", get_state_as_dict(xDatePatterns)['Text']) try: xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) diff --git a/sc/qa/uitest/data/tdf162262.ods b/sc/qa/uitest/data/tdf162262.ods new file mode 100644 index 000000000000..138348366298 Binary files /dev/null and b/sc/qa/uitest/data/tdf162262.ods differ diff --git a/sc/qa/uitest/sort/subtotals.py b/sc/qa/uitest/sort/subtotals.py index b824dcab98c8..6eddd1bc03b4 100644 --- a/sc/qa/uitest/sort/subtotals.py +++ b/sc/qa/uitest/sort/subtotals.py @@ -137,4 +137,113 @@ class Subtotals(UITestCase): self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 1) self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 2) + def test_tdf162262(self): + with self.ui_test.load_file(get_url_for_data_file("tdf162262.ods")) as calc_doc: + XcalcDoc = self.xUITest.getTopFocusWindow() + gridwin = XcalcDoc.getChild("grid_window") + # One group level + # Select cell range + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C15"})) + # Select from the menu bar Data + # Select option subtotal + # Subtotal dialog displays + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: + # Select group by: Day + xGroupBy = xDialog.getChild("group_by1") + select_by_text(xGroupBy, "Day") + # Select 'Calculate subtotals for' -> Value 1 and Value 2 + xCheckListMenu = xDialog.getChild("grid1") + xTreeList = xCheckListMenu.getChild("columns1") + xFirstEntry = xTreeList.getChild("1") + xFirstEntry.executeAction("CLICK", tuple()) + xFirstEntry = xTreeList.getChild("2") + xFirstEntry.executeAction("CLICK", tuple()) + + # Select tab options + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + # Unselect option Summary below -> false + xSummarybelow = xDialog.getChild("summarybelow") + xSummarybelow.executeAction("CLICK", tuple()) + # apply with OK + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "Grand Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 105) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 119) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getString(), "Friday Result") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 19) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 21) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 20).getString(), "Wednesday Result") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 20).getValue(), 11) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 20).getValue(), 13) + + def test_tdf162262_multi(self): + with self.ui_test.load_file(get_url_for_data_file("tdf162262.ods")) as calc_doc: + XcalcDoc = self.xUITest.getTopFocusWindow() + gridwin = XcalcDoc.getChild("grid_window") + # Multi group level + # Select cell range + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C15"})) + # Select from the menu bar Data + # Select option subtotal + # Subtotal dialog displays + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: + # Select group by 1: Day + xGroupBy = xDialog.getChild("group_by1") + select_by_text(xGroupBy, "Day") + # Select 'Calculate subtotals for' -> Value 1 + xCheckListMenu = xDialog.getChild("grid1") + xTreeList = xCheckListMenu.getChild("columns1") + # Select 1 column + xFirstEntry = xTreeList.getChild("1") + xFirstEntry.executeAction("CLICK", tuple()) + + # Select tab Group by 2 + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + # Select group by 2: Day + xGroupBy = xDialog.getChild("group_by2") + select_by_text(xGroupBy, "Day") + # Select 'Calculate subtotals for' -> Value 2 + xCheckListMenu = xDialog.getChild("grid2") + xTreeList = xCheckListMenu.getChild("columns2") + # Select second column + xFirstEntry = xTreeList.getChild("2") + xFirstEntry.executeAction("CLICK", tuple()) + + # Select tab options + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + # Unselect option Summary below -> false + xSummarybelow = xDialog.getChild("summarybelow") + xSummarybelow.executeAction("CLICK", tuple()) + # apply with OK + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "Grand Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 119) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getString(), "Grand Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 105) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 0) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getString(), "Friday Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 21) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getString(), "Friday Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 19) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 0) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 27).getString(), "Wednesday Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 27).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 27).getValue(), 13) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 28).getString(), "Wednesday Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 28).getValue(), 11) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 28).getValue(), 0) + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/unit/data/xlsx/subtotal-above.xlsx b/sc/qa/unit/data/xlsx/subtotal-above.xlsx new file mode 100644 index 000000000000..b271dbab19be Binary files /dev/null and b/sc/qa/unit/data/xlsx/subtotal-above.xlsx differ diff --git a/sc/qa/unit/data/xlsx/tdf163554.xlsx b/sc/qa/unit/data/xlsx/tdf163554.xlsx new file mode 100644 index 000000000000..f8d4cb753c14 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf163554.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 260c33a4dfbe..fdb3b6f9a876 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -398,6 +398,18 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf81470) assertXPath(pHeaders, "/x:headers/x:header[3]", "userName", u"Kohei Yoshida"); } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf162262) +{ + createScDoc("xlsx/subtotal-above.xlsx"); + + save(u"Calc Office Open XML"_ustr); + + xmlDocUniquePtr pSheet = parseExport(u"xl/worksheets/sheet1.xml"_ustr); + CPPUNIT_ASSERT(pSheet); + + assertXPath(pSheet, "/x:worksheet/x:sheetPr/x:outlinePr", "summaryBelow", u"0"); +} + CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf122331) { createScDoc("ods/tdf122331.ods"); @@ -1979,6 +1991,26 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testChangesAuthorDateXLSX) pBatch->commit(); } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf163554) +{ + createScDoc("xlsx/tdf163554.xlsx"); + ScDocument* pDoc = getScDoc(); + + // Without the fix in place, this test would have failed with + // - Expected: =SUM($'time (misc) - last'.B1:$'time (pnrst)'.B1) + // - Actual : =SUM('time (pnrst)':$'time (misc) - last'.B1:B1) + CPPUNIT_ASSERT_EQUAL(u"=SUM($'time (misc) - last'.B1:$'time (pnrst)'.B1)"_ustr, + pDoc->GetFormula(0, 0, 0)); + CPPUNIT_ASSERT_EQUAL(u"7"_ustr, pDoc->GetString(ScAddress(0, 0, 0))); + + saveAndReload(u"Calc Office Open XML"_ustr); + pDoc = getScDoc(); + + CPPUNIT_ASSERT_EQUAL(u"=SUM($'time (misc) - last'.B1:$'time (pnrst)'.B1)"_ustr, + pDoc->GetFormula(0, 0, 0)); + CPPUNIT_ASSERT_EQUAL(u"7"_ustr, pDoc->GetString(ScAddress(0, 0, 0))); +} + CPPUNIT_TEST_FIXTURE(ScExportTest4, testNotesAuthor) { createScDoc("xlsx/cell-note.xlsx"); diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 1c7e649d2e96..43569fa4fa47 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -617,20 +617,32 @@ public: case LOK_CALLBACK_STATE_CHANGED: { std::stringstream aStream(pPayload); - if (!aStream.str().starts_with("{")) - { - break; - } - boost::property_tree::ptree aTree; - boost::property_tree::read_json(aStream, aTree); - auto it = aTree.find("commandName"); - if (it == aTree.not_found()) + std::string aCommandName; + + if (aStream.str().starts_with("{")) { - break; + boost::property_tree::read_json(aStream, aTree); + auto it = aTree.find("commandName"); + if (it == aTree.not_found()) + { + break; + } + + aCommandName = it->second.get_value(); + } + else + { + std::string aState = aStream.str(); + auto it = aState.find("="); + if (it == std::string::npos) + { + break; + } + aCommandName = aState.substr(0, it); + aTree.put("state", aState.substr(it + 1)); } - std::string aCommandName = it->second.get_value(); m_aStateChanges[aCommandName] = aTree; } break; @@ -3992,6 +4004,46 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testLeftOverflowEdit) CPPUNIT_ASSERT_EQUAL(tools::Long(20), aView.m_aTextSelectionResult.m_aRefPoint.getX()); } +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testFreezeRowOrColumn) +{ + createDoc("empty.ods"); + ViewCallback aView; + SfxViewShell* pView = SfxViewShell::Current(); + + // Freeze panes on a column and receive the proper state back + aView.m_aStateChanges.clear(); + uno::Sequence aPropertyValues = { + comphelper::makePropertyValue("Index", uno::Any(static_cast(8))), + }; + comphelper::dispatchCommand(".uno:FreezePanesColumn", aPropertyValues); + Scheduler::ProcessEventsToIdle(); + pView->GetViewFrame().GetBindings().GetTimer().Invoke(); + pView->GetViewFrame().GetBindings().GetTimer().Invoke(); + auto it = aView.m_aStateChanges.find(".uno:FreezePanesColumn"); + CPPUNIT_ASSERT(it != aView.m_aStateChanges.end()); + std::string values = it->second.get("state"); + std::string index = values.substr(0, values.find(' ')); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 8 + // - Actual : 1 + CPPUNIT_ASSERT_EQUAL(std::string("8"), index); + + // Freeze panes on a row and receive the proper state back + aView.m_aStateChanges.clear(); + comphelper::dispatchCommand(".uno:FreezePanesRow", aPropertyValues); + Scheduler::ProcessEventsToIdle(); + pView->GetViewFrame().GetBindings().GetTimer().Invoke(); + pView->GetViewFrame().GetBindings().GetTimer().Invoke(); + it = aView.m_aStateChanges.find(".uno:FreezePanesRow"); + CPPUNIT_ASSERT(it != aView.m_aStateChanges.end()); + values = it->second.get("state"); + index = values.substr(0, values.find(' ')); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 8 + // - Actual : 1 + CPPUNIT_ASSERT_EQUAL(std::string("8"), index); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/ucalc_nanpayload.cxx b/sc/qa/unit/ucalc_nanpayload.cxx new file mode 100644 index 000000000000..c64acd3f5bf4 --- /dev/null +++ b/sc/qa/unit/ucalc_nanpayload.cxx @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "helper/qahelper.hxx" +#include + +class TestNanPayload : public ScUcalcTestBase +{ +}; + +CPPUNIT_TEST_FIXTURE(TestNanPayload, testNanPayload) +{ + // Some tests, such as testExternalRefFunctions, testFuncGCD, and testFuncGCD, evaluates + // spreadsheet functions' error code, which need NaN payload feature of the hardware + NanPayloadTest nanTest; + CPPUNIT_ASSERT_MESSAGE(nanTest.getMessage(), nanTest.getIfSupported()); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index d43d4ceea390..b8f8aa2dd505 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -1979,7 +1979,7 @@ SfxVoidItem FreezePanes SID_WINDOW_FIX ] SfxPointItem FreezePanesColumn SID_WINDOW_FIX_COL - +(SfxInt32Item Index FN_PARAM_1) [ AutoUpdate = FALSE, FastCall = FALSE, @@ -1996,7 +1996,7 @@ SfxPointItem FreezePanesColumn SID_WINDOW_FIX_COL ] SfxPointItem FreezePanesRow SID_WINDOW_FIX_ROW - +(SfxInt32Item Index FN_PARAM_1) [ AutoUpdate = FALSE, FastCall = FALSE, diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 94b9153b1c41..852db370cf54 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -1807,6 +1807,8 @@ void ScAttrArray::FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBo SCSIZE nPos = 0; while (nPos < mvData.size()) { + bool bIterateNext = true; + SCROW nEnd = mvData[nPos].nEndRow; if (mvData[nPos].getScPatternAttr()->GetStyleSheet() == pStyleSheet) { @@ -1825,12 +1827,14 @@ void ScAttrArray::FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBo if (Concat(nPos)) { Search(nStart, nPos); - --nPos; // because ++ at end + bIterateNext = false; // because ++ at end otherwise } } } nStart = nEnd + 1; - ++nPos; + + if (bIterateNext) + ++nPos; } } diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx index 4330ea972992..2d51b57a827d 100644 --- a/sc/source/core/data/cellvalue.cxx +++ b/sc/source/core/data/cellvalue.cxx @@ -19,6 +19,7 @@ #include #include #include +#include namespace { @@ -659,6 +660,26 @@ OUString ScRefCellValue::getString( const ScDocument* pDoc ) const return getStringImpl(*this, pDoc); } +svl::SharedString ScRefCellValue::getSharedString( const ScDocument* pDoc, svl::SharedStringPool& rStrPool ) const +{ + switch (getType()) + { + case CELLTYPE_VALUE: + return rStrPool.intern(OUString::number(getDouble())); + case CELLTYPE_STRING: + return *getSharedString(); + case CELLTYPE_EDIT: + if (auto pEditText = getEditText()) + return rStrPool.intern(ScEditUtil::GetString(*pEditText, pDoc)); + break; + case CELLTYPE_FORMULA: + return getFormula()->GetString(); + default: + ; + } + return svl::SharedString::getEmptyString(); +} + OUString ScRefCellValue::getRawString( const ScDocument& rDoc ) const { return getRawStringImpl(*this, rDoc); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 25f943f68955..ab8b434a1e9d 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2654,7 +2654,7 @@ class FilterEntriesHandler // Convert string representation to ISO 8601 date to eliminate // locale dependent behaviour later when filtering for dates. sal_uInt32 nIndex = rContext.NFGetFormatIndex( NF_DATE_DIN_YYYYMMDD); - rContext.NFGetInputLineString( fVal, nIndex, aStr); + aStr = rContext.NFGetInputLineString( fVal, nIndex); } else if (nType == SvNumFormatType::DATETIME) { @@ -2662,7 +2662,7 @@ class FilterEntriesHandler // Convert string representation to ISO 8601 (with blank instead of T) datetime // to eliminate locale dependent behaviour later when filtering for datetimes. sal_uInt32 nIndex = rContext.NFGetFormatIndex(NF_DATETIME_ISO_YYYYMMDD_HHMMSS); - rContext.NFGetInputLineString(fVal, nIndex, aStr); + aStr = rContext.NFGetInputLineString(fVal, nIndex); } // store the formatted/rounded value for filtering if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0 && !bDate) @@ -3163,7 +3163,7 @@ double* ScColumn::GetValueCell( SCROW nRow ) OUString ScColumn::GetInputString( const ScRefCellValue& aCell, SCROW nRow, bool bForceSystemLocale ) const { sal_uInt32 nFormat = GetNumberFormat(GetDoc().GetNonThreadedContext(), nRow); - return ScCellFormat::GetInputString(aCell, nFormat, nullptr, GetDoc(), nullptr, false, bForceSystemLocale); + return ScCellFormat::GetInputString(aCell, nFormat, nullptr, GetDoc(), false, bForceSystemLocale); } double ScColumn::GetValue( SCROW nRow ) const diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 3c54b590d4e0..29c1c2654f83 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1317,7 +1317,7 @@ OUString ScConditionEntry::GetExpression( const ScAddress& rCursor, sal_uInt16 n aRet = "\"" + aStrVal1 + "\""; } else - mpDoc->GetFormatTable()->GetInputLineString(nVal1, nNumFmt, aRet); + aRet = mpDoc->GetFormatTable()->GetInputLineString(nVal1, nNumFmt); } else if ( nIndex==1 ) { @@ -1333,7 +1333,7 @@ OUString ScConditionEntry::GetExpression( const ScAddress& rCursor, sal_uInt16 n aRet = "\"" + aStrVal2 + "\""; } else - mpDoc->GetFormatTable()->GetInputLineString(nVal2, nNumFmt, aRet); + aRet = mpDoc->GetFormatTable()->GetInputLineString(nVal2, nNumFmt); } return aRet; diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index f1ff4241413d..dbcdbe089163 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -228,6 +228,25 @@ bool ScDocument::GetCodeName( SCTAB nTab, OUString& rName ) const return false; } +bool ScDocument::SetTotalsRowBelow( SCTAB nTab, bool bVal ) +{ + if (ScTable* pTable = FetchTable(nTab)) + { + pTable->SetTotalsRowBelow(bVal); + return true; + } + return false; +} + +bool ScDocument::GetTotalsRowBelow( SCTAB nTab ) const +{ + if (const ScTable* pTable = FetchTable(nTab)) + { + return pTable->GetTotalsRowBelow(); + } + return true; +} + bool ScDocument::GetTable( const OUString& rName, SCTAB& rTab ) const { static OUString aCacheName, aCacheUpperName; @@ -3620,7 +3639,7 @@ FormulaError ScDocument::GetStringForFormula( const ScAddress& rPos, OUString& r sal_uInt32 nIndex = pFormatter->GetStandardFormat( SvNumFormatType::NUMBER, ScGlobal::eLnge); - pFormatter->GetInputLineString(fVal, nIndex, aStr); + aStr = pFormatter->GetInputLineString(fVal, nIndex); } else aStr = pFCell->GetString().getString(); @@ -3632,7 +3651,7 @@ FormulaError ScDocument::GetStringForFormula( const ScAddress& rPos, OUString& r sal_uInt32 nIndex = pFormatter->GetStandardFormat( SvNumFormatType::NUMBER, ScGlobal::eLnge); - pFormatter->GetInputLineString(fVal, nIndex, aStr); + aStr = pFormatter->GetInputLineString(fVal, nIndex); } break; default: diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx index 63d320fe123d..30abc1760385 100644 --- a/sc/source/core/data/dputil.cxx +++ b/sc/source/core/data/dputil.cxx @@ -43,9 +43,7 @@ OUString getTwoDigitString(sal_Int32 nValue) void appendDateStr(OUStringBuffer& rBuffer, double fValue, SvNumberFormatter* pFormatter) { sal_uInt32 nFormat = pFormatter->GetStandardFormat( SvNumFormatType::DATE, ScGlobal::eLnge ); - OUString aString; - pFormatter->GetInputLineString(fValue, nFormat, aString); - rBuffer.append(aString); + rBuffer.append(pFormatter->GetInputLineString(fValue, nFormat)); } OUString getSpecialDateName(double fValue, bool bFirst, SvNumberFormatter* pFormatter) @@ -190,9 +188,7 @@ namespace { void lcl_AppendDateStr( OUStringBuffer& rBuffer, double fValue, SvNumberFormatter* pFormatter ) { sal_uInt32 nFormat = pFormatter->GetStandardFormat( SvNumFormatType::DATE, ScGlobal::eLnge ); - OUString aString; - pFormatter->GetInputLineString( fValue, nFormat, aString ); - rBuffer.append( aString ); + rBuffer.append( pFormatter->GetInputLineString( fValue, nFormat ) ); } OUString lcl_GetSpecialNumGroupName( double fValue, bool bFirst, sal_Unicode cDecSeparator, diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 95463a9c6d2d..c60ac1814551 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -660,7 +660,7 @@ void ScDrawLayer::SetPageSize(sal_uInt16 nPageNo, const Size& rSize, bool bUpdat // even if size is still the same // (individual rows/columns can have been changed)) - bool bNegativePage = pDoc && pDoc->IsNegativePage( static_cast(nPageNo) ); + bool bNegativePage = pDoc->IsNegativePage( static_cast(nPageNo) ); // Disable mass broadcasts from drawing objects' position changes. bool bWasLocked = isLocked(); diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 5316d13b0fa0..fca3a2a1436f 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -786,8 +786,7 @@ void ScPostIt::RemoveCaption() { pDrawPage->RecalcObjOrdNums(); // create drawing undo action (before removing the object to have valid draw page in undo action) - bool bRecording = (pDrawLayer && pDrawLayer->IsRecording()); - if (bRecording) + if (pDrawLayer->IsRecording()) pDrawLayer->AddCalcUndo( std::make_unique( *maNoteData.mxCaption )); // remove the object from the drawing page rtl::Reference pRemovedObj = pDrawPage->RemoveObject( maNoteData.mxCaption->GetOrdNum() ); diff --git a/sc/source/core/data/queryevaluator.cxx b/sc/source/core/data/queryevaluator.cxx index 060716e08d92..98ef255946e2 100644 --- a/sc/source/core/data/queryevaluator.cxx +++ b/sc/source/core/data/queryevaluator.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -295,8 +296,7 @@ std::pair ScQueryEvaluator::compareByValue(const ScRefCellValue& rCe return std::pair(bOk, bTestEqual); } -OUString ScQueryEvaluator::getCellString(const ScRefCellValue& rCell, SCROW nRow, SCCOL nCol, - const svl::SharedString** sharedString) +OUString ScQueryEvaluator::getCellString(const ScRefCellValue& rCell, SCROW nRow, SCCOL nCol) { if (rCell.getType() == CELLTYPE_FORMULA && rCell.getFormula()->GetErrCode() != FormulaError::NONE) @@ -311,23 +311,81 @@ OUString ScQueryEvaluator::getCellString(const ScRefCellValue& rCell, SCROW nRow assert(pos.second); // inserted it = pos.first; } - *sharedString = &it->second; - return OUString(); + return it->second.getString(); } else if (rCell.getType() == CELLTYPE_STRING) { - *sharedString = rCell.getSharedString(); - return OUString(); + return rCell.getSharedString()->getString(); } else { sal_uInt32 nFormat = mpContext ? mrTab.GetNumberFormat(*mpContext, ScAddress(nCol, nRow, mrTab.GetTab())) : mrTab.GetNumberFormat(nCol, nRow); - return ScCellFormat::GetInputString(rCell, nFormat, mpContext, mrDoc, sharedString, true); + return ScCellFormat::GetInputString(rCell, nFormat, mpContext, mrDoc, true); } } +template +auto ScQueryEvaluator::visitCellSharedString(const ScRefCellValue& rCell, SCROW nRow, SCCOL nCol, + const TFunctor& rOper) +{ + if (rCell.getType() == CELLTYPE_FORMULA + && rCell.getFormula()->GetErrCode() != FormulaError::NONE) + { + // Error cell is evaluated as string (for now). + const FormulaError error = rCell.getFormula()->GetErrCode(); + auto it = mCachedSharedErrorStrings.find(error); + if (it == mCachedSharedErrorStrings.end()) + { + svl::SharedString str = mrStrPool.intern(ScGlobal::GetErrorString(error)); + auto pos = mCachedSharedErrorStrings.insert({ error, std::move(str) }); + assert(pos.second); // inserted + it = pos.first; + } + return rOper(it->second); + } + else if (rCell.getType() == CELLTYPE_STRING) + { + return rOper(*rCell.getSharedString()); + } + else + { + sal_uInt32 nFormat + = mpContext ? mrTab.GetNumberFormat(*mpContext, ScAddress(nCol, nRow, mrTab.GetTab())) + : mrTab.GetNumberFormat(nCol, nRow); + return ScCellFormat::visitInputSharedString(rCell, nFormat, mpContext, mrDoc, mrStrPool, + true, false, rOper); + } +} + +svl::SharedString ScQueryEvaluator::getCellSharedString(const ScRefCellValue& rCell, SCROW nRow, + SCCOL nCol) +{ + return visitCellSharedString(rCell, nRow, nCol, + [](const svl::SharedString& arg) { return arg; }); +} + +static bool equalCellSharedString(const svl::SharedString& rValueSource, + const svl::SharedString& rString, bool bCaseSens) +{ + // Fast string equality check by comparing string identifiers. + // This is the bFast path, all conditions should lead here on bFast == true. + if (bCaseSens) + return rValueSource.getData() == rString.getData(); + return rValueSource.getDataIgnoreCase() == rString.getDataIgnoreCase(); +} + +bool ScQueryEvaluator::equalCellSharedString(const ScRefCellValue& rCell, SCROW nRow, + SCCOLROW nField, bool bCaseSens, + const svl::SharedString& rString) +{ + return visitCellSharedString(rCell, nRow, nField, + [&rString, bCaseSens](const svl::SharedString& arg) { + return ::equalCellSharedString(arg, rString, bCaseSens); + }); +} + bool ScQueryEvaluator::isFastCompareByString(const ScQueryEntry& rEntry) const { // If this is true, then there's a fast path in compareByString() which @@ -341,13 +399,12 @@ bool ScQueryEvaluator::isFastCompareByString(const ScQueryEntry& rEntry) const && isMatchWholeCell(rEntry.eOp); } -// The value is placed inside one parameter: [pValueSource1] or [pValueSource2] but never in both. +// The value is placed inside parameter rValueSource. // For the template argument see isFastCompareByString(). template std::pair ScQueryEvaluator::compareByString(const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem, - const svl::SharedString* pValueSource1, - const OUString* pValueSource2) + const ScRefCellValue& rCell, SCROW nRow) { bool bOk = false; bool bTestEqual = false; @@ -359,13 +416,10 @@ std::pair ScQueryEvaluator::compareByString(const ScQueryEntry& rEnt const bool bRealWildOrRegExp = !bFast && isRealWildOrRegExp(rEntry); const bool bTestWildOrRegExp = !bFast && isTestWildOrRegExp(rEntry); - assert(!bFast || pValueSource1 != nullptr); // shared string for fast path - // [pValueSource1] or [pValueSource2] but never both of them or none of them - assert((pValueSource1 != nullptr) != (pValueSource2 != nullptr)); - if (!bFast && (bRealWildOrRegExp || bTestWildOrRegExp)) { - const OUString& rValue = pValueSource1 ? pValueSource1->getString() : *pValueSource2; + svl::SharedString rValueSource = getCellSharedString(rCell, nRow, rEntry.nField); + const OUString& rValue = rValueSource.getString(); sal_Int32 nStart = 0; sal_Int32 nEnd = rValue.getLength(); @@ -435,125 +489,102 @@ std::pair ScQueryEvaluator::compareByString(const ScQueryEntry& rEnt if (rEntry.eOp == SC_NOT_EQUAL) bOk = !bOk; } - else if (bFast || bMatchWholeCell) - { - if (bFast || pValueSource1) - { - // Fast string equality check by comparing string identifiers. - // This is the bFast path, all conditions should lead here on bFast == true. - if (mrParam.bCaseSens) - { - bOk = pValueSource1->getData() == rItem.maString.getData(); - } - else - { - bOk = pValueSource1->getDataIgnoreCase() - == rItem.maString.getDataIgnoreCase(); - } - } - else // if (pValueSource2) - { - if (mrParam.bCaseSens) - { - bOk = (*pValueSource2 == rItem.maString.getString()); - } - else - { - // fallback - const svl::SharedString rSource2(mrStrPool.intern(*pValueSource2)); - // Fast string equality check by comparing string identifiers. - bOk = rSource2.getDataIgnoreCase() == rItem.maString.getDataIgnoreCase(); - } - } - - if (!bFast && rEntry.eOp == SC_NOT_EQUAL) - bOk = !bOk; - } else { - // Where do we find a match (if at all) - sal_Int32 nStrPos; + if (bFast || bMatchWholeCell) + { + bOk = equalCellSharedString(rCell, nRow, rEntry.nField, mrParam.bCaseSens, + rItem.maString); - if (!mbCaseSensitive) - { // Common case for vlookup etc. - const svl::SharedString rSource( - pValueSource1 ? *pValueSource1 : mrStrPool.intern(*pValueSource2)); - - const rtl_uString* pQuer = rItem.maString.getDataIgnoreCase(); - const rtl_uString* pCellStr = rSource.getDataIgnoreCase(); - - assert(pCellStr != nullptr); - if (pQuer == nullptr) - pQuer = svl::SharedString::getEmptyString().getDataIgnoreCase(); - - const sal_Int32 nIndex - = (rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH) - ? (pCellStr->length - pQuer->length) - : 0; - - if (nIndex < 0) - nStrPos = -1; - else - { // OUString::indexOf - nStrPos = rtl_ustr_indexOfStr_WithLength(pCellStr->buffer + nIndex, - pCellStr->length - nIndex, - pQuer->buffer, pQuer->length); - - if (nStrPos >= 0) - nStrPos += nIndex; - } + if (!bFast && rEntry.eOp == SC_NOT_EQUAL) + bOk = !bOk; } else { - const OUString& rValue - = pValueSource1 ? pValueSource1->getString() : *pValueSource2; - const OUString aQueryStr = rItem.maString.getString(); - const LanguageType nLang - = ScGlobal::oSysLocale->GetLanguageTag().getLanguageType(); - setupTransliteratorIfNeeded(); - const OUString aCell(mpTransliteration->transliterate( - rValue, nLang, 0, rValue.getLength(), nullptr)); + svl::SharedString rValueSource + = getCellSharedString(rCell, nRow, rEntry.nField); - const OUString aQuer(mpTransliteration->transliterate( - aQueryStr, nLang, 0, aQueryStr.getLength(), nullptr)); + // Where do we find a match (if at all) + sal_Int32 nStrPos; - const sal_Int32 nIndex - = (rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH) - ? (aCell.getLength() - aQuer.getLength()) - : 0; - nStrPos = ((nIndex < 0) ? -1 : aCell.indexOf(aQuer, nIndex)); - } - switch (rEntry.eOp) - { - case SC_EQUAL: - case SC_CONTAINS: - bOk = (nStrPos != -1); - break; - case SC_NOT_EQUAL: - case SC_DOES_NOT_CONTAIN: - bOk = (nStrPos == -1); - break; - case SC_BEGINS_WITH: - bOk = (nStrPos == 0); - break; - case SC_DOES_NOT_BEGIN_WITH: - bOk = (nStrPos != 0); - break; - case SC_ENDS_WITH: - bOk = (nStrPos >= 0); - break; - case SC_DOES_NOT_END_WITH: - bOk = (nStrPos < 0); - break; - default: - assert(false); - break; + if (!mbCaseSensitive) + { // Common case for vlookup etc. + const rtl_uString* pQuer = rItem.maString.getDataIgnoreCase(); + const rtl_uString* pCellStr = rValueSource.getDataIgnoreCase(); + + assert(pCellStr != nullptr); + if (pQuer == nullptr) + pQuer = svl::SharedString::getEmptyString().getDataIgnoreCase(); + + const sal_Int32 nIndex + = (rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH) + ? (pCellStr->length - pQuer->length) + : 0; + + if (nIndex < 0) + nStrPos = -1; + else + { // OUString::indexOf + nStrPos = rtl_ustr_indexOfStr_WithLength(pCellStr->buffer + nIndex, + pCellStr->length - nIndex, + pQuer->buffer, pQuer->length); + + if (nStrPos >= 0) + nStrPos += nIndex; + } + } + else + { + const OUString& rValue = rValueSource.getString(); + const OUString aQueryStr = rItem.maString.getString(); + const LanguageType nLang + = ScGlobal::oSysLocale->GetLanguageTag().getLanguageType(); + setupTransliteratorIfNeeded(); + const OUString aCell(mpTransliteration->transliterate( + rValue, nLang, 0, rValue.getLength(), nullptr)); + + const OUString aQuer(mpTransliteration->transliterate( + aQueryStr, nLang, 0, aQueryStr.getLength(), nullptr)); + + const sal_Int32 nIndex + = (rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH) + ? (aCell.getLength() - aQuer.getLength()) + : 0; + nStrPos = ((nIndex < 0) ? -1 : aCell.indexOf(aQuer, nIndex)); + } + switch (rEntry.eOp) + { + case SC_EQUAL: + case SC_CONTAINS: + bOk = (nStrPos != -1); + break; + case SC_NOT_EQUAL: + case SC_DOES_NOT_CONTAIN: + bOk = (nStrPos == -1); + break; + case SC_BEGINS_WITH: + bOk = (nStrPos == 0); + break; + case SC_DOES_NOT_BEGIN_WITH: + bOk = (nStrPos != 0); + break; + case SC_ENDS_WITH: + bOk = (nStrPos >= 0); + break; + case SC_DOES_NOT_END_WITH: + bOk = (nStrPos < 0); + break; + default: + assert(false); + break; + } } } } else { // use collator here because data was probably sorted - const OUString& rValue = pValueSource1 ? pValueSource1->getString() : *pValueSource2; + svl::SharedString rValueSource = getCellSharedString(rCell, nRow, rEntry.nField); + const OUString& rValue = rValueSource.getString(); setupCollatorIfNeeded(); sal_Int32 nCompare = mpCollator->compareString(rValue, rItem.maString.getString()); switch (rEntry.eOp) @@ -705,16 +736,13 @@ std::pair ScQueryEvaluator::processEntry(SCROW nRow, SCCOL nCol, ScR } } } - const svl::SharedString* cellSharedString = nullptr; - std::optional oCellString; const bool bFastCompareByString = isFastCompareByString(rEntry); if (rEntry.eOp == SC_EQUAL && rItems.size() >= 10 && bFastCompareByString) { // The same as above but for strings. Try to optimize the case when // it's a svl::SharedString comparison. That happens when SC_EQUAL is used // and simple matching is used, see compareByString() - if (!oCellString) - oCellString = getCellString(aCell, nRow, rEntry.nField, &cellSharedString); + svl::SharedString cellSharedString = getCellSharedString(aCell, nRow, rEntry.nField); // Allow also checking ScQueryEntry::ByValue if the cell is not numeric, // as in that case isQueryByNumeric() would be false and isQueryByString() would // be true because of SC_EQUAL making isTextMatchOp() true. @@ -722,52 +750,46 @@ std::pair ScQueryEvaluator::processEntry(SCROW nRow, SCCOL nCol, ScR // For ScQueryEntry::ByString check that the cell is represented by a shared string, // which means it's either a string cell or a formula error. This is not as // generous as isQueryByString() but it should be enough and better be safe. - if (cellSharedString != nullptr) + if (rItems.size() >= 100) { - if (rItems.size() >= 100) + // Sort, cache and binary search for the string in items. + // Since each SharedString is identified by pointer value, + // sorting by pointer value is enough. + if (mCachedSortedItemStrings.size() <= nEntryIndex) { - // Sort, cache and binary search for the string in items. - // Since each SharedString is identified by pointer value, - // sorting by pointer value is enough. - if (mCachedSortedItemStrings.size() <= nEntryIndex) - { - mCachedSortedItemStrings.resize(nEntryIndex + 1); - auto& values = mCachedSortedItemStrings[nEntryIndex]; - values.reserve(rItems.size()); - for (const auto& rItem : rItems) - { - if (rItem.meType == ScQueryEntry::ByString - || (compareByValue && rItem.meType == ScQueryEntry::ByValue)) - { - values.push_back(mrParam.bCaseSens - ? rItem.maString.getData() - : rItem.maString.getDataIgnoreCase()); - } - } - std::sort(values.begin(), values.end()); - } + mCachedSortedItemStrings.resize(nEntryIndex + 1); auto& values = mCachedSortedItemStrings[nEntryIndex]; - const rtl_uString* string = mrParam.bCaseSens - ? cellSharedString->getData() - : cellSharedString->getDataIgnoreCase(); - auto it = std::lower_bound(values.begin(), values.end(), string); - if (it != values.end() && *it == string) - return std::make_pair(true, true); - } - else - { + values.reserve(rItems.size()); for (const auto& rItem : rItems) { - if ((rItem.meType == ScQueryEntry::ByString - || (compareByValue && rItem.meType == ScQueryEntry::ByValue)) - && (mrParam.bCaseSens - ? cellSharedString->getData() == rItem.maString.getData() - : cellSharedString->getDataIgnoreCase() - == rItem.maString.getDataIgnoreCase())) + if (rItem.meType == ScQueryEntry::ByString + || (compareByValue && rItem.meType == ScQueryEntry::ByValue)) { - return std::make_pair(true, true); + values.push_back(mrParam.bCaseSens ? rItem.maString.getData() + : rItem.maString.getDataIgnoreCase()); } } + std::sort(values.begin(), values.end()); + } + auto& values = mCachedSortedItemStrings[nEntryIndex]; + const rtl_uString* string = mrParam.bCaseSens ? cellSharedString.getData() + : cellSharedString.getDataIgnoreCase(); + auto it = std::lower_bound(values.begin(), values.end(), string); + if (it != values.end() && *it == string) + return std::make_pair(true, true); + } + else + { + for (const auto& rItem : rItems) + { + if ((rItem.meType == ScQueryEntry::ByString + || (compareByValue && rItem.meType == ScQueryEntry::ByValue)) + && (mrParam.bCaseSens ? cellSharedString.getData() == rItem.maString.getData() + : cellSharedString.getDataIgnoreCase() + == rItem.maString.getDataIgnoreCase())) + { + return std::make_pair(true, true); + } } } } @@ -794,15 +816,11 @@ std::pair ScQueryEvaluator::processEntry(SCROW nRow, SCCOL nCol, ScR } else if (isQueryByString(rEntry.eOp, rItem.meType, aCell)) { - if (!oCellString) - oCellString = getCellString(aCell, nRow, rEntry.nField, &cellSharedString); std::pair aThisRes; - if (cellSharedString && bFastCompareByString) // fast - aThisRes = compareByString(rEntry, rItem, cellSharedString, nullptr); - else if (cellSharedString) - aThisRes = compareByString(rEntry, rItem, cellSharedString, nullptr); + if (bFastCompareByString) // fast + aThisRes = compareByString(rEntry, rItem, aCell, nRow); else - aThisRes = compareByString(rEntry, rItem, nullptr, &*oCellString); + aThisRes = compareByString(rEntry, rItem, aCell, nRow); aRes.first |= aThisRes.first; aRes.second |= aThisRes.second; } diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index 2f9ee31d5d14..4516fe3638b4 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -69,7 +69,8 @@ void ScStyleSheetPool::SetDocument( ScDocument* pDocument ) } SfxStyleSheetBase& ScStyleSheetPool::Make( const OUString& rName, - SfxStyleFamily eFam, SfxStyleSearchBits mask) + SfxStyleFamily eFam, SfxStyleSearchBits mask, + const OUString& rParentStyleSheetName) { if ( rName == STRING_STANDARD && Find( rName, eFam ) != nullptr ) { @@ -85,21 +86,22 @@ SfxStyleSheetBase& ScStyleSheetPool::Make( const OUString& rName, { OUString aNewName = ScResId(STR_STYLENAME_STANDARD) + OUString::number( nAdd ); if ( Find( aNewName, eFam ) == nullptr ) - return SfxStyleSheetPool::Make(aNewName, eFam, mask); + return SfxStyleSheetPool::Make(aNewName, eFam, mask, rParentStyleSheetName); } } // Core uses translated names for both naming and display. // This for all three, loading standard builtin styles from styles.xml // configuration, loading documents and updating from templates. - return SfxStyleSheetPool::Make( ScStyleNameConversion::ProgrammaticToDisplayName( rName, eFam), eFam, mask); + return SfxStyleSheetPool::Make( ScStyleNameConversion::ProgrammaticToDisplayName( rName, eFam), eFam, mask, rParentStyleSheetName); } rtl::Reference ScStyleSheetPool::Create( const OUString& rName, SfxStyleFamily eFamily, - SfxStyleSearchBits nMaskP ) + SfxStyleSearchBits nMaskP, + const OUString& rParentStyleSheetName ) { - rtl::Reference pSheet = new ScStyleSheet( rName, *this, eFamily, nMaskP ); + rtl::Reference pSheet = new ScStyleSheet( rName, *this, eFamily, nMaskP, rParentStyleSheetName ); if ( eFamily != SfxStyleFamily::Page && ScResId(STR_STYLENAME_STANDARD) != rName ) pSheet->SetParent( ScResId(STR_STYLENAME_STANDARD) ); diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index 1fd2f1ae8a42..4f9ebcb5527d 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -52,9 +52,10 @@ constexpr auto HFDIST_CM = o3tl::convert(250, o3tl::Length::mm100, o3tl::Length: ScStyleSheet::ScStyleSheet( const OUString& rName, const ScStyleSheetPool& rPoolP, SfxStyleFamily eFamily, - SfxStyleSearchBits nMaskP ) + SfxStyleSearchBits nMaskP, + const OUString& rParentStyleSheetName) - : SfxStyleSheet ( rName, rPoolP, eFamily, nMaskP ) + : SfxStyleSheet ( rName, rPoolP, eFamily, nMaskP, rParentStyleSheetName ) , eUsage( Usage::UNKNOWN ) { } diff --git a/sc/source/core/data/subtotalparam.cxx b/sc/source/core/data/subtotalparam.cxx index e8f32954297c..6fd8e18c6b0e 100644 --- a/sc/source/core/data/subtotalparam.cxx +++ b/sc/source/core/data/subtotalparam.cxx @@ -26,7 +26,7 @@ ScSubTotalParam::ScSubTotalParam() ScSubTotalParam::ScSubTotalParam( const ScSubTotalParam& r ) : nCol1(r.nCol1),nRow1(r.nRow1),nCol2(r.nCol2),nRow2(r.nRow2),nUserIndex(r.nUserIndex), bRemoveOnly(r.bRemoveOnly),bReplace(r.bReplace),bPagebreak(r.bPagebreak),bCaseSens(r.bCaseSens), - bDoSort(r.bDoSort),bAscending(r.bAscending),bUserDef(r.bUserDef), + bDoSort(r.bDoSort), bSummaryBelow(r.bSummaryBelow), bAscending(r.bAscending), bUserDef(r.bUserDef), bIncludePattern(r.bIncludePattern) { for (sal_uInt16 i=0; i 0) // otherwise only sort { + SCROW nAboveRows = rParam.bSummaryBelow ? nStartRow : nStartRow + nLevel; for (sal_uInt16 i = 0; i <= aRowEntry.nGroupNo; ++i) { - aSubString = GetString( nGroupCol[i], nStartRow ); + aSubString = GetString( nGroupCol[i], nAboveRows ); if ( bIgnoreCase ) aCompString[i] = ScGlobal::getCharClass().uppercase( aSubString ); else @@ -2070,8 +2071,8 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) } // aSubString stays on the last bool bBlockVis = false; // group visible? - aRowEntry.nSubStartRow = nStartRow; - for (SCROW nRow=nStartRow; nRow<=nEndRow+1 && bSpaceLeft; nRow++) + aRowEntry.nSubStartRow = nAboveRows; + for (SCROW nRow=nAboveRows; nRow<=nEndRow+1 && bSpaceLeft; nRow++) { bool bChanged; if (nRow>nEndRow) @@ -2099,9 +2100,21 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) } if ( bChanged ) { - aRowEntry.nDestRow = nRow; - aRowEntry.nFuncStart = aRowEntry.nSubStartRow; - aRowEntry.nFuncEnd = nRow-1; + if (rParam.bSummaryBelow) + { + aRowEntry.nDestRow = nRow; + aRowEntry.nFuncStart = aRowEntry.nSubStartRow; + aRowEntry.nFuncEnd = nRow - 1; + } + else + { + aRowEntry.nDestRow = aRowEntry.nSubStartRow; + aRowEntry.nFuncStart = aRowEntry.nSubStartRow + 1; + if (nRow != nEndRow + 1) + aRowEntry.nFuncEnd = nRow - nLevel; + else + aRowEntry.nFuncEnd = nRow; + } bSpaceLeft = rDocument.InsertRow( 0, nTab, rDocument.MaxCol(), nTab, aRowEntry.nDestRow, 1 ); @@ -2157,17 +2170,27 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) if (!aRowVector.empty()) { - // generate global total - SCROW nGlobalStartRow = aRowVector[0].nSubStartRow; - SCROW nGlobalStartFunc = aRowVector[0].nFuncStart; SCROW nGlobalEndRow = 0; SCROW nGlobalEndFunc = 0; - for (const auto& rRowEntry : aRowVector) + for (auto& rRowEntry : aRowVector) { + if (!rParam.bSummaryBelow) + { + // if we have Global summary above, we need to shift summary rows down + rRowEntry.nDestRow = rRowEntry.nDestRow + nLevelCount; + rRowEntry.nFuncEnd = rRowEntry.nFuncEnd + nLevelCount; + rRowEntry.nFuncStart = rRowEntry.nFuncStart + nLevelCount - rRowEntry.nGroupNo; + rRowEntry.nSubStartRow = rRowEntry.nSubStartRow + nLevelCount; + } + nGlobalEndRow = (nGlobalEndRow < rRowEntry.nDestRow) ? rRowEntry.nDestRow : nGlobalEndRow; nGlobalEndFunc = (nGlobalEndFunc < rRowEntry.nFuncEnd) ? rRowEntry.nFuncEnd : nGlobalEndRow; } + // generate global total + SCROW nGlobalStartRow = aRowVector[0].nSubStartRow; + SCROW nGlobalStartFunc = aRowVector[0].nFuncStart; + for (sal_uInt16 nLevel = 0; nLevelmpFormatter->GetInputLineString( pDataNumeric->mfVal, pDataNumeric->mnFormat, aStr); + OUString aStr = pDataNumeric->mpFormatter->GetInputLineString( pDataNumeric->mfVal, pDataNumeric->mnFormat); nLen = aStr.getLength(); } ScRefCellValue aTmpCell( static_cast(nLen)); @@ -960,7 +959,7 @@ bool ScValidationData::GetSelectionFromFormula( } else { - pFormatter->GetInputLineString( nMatVal.fVal, nDestFormat, aValStr ); + aValStr = pFormatter->GetInputLineString( nMatVal.fVal, nDestFormat ); } } diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index a4a4fe2bfb3a..a7eb79023d94 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -333,7 +333,7 @@ static const sal_Unicode * lcl_XL_ParseSheetRef( const sal_Unicode* start, aTabName += std::u16string_view( pCurrentStart, sal::static_int_cast( p - pCurrentStart)); if (aTabName.isEmpty()) return nullptr; - if (p == pMsoxlQuoteStop) + if (p == pMsoxlQuoteStop && *pMsoxlQuoteStop == '\'') ++p; // position on ! of ...'!... if( *p != '!' && ( !bAllow3D || *p != ':' ) ) return (!bAllow3D && *p == ':') ? p : start; @@ -495,6 +495,7 @@ const sal_Unicode* ScRange::Parse_XL_Header( rEndTabName.clear(); rExternDocName.clear(); const sal_Unicode* pMsoxlQuoteStop = nullptr; + const sal_Unicode* pQuoted3DStop = nullptr; if (*p == '[') { ++p; @@ -531,11 +532,18 @@ const sal_Unicode* ScRange::Parse_XL_Header( // 'E:\[EXTDATA8.XLS]Sheet1'!$A$7 or // 'E:\[EXTDATA12B.XLSB]Sheet1:Sheet3'!$A$11 // But, 'Sheet1'!B3 would also be a valid! - // Excel does not allow [ and ] characters in sheet names though. + // Then again, 'Sheet1':'Sheet2'!C4 would be logical and Calc wrote + // that to OOXML but Excel instead does 'Sheet1:Sheet2'!C4 which is + // the worse you can get. + // Excel does not allow [ and ] and : characters in sheet names though. // But, more sickness comes with MOOXML as there may be // '[1]Sheet 4'!$A$1 where [1] is the external doc's index. p = parseQuotedName(p, rExternDocName); - if (*p != '!') + if (*p == ':') + { + // The incorrect 'Sheet1':'Sheet2' case. Just fall through. + } + else if (*p != '!') { rExternDocName.clear(); return start; @@ -544,7 +552,24 @@ const sal_Unicode* ScRange::Parse_XL_Header( { sal_Int32 nOpen = rExternDocName.indexOf( '['); if (nOpen == -1) + { rExternDocName.clear(); + // Look for 'Sheet1:Sheet2'! + if (*p == '!') + { + const sal_Unicode* pQ = start + 1; + do + { + if (*pQ == ':') + { + pMsoxlQuoteStop = pQ; + pQuoted3DStop = p - 1; + break; + } + } + while (++pQ < p); + } + } else { sal_Int32 nClose = rExternDocName.indexOf( ']', nOpen+1); @@ -574,7 +599,7 @@ const sal_Unicode* ScRange::Parse_XL_Header( } } if (rExternDocName.isEmpty()) - p = start; + p = (pQuoted3DStop ? start + 1 : start); } startTabs = p; @@ -590,7 +615,8 @@ const sal_Unicode* ScRange::Parse_XL_Header( if( *p == ':' ) // 3d ref { startEndTabs = p + 1; - p = lcl_XL_ParseSheetRef( startEndTabs, rEndTabName, false, pMsoxlQuoteStop, pErrRef); + p = lcl_XL_ParseSheetRef( startEndTabs, rEndTabName, false, + (pQuoted3DStop ? pQuoted3DStop : pMsoxlQuoteStop), pErrRef); if( p == nullptr ) { nFlags = nSaveFlags; @@ -2142,6 +2168,7 @@ static void lcl_ScRange_Format_XL_Header( OUStringBuffer& rString, const ScRange if( !(nFlags & ScRefFlags::TAB_3D) ) return; + sal_Int32 nQuotePos = rString.getLength(); OUString aTabName, aDocName; lcl_Split_DocTab( rDoc, rRange.aStart.Tab(), rDetails, nFlags, aTabName, aDocName ); switch (rDetails.eConv) @@ -2164,6 +2191,7 @@ static void lcl_ScRange_Format_XL_Header( OUStringBuffer& rString, const ScRange if (!aDocName.isEmpty()) { rString.append("[" + aDocName + "]"); + nQuotePos = rString.getLength(); } rString.append(aTabName); break; @@ -2171,8 +2199,7 @@ static void lcl_ScRange_Format_XL_Header( OUStringBuffer& rString, const ScRange if( nFlags & ScRefFlags::TAB2_3D ) { lcl_Split_DocTab( rDoc, rRange.aEnd.Tab(), rDetails, nFlags, aTabName, aDocName ); - rString.append(":"); - rString.append(aTabName); + ScCompiler::FormExcelSheetRange( rString, nQuotePos, aTabName); } rString.append("!"); } diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx index c20175cd9a62..4b3349053fd0 100644 --- a/sc/source/core/tool/cellform.cxx +++ b/sc/source/core/tool/cellform.cxx @@ -18,9 +18,11 @@ */ #include +#include #include #include +#include #include #include @@ -130,23 +132,17 @@ OUString ScCellFormat::GetString( OUString ScCellFormat::GetInputString( const ScRefCellValue& rCell, sal_uInt32 nFormat, ScInterpreterContext* pContext, const ScDocument& rDoc, - const svl::SharedString** pShared, bool bFiltering, bool bForceSystemLocale ) + bool bFiltering, bool bForceSystemLocale ) { ScInterpreterContext& rContext = pContext ? *pContext : rDoc.GetNonThreadedContext(); - if(pShared != nullptr) - *pShared = nullptr; switch (rCell.getType()) { case CELLTYPE_STRING: case CELLTYPE_EDIT: return rCell.getString(&rDoc); case CELLTYPE_VALUE: - { - OUString str; - rContext.NFGetInputLineString(rCell.getDouble(), nFormat, str, bFiltering, bForceSystemLocale); - return str; - } + return rContext.NFGetInputLineString(rCell.getDouble(), nFormat, bFiltering, bForceSystemLocale); break; case CELLTYPE_FORMULA: { @@ -155,40 +151,35 @@ OUString ScCellFormat::GetInputString( if (pFC->IsEmptyDisplayedAsString()) ; // empty else if (pFC->IsValue()) - { - str.emplace(); - rContext.NFGetInputLineString(pFC->GetValue(), nFormat, *str, bFiltering, bForceSystemLocale); - } + str = rContext.NFGetInputLineString(pFC->GetValue(), nFormat, bFiltering, bForceSystemLocale); else - { - const svl::SharedString& shared = pFC->GetString(); - // Allow callers to optimize by avoiding converting later back to OUString. - // To avoid refcounting that won't be needed, do not even return the OUString. - if( pShared != nullptr ) - *pShared = &shared; - else - str = shared.getString(); - } + str = pFC->GetString().getString(); const FormulaError nErrCode = pFC->GetErrCode(); if (nErrCode != FormulaError::NONE) - { str.reset(); - if( pShared != nullptr ) - *pShared = nullptr; - } return str ? std::move(*str) : svl::SharedString::EMPTY_STRING; } case CELLTYPE_NONE: - if( pShared != nullptr ) - *pShared = &svl::SharedString::getEmptyString(); return svl::SharedString::EMPTY_STRING; default: return svl::SharedString::EMPTY_STRING; } } +svl::SharedString ScCellFormat::GetInputSharedString( + const ScRefCellValue& rCell, sal_uInt32 nFormat, ScInterpreterContext* pContext, const ScDocument& rDoc, + svl::SharedStringPool& rStrPool, + bool bFiltering, bool bForceSystemLocale ) +{ + return visitInputSharedString(rCell, nFormat, pContext, rDoc, rStrPool, + bFiltering, bForceSystemLocale, + [](const svl::SharedString& arg) { + return arg; + }); +} + OUString ScCellFormat::GetOutputString( ScDocument& rDoc, const ScAddress& rPos, const ScRefCellValue& rCell ) { if (rCell.isEmpty()) diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 657601a224de..034899d082e6 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -1557,11 +1557,7 @@ OUString ScChangeActionContent::GetStringOfCell( switch (rCell.getType()) { case CELLTYPE_VALUE: - { - OUString str; - pDoc->GetFormatTable()->GetInputLineString(rCell.getDouble(), nFormat, str); - return str; - } + return pDoc->GetFormatTable()->GetInputLineString(rCell.getDouble(), nFormat); case CELLTYPE_STRING: return rCell.getSharedString()->getString(); case CELLTYPE_EDIT: @@ -1654,8 +1650,8 @@ void ScChangeActionContent::SetValue( { case CELLTYPE_VALUE : { // E.g.: Remember date as such - pFromDoc->GetFormatTable()->GetInputLineString( - rOrgCell.getDouble(), nFormat, rStr); + rStr = pFromDoc->GetFormatTable()->GetInputLineString( + rOrgCell.getDouble(), nFormat); } break; case CELLTYPE_FORMULA : @@ -1681,7 +1677,7 @@ void ScChangeActionContent::SetCell( OUString& rStr, ScCellValue& rCell, sal_uLo { case CELLTYPE_VALUE : // e.g. remember date as date string - pDoc->GetFormatTable()->GetInputLineString(rCell.getDouble(), nFormat, rStr); + rStr = pDoc->GetFormatTable()->GetInputLineString(rCell.getDouble(), nFormat); break; case CELLTYPE_FORMULA : rCell.getFormula()->SetInChangeTrack(true); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 50e50d469439..6400e082a567 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -1179,11 +1179,11 @@ struct ConventionXL GetTab(rLimits, rPos, rTabNames, rRef.Ref2, aEndTabName); } + const sal_Int32 nQuotePos = rBuf.getLength(); rBuf.append( aStartTabName ); if( !bSingleRef && rRef.Ref2.IsFlag3D() && aStartTabName != aEndTabName ) { - rBuf.append( ':' ); - rBuf.append( aEndTabName ); + ScCompiler::FormExcelSheetRange( rBuf, nQuotePos, aEndTabName); } rBuf.append( '!' ); @@ -1386,7 +1386,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL } makeSingleCellStr(rLimits, rBuf, aRef.Ref1, aAbs1); - if (!bSingleRef) + if (!bSingleRef && (aAbs1.Row() != aAbs2.Row() || aAbs1.Col() != aAbs2.Col())) { rBuf.append( ':' ); makeSingleCellStr(rLimits, rBuf, aRef.Ref2, aAbs2); @@ -1729,6 +1729,12 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL r1c1_add_row(rBuf, rRef.Ref1, aAbsRef.aStart); r1c1_add_col(rBuf, rRef.Ref1, aAbsRef.aStart); + // We can't parse a single col/row reference in the context of a R1C1 + // 3D reference back yet, otherwise (if Excel understands it) an + // additional condition similar to ConventionXL_A1::makeRefStr() could + // be + // + // && (aAbsRef.aStart.Row() != aAbsRef.aEnd.Row() || aAbsRef.aStart.Col() != aAbsRef.aEnd.Col()) if (!bSingleRef) { rBuf.append( ':' ); @@ -1994,6 +2000,29 @@ void ScCompiler::CheckTabQuotes( OUString& rString, } } +void ScCompiler::FormExcelSheetRange( OUStringBuffer& rBuf, sal_Int32 nQuotePos, const OUString& rEndTabName ) +{ + OUString aEndTabName(rEndTabName); + if (nQuotePos < rBuf.getLength()) + { + const bool bQuoted2 = (!aEndTabName.isEmpty() && aEndTabName[0] == '\''); + if (bQuoted2) + aEndTabName = aEndTabName.subView(1); // Sheet2' + if (rBuf[nQuotePos] == '\'') // 'Sheet1' + { + const sal_Int32 nLast = rBuf.getLength() - 1; + if (rBuf[nLast] == '\'') + rBuf.remove(nLast, 1); // 'Sheet1 + } + else if (bQuoted2) // Sheet1 + { + rBuf.insert(nQuotePos, '\''); // 'Sheet1 + } + } + rBuf.append( ':' ); + rBuf.append( aEndTabName ); +} + sal_Int32 ScCompiler::GetDocTabPos( const OUString& rString ) { if (rString[0] != '\'') diff --git a/sc/source/core/tool/formulaparserpool.cxx b/sc/source/core/tool/formulaparserpool.cxx index 4b04a0343136..559530aa24e4 100644 --- a/sc/source/core/tool/formulaparserpool.cxx +++ b/sc/source/core/tool/formulaparserpool.cxx @@ -72,7 +72,7 @@ ScParserFactoryMap::ScParserFactoryMap() : // store factory in the map OUString aNamespace = xParser->getSupportedNamespace(); if( !aNamespace.isEmpty() ) - maFactories[ aNamespace ] = xCompFactory; + maFactories[ aNamespace ] = std::move(xCompFactory); } catch( Exception& ) { diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 6a45d78aa655..84ee63f23b92 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -8752,6 +8752,11 @@ void ScInterpreter::ScSortBy() return; } pMatSrc->GetDimensions(nsC, nsR); + if (nsC == 0 || nsR == 0) + { + PushIllegalArgument(); + return; + } nSortCol2 = nsC - 1; // nSortCol1 = 0 nSortRow2 = nsR - 1; // nSortRow1 = 0 } diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 4f88ad3b4d27..fcc58c364ec4 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -253,7 +253,7 @@ void ScInterpreter::GetCellString( svl::SharedString& rStr, ScRefCellValue& rCel { case CELLTYPE_STRING: case CELLTYPE_EDIT: - rStr = mrStrPool.intern(rCell.getString(&mrDoc)); + rStr = rCell.getSharedString(&mrDoc, mrStrPool); break; case CELLTYPE_FORMULA: { @@ -2534,9 +2534,7 @@ svl::SharedString ScInterpreter::GetStringFromDouble( double fVal ) sal_uLong nIndex = mrContext.NFGetStandardFormat( SvNumFormatType::NUMBER, ScGlobal::eLnge); - OUString aStr; - mrContext.NFGetInputLineString(fVal, nIndex, aStr); - return mrStrPool.intern(aStr); + return mrStrPool.intern(mrContext.NFGetInputLineString(fVal, nIndex)); } void ScInterpreter::ScDBGet() diff --git a/sc/source/core/tool/interpretercontext.cxx b/sc/source/core/tool/interpretercontext.cxx index 26aaeaf3e8e6..a8627a327469 100644 --- a/sc/source/core/tool/interpretercontext.cxx +++ b/sc/source/core/tool/interpretercontext.cxx @@ -238,16 +238,14 @@ sal_uInt32 ScInterpreterContext::NFGetStandardFormat(sal_uInt32 nFIndex, SvNumFo nFIndex, eType, eLnge); } -void ScInterpreterContext::NFGetInputLineString(const double& fOutNumber, sal_uInt32 nFIndex, - OUString& rOutString, bool bFiltering, - bool bForceSystemLocale) const +OUString ScInterpreterContext::NFGetInputLineString(const double& fOutNumber, sal_uInt32 nFIndex, + bool bFiltering, bool bForceSystemLocale) const { if (!mpDoc->IsThreadedGroupCalcInProgress()) - return GetFormatTable()->GetInputLineString(fOutNumber, nFIndex, rOutString, bFiltering, + return GetFormatTable()->GetInputLineString(fOutNumber, nFIndex, bFiltering, bForceSystemLocale); return SvNFEngine::GetInputLineString(*mxLanguageData, *mpFormatData, *mpNatNum, maROPolicy, - fOutNumber, nFIndex, rOutString, bFiltering, - bForceSystemLocale); + fOutNumber, nFIndex, bFiltering, bForceSystemLocale); } void ScInterpreterContext::NFGetOutputString(const double& fOutNumber, sal_uInt32 nFIndex, OUString& sOutString, const Color** ppColor, diff --git a/sc/source/core/tool/rangecache.cxx b/sc/source/core/tool/rangecache.cxx index 24a8a39313ff..f5e98343455b 100644 --- a/sc/source/core/tool/rangecache.cxx +++ b/sc/source/core/tool/rangecache.cxx @@ -186,10 +186,7 @@ ScSortedRangeCache::ScSortedRangeCache(ScDocument* pDoc, const ScRange& rRange, assert(!ScQueryEvaluator::isQueryByValue(mQueryOp, mQueryType, cell)); if (ScQueryEvaluator::isQueryByString(mQueryOp, mQueryType, cell)) { - const svl::SharedString* sharedString = nullptr; - OUString string = evaluator.getCellString(cell, nRow, nCol, &sharedString); - if (sharedString) - string = sharedString->getString(); + OUString string = evaluator.getCellString(cell, nRow, nCol); colrowData.push_back(ColRowData{ mRowSearch ? nRow : nCol, string }); } } diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index fcc3b290d3d1..0f792203c66b 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -779,9 +779,7 @@ svl::SharedString ScMatrixImpl::GetString( ScInterpreterContext& rContext, SCSIZ sal_uInt32 nKey = rContext.NFGetStandardFormat( SvNumFormatType::NUMBER, ScGlobal::eLnge); - OUString aStr; - rContext.NFGetInputLineString( fVal, nKey, aStr); - return svl::SharedString( aStr); // string not interned + return svl::SharedString(rContext.NFGetInputLineString( fVal, nKey )); // string not interned } ScMatrixValue ScMatrixImpl::Get(SCSIZE nC, SCSIZE nR) const @@ -2718,16 +2716,14 @@ void ScMatrixImpl::MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& nErrors[get_index(nMaxRow, nRow, nCol, nRowOffset, nColOffset)] = nErr; return; } - OUString aStr; - rContext.NFGetInputLineString( nVal, nKey, aStr); + OUString aStr = rContext.NFGetInputLineString( nVal, nKey ); aString[get_index(nMaxRow, nRow, nCol, nRowOffset, nColOffset)] = aString[get_index(nMaxRow, nRow, nCol, nRowOffset, nColOffset)] + aStr; }; std::function aBoolFunc = [&](size_t nRow, size_t nCol, bool nVal) { - OUString aStr; - rContext.NFGetInputLineString( nVal ? 1.0 : 0.0, nKey, aStr); + OUString aStr = rContext.NFGetInputLineString( nVal ? 1.0 : 0.0, nKey); aString[get_index(nMaxRow, nRow, nCol, nRowOffset, nColOffset)] = aString[get_index(nMaxRow, nRow, nCol, nRowOffset, nColOffset)] + aStr; }; @@ -2780,16 +2776,14 @@ void ScMatrixImpl::MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& nErrors[get_index(nMaxRow, nRow, nCol, nRowOffset, nColOffset)] = nErr; return; } - OUString aStr; - rContext.NFGetInputLineString( nVal, nKey, aStr); + OUString aStr = rContext.NFGetInputLineString( nVal, nKey ); aSharedString[get_index(nMaxRow, nRow, nCol, nRowOffset, nColOffset)] = rStringPool.intern(aString[get_index(nMaxRow, nRow, nCol, nRowOffset, nColOffset)] + aStr); }; std::function aBoolFunc2 = [&](size_t nRow, size_t nCol, bool nVal) { - OUString aStr; - rContext.NFGetInputLineString( nVal ? 1.0 : 0.0, nKey, aStr); + OUString aStr = rContext.NFGetInputLineString( nVal ? 1.0 : 0.0, nKey); aSharedString[get_index(nMaxRow, nRow, nCol, nRowOffset, nColOffset)] = rStringPool.intern(aString[get_index(nMaxRow, nRow, nCol, nRowOffset, nColOffset)] + aStr); }; diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 847e6d457cbf..7907a87223c0 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -586,8 +586,9 @@ void ExcTable::FillAsTableXml() XclExtLstRef xExtLst = new XclExtLst( GetRoot() ); bool bFitToPages = xPageSett->GetPageData().mbFitToPages; + bool bSummaryBelow = GetRoot().GetDoc().GetTotalsRowBelow(mnScTab); Color aTabColor = GetRoot().GetDoc().GetTabBgColor(mnScTab); - Add(new XclExpXmlSheetPr(bFitToPages, mnScTab, aTabColor, &GetFilterManager())); + Add(new XclExpXmlSheetPr(bFitToPages, mnScTab, aTabColor, bSummaryBelow, &GetFilterManager())); // GUTS (count & size of outline icons) aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_GUTS ) ); diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index 6f053373d193..7de536469cff 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -583,11 +583,6 @@ ConvErr ExcelToSc8::Convert( std::unique_ptr& rpTokArray, XclImpSt case 0x28: // Incomplete Constant Reference Subexpr.[331 281] aIn.Ignore( 6 ); // There isn't any more break; - case 0x49: - case 0x69: - case 0x29: // Variable Reference Subexpression [331 281] - aIn.Ignore( 2 ); // There isn't any more - break; case 0x4C: case 0x6C: case 0x2C: // Cell Reference Within a Name [323 ] @@ -637,11 +632,12 @@ ConvErr ExcelToSc8::Convert( std::unique_ptr& rpTokArray, XclImpSt aStack << aPool.Store( aCRD ); break; } + case 0x49: + case 0x69: + case 0x29: // Variable Reference Subexpression [331 281] case 0x4E: case 0x6E: case 0x2E: // Reference Subexpression Within a Name [332 282] - aIn.Ignore( 2 ); // There isn't any more - break; case 0x4F: case 0x6F: case 0x2F: // Incomplete Reference Subexpression... [332 282] diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index a3c0112e0228..9330189c5de9 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -113,7 +113,7 @@ public: uno::Reference< container::XIndexContainer > xElement; if ( ! ( aElement >>= xElement ) ) throw lang::IllegalArgumentException(); - IdToOleNameHash[ aName ] = xElement; + IdToOleNameHash[ aName ] = std::move(xElement); } virtual void SAL_CALL removeByName( const OUString& aName ) override { @@ -130,7 +130,7 @@ public: uno::Reference< container::XIndexContainer > xElement; if ( ! ( aElement >>= xElement ) ) throw lang::IllegalArgumentException(); - it->second = xElement; + it->second = std::move(xElement); } }; diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 381836c10c12..afd38447d865 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -368,8 +368,8 @@ XclExpWsbool::XclExpWsbool( bool bFitToPages ) SetValue( GetValue() | EXC_WSBOOL_FITTOPAGE ); } -XclExpXmlSheetPr::XclExpXmlSheetPr( bool bFitToPages, SCTAB nScTab, const Color& rTabColor, XclExpFilterManager* pManager ) : - mnScTab(nScTab), mpManager(pManager), mbFitToPage(bFitToPages), maTabColor(rTabColor) {} +XclExpXmlSheetPr::XclExpXmlSheetPr( bool bFitToPages, SCTAB nScTab, const Color& rTabColor, bool bSummaryBelow, XclExpFilterManager* pManager ) : + mnScTab(nScTab), mpManager(pManager), mbFitToPage(bFitToPages), maTabColor(rTabColor), mbSummaryBelow(bSummaryBelow) {} void XclExpXmlSheetPr::SaveXml( XclExpXmlStream& rStrm ) { @@ -388,11 +388,13 @@ void XclExpXmlSheetPr::SaveXml( XclExpXmlStream& rStrm ) // Note : the order of child elements is significant. Don't change the order. - // OOXTODO: XML_outlinePr - if (maTabColor != COL_AUTO) rWorksheet->singleElement(XML_tabColor, XML_rgb, XclXmlUtils::ToOString(maTabColor)); + // OOXTODO: XML_outlinePr --> XML_applyStyles, XML_showOutlineSymbols, XML_summaryBelow, XML_summaryRight + if (!mbSummaryBelow) + rWorksheet->singleElement(XML_outlinePr, XML_summaryBelow, "0"); + rWorksheet->singleElement(XML_pageSetUpPr, // OOXTODO: XML_autoPageBreaks, XML_fitToPage, ToPsz(mbFitToPage)); diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 7956951bb8d1..d5dd440be239 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -1769,7 +1769,7 @@ bool XclExpChSerErrorBar::Convert( XclExpChSourceLink& rValueLink, sal_uInt16& r OUString aCurrRole; if( aValueProp.GetProperty( aCurrRole, EXC_CHPROP_ROLE ) && (aCurrRole == aRole) ) { - xValueSeq = xTmpValueSeq; + xValueSeq = std::move(xTmpValueSeq); break; } } @@ -1853,17 +1853,17 @@ bool XclExpChSeries::ConvertDataSeries( { if( !xYValueSeq.is() && (aRole == EXC_CHPROP_ROLE_YVALUES) ) { - xYValueSeq = xTmpValueSeq; + xYValueSeq = std::move(xTmpValueSeq); if( !xTitleSeq.is() ) xTitleSeq = rLabeledSeq->getLabel(); // ignore role of label sequence } else if( !xXValueSeq.is() && !rTypeInfo.mbCategoryAxis && (aRole == EXC_CHPROP_ROLE_XVALUES) ) { - xXValueSeq = xTmpValueSeq; + xXValueSeq = std::move(xTmpValueSeq); } else if( !xBubbleSeq.is() && (rTypeInfo.meTypeId == EXC_CHTYPEID_BUBBLES) && (aRole == EXC_CHPROP_ROLE_SIZEVALUES) ) { - xBubbleSeq = xTmpValueSeq; + xBubbleSeq = std::move(xTmpValueSeq); xTitleSeq = rLabeledSeq->getLabel(); // ignore role of label sequence } } @@ -1969,7 +1969,7 @@ bool XclExpChSeries::ConvertStockSeries( css::uno::Reference< css::chart2::XData OUString aRole; if( aValueProp.GetProperty( aRole, EXC_CHPROP_ROLE ) && (aRole == rValueRole) ) { - xYValueSeq = xTmpValueSeq; + xYValueSeq = std::move(xTmpValueSeq); xTitleSeq = rLabeledSeq->getLabel(); // ignore role of label sequence break; } diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx index d32caecaffc2..8d36f639b1f3 100644 --- a/sc/source/filter/excel/xeextlst.cxx +++ b/sc/source/filter/excel/xeextlst.cxx @@ -328,8 +328,6 @@ const char* GetOperatorString(ScConditionMode eMode) pRet = "notBetween"; break; case ScConditionMode::Duplicate: - pRet = nullptr; - break; case ScConditionMode::NotDuplicate: pRet = nullptr; break; @@ -526,8 +524,6 @@ XclExpExtConditionalFormatting::XclExpExtConditionalFormatting( const XclExpRoot } break; case ScFormatEntry::Type::Databar: - maCfRules.AppendNewRecord(new XclExpExtCfRule( *this, *pEntry, aAddr, rItem.aGUID, rItem.nPriority)); - break; case ScFormatEntry::Type::ExtCondition: maCfRules.AppendNewRecord(new XclExpExtCfRule( *this, *pEntry, aAddr, rItem.aGUID, rItem.nPriority)); break; diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 4b0b70dfe2f9..096f872fe7b2 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -2239,6 +2239,7 @@ void XclImpChType::ReadChType( XclImpStream& rStrm ) case EXC_ID_CHAREA: case EXC_ID_CHRADARLINE: case EXC_ID_CHRADARAREA: + case EXC_ID_CHSURFACE: maData.mnFlags = rStrm.ReaduInt16(); break; @@ -2268,10 +2269,6 @@ void XclImpChType::ReadChType( XclImpStream& rStrm ) maData.mnFlags = 0; break; - case EXC_ID_CHSURFACE: - maData.mnFlags = rStrm.ReaduInt16(); - break; - default: bKnownType = false; } diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index a2c54e55df79..513febf2b257 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -3768,7 +3768,7 @@ bool XclImpDffConverter::InsertControl( const Reference< XFormComponent >& rxFor // set control model at control shape and pass back shape to caller xCtrlShape->setControl( xCtrlModel ); - if( pxShape ) *pxShape = xShape; + if( pxShape ) *pxShape = std::move(xShape); return true; } catch( const Exception& ) diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx index c7ab0aa96bd2..629ddfd18b5a 100644 --- a/sc/source/filter/inc/excrecds.hxx +++ b/sc/source/filter/inc/excrecds.hxx @@ -304,7 +304,7 @@ class XclExpXmlSheetPr : public XclExpRecordBase { public: explicit XclExpXmlSheetPr( - bool bFitToPages, SCTAB nScTab, const Color& rTabColor, XclExpFilterManager* pManager ); + bool bFitToPages, SCTAB nScTab, const Color& rTabColor, bool bSummaryBelow, XclExpFilterManager* pManager ); virtual void SaveXml( XclExpXmlStream& rStrm ) override; @@ -313,6 +313,7 @@ private: XclExpFilterManager* mpManager; bool mbFitToPage; Color maTabColor; + bool mbSummaryBelow; }; class XclExpFiltermode : public XclExpEmptyRecord diff --git a/sc/source/filter/inc/lotform.hxx b/sc/source/filter/inc/lotform.hxx index 29751a2f5533..fa618b021da0 100644 --- a/sc/source/filter/inc/lotform.hxx +++ b/sc/source/filter/inc/lotform.hxx @@ -23,7 +23,7 @@ enum FUNC_TYPE { - FT_Return = 0, // End Formula + FT_Return, // End Formula FT_FuncFix0, // Function, 0 Parameter FT_FuncFix1, // Function, 0 Parameter FT_FuncFix2, // Function, 0 Parameter diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx index b5f9ee055a7a..10bfc67e2da3 100644 --- a/sc/source/filter/lotus/lotform.cxx +++ b/sc/source/filter/lotus/lotform.cxx @@ -426,7 +426,7 @@ void LotusToSc::Convert( std::unique_ptr& rpErg, sal_Int32& rRest nBytesLeft = rRest; - while( eType ) // != FT_Return (==0) + while( eType != FT_Return ) { sal_uInt8 nOc; Read(nOc); diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx b/sc/source/filter/oox/pivotcachebuffer.cxx index 3af082b3c10e..20d0cbd62b83 100644 --- a/sc/source/filter/oox/pivotcachebuffer.cxx +++ b/sc/source/filter/oox/pivotcachebuffer.cxx @@ -714,7 +714,7 @@ OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotFie Reference< XDataPilotField > xDPNewField = xDPGrouping->createNameGroup( comphelper::containerToSequence( aMembers ) ); SAL_WARN_IF( xDPGroupField.is() == xDPNewField.is(), "sc", "PivotCacheField::createParentGroupField - missing group field" ); if( !xDPGroupField.is() ) - xDPGroupField = xDPNewField; + xDPGroupField = std::move(xDPNewField); // get current grouping info DataPilotFieldGroupInfo aGroupInfo; diff --git a/sc/source/filter/oox/worksheetsettings.cxx b/sc/source/filter/oox/worksheetsettings.cxx index 988207aa9067..46d633044115 100644 --- a/sc/source/filter/oox/worksheetsettings.cxx +++ b/sc/source/filter/oox/worksheetsettings.cxx @@ -287,6 +287,12 @@ void WorksheetSettings::finalizeImport() ::Color nColor = maSheetSettings.maTabColor.getColor( getBaseFilter().getGraphicHelper() ); aPropSet.setProperty( PROP_TabColor, nColor ); } + + // Summary data below or above the contents + if ( !maSheetSettings.mbSummaryBelow ) + { + aPropSet.setProperty( PROP_TotalsRowBelow, false ); + } } } // namespace oox::xls diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index e6f1072f3fbe..577f43efddca 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -388,7 +388,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu pFormatter->GetFormatForLanguageIfBuiltIn( nIndex, LANGUAGE_SYSTEM); OSL_ENSURE( nNewIndex != nIndex, "ScEEImport::WriteToDocument: NumbersEnglishUS not a built-in format?"); - pFormatter->GetInputLineString( fEnVal, nNewIndex, aStr); + aStr = pFormatter->GetInputLineString( fEnVal, nNewIndex ); } else bTextFormat = true; diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx index ae5627385fa9..1bc9c21b0e6f 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx @@ -71,7 +71,7 @@ const ScCellValue& ScMyCellInfo::CreateCell(ScDocument& rDoc) nFormat = rDoc.GetFormatTable()->GetStandardFormat( SvNumFormatType::DATE, ScGlobal::eLnge ); else if (nType == css::util::NumberFormat::TIME) nFormat = rDoc.GetFormatTable()->GetStandardFormat( SvNumFormatType::TIME, ScGlobal::eLnge ); - rDoc.GetFormatTable()->GetInputLineString(fValue, nFormat, sInputString); + sInputString = rDoc.GetFormatTable()->GetInputLineString(fValue, nFormat); } return maCell; diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index b37565d34dbf..21ba6a6aed0c 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -551,7 +551,7 @@ void ScXMLExport::CollectSharedData(SCTAB& nTableCount, sal_Int32& nShapesCount) aMyShape.aEndAddress.SetTab( nTable ); aMyShape.nEndX = pAnchor->maEndOffset.X(); aMyShape.nEndY = pAnchor->maEndOffset.Y(); - aMyShape.xShape = xShape; + aMyShape.xShape = std::move(xShape); pSharedData->AddNewShape(aMyShape); pSharedData->SetLastColumn(nTable, pAnchor->maStart.Col()); pSharedData->SetLastRow(nTable, pAnchor->maStart.Row()); @@ -2498,7 +2498,7 @@ void ScXMLExport::collectAutoStyles() OUString sName( rTextEntry.maName ); GetAutoStylePool()->AddNamed(sName, XmlStyleFamily::TEXT_TEXT, OUString(), std::move(aPropStates)); GetAutoStylePool()->RegisterName(XmlStyleFamily::TEXT_TEXT, sName); - xPrevCursorProp = xCursorProp; + xPrevCursorProp = std::move(xCursorProp); aPrevPos = aPos; } } diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx index bed4ddb69669..fa51d4818983 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx @@ -1035,7 +1035,7 @@ void ScShapeChildren::FillShapes(const tools::Rectangle& aPixelPaintRect, const if(!aClippedPixelPaintRect.GetIntersection(aRect).IsEmpty()) { ScShapeChild aShape; - aShape.mxShape = xShape; + aShape.mxShape = std::move(xShape); aShape.mnRangeId = nRangeId; if (pObj->GetLayer().anyOf(SC_LAYER_INTERN, SC_LAYER_FRONT)) { diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index d6b7544d33cb..deb6166bfbd5 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1914,7 +1914,7 @@ static OUString lcl_Calculate( const OUString& rFormula, ScDocument& rDoc, const double n = pCalc->GetValue(); sal_uInt32 nFormat = aFormatter.GetStandardFormat( n, 0, pCalc->GetFormatType(), ScGlobal::eLnge ); - aFormatter.GetInputLineString( n, nFormat, aValue ); + aValue = aFormatter.GetInputLineString( n, nFormat ); //! display OutputString but insert InputLineString } else diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx index 7257fca2b469..ff8afff2d48f 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -51,9 +51,7 @@ void GetType(const weld::ComboBox& rLstBox, const weld::Entry& rEd, ScColorScale OUString convertNumberToString(double nVal, const ScDocument* pDoc) { SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable(); - OUString aText; - pNumberFormatter->GetInputLineString(nVal, 0, aText); - return aText; + return pNumberFormatter->GetInputLineString(nVal, 0); } void SetValue( const ScDocument* pDoc, const ScColorScaleEntry* pEntry, weld::Entry& rEdit) diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index f04706364cac..c9b5e208ffa5 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -486,9 +486,7 @@ namespace { OUString convertNumberToString(double nVal, const ScDocument* pDoc) { SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable(); - OUString aText; - pNumberFormatter->GetInputLineString(nVal, 0, aText); - return aText; + return pNumberFormatter->GetInputLineString(nVal, 0); } const struct @@ -955,8 +953,7 @@ void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, weld::ComboBox& rLbT { double nVal = rEntry.GetValue(); SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable(); - OUString aText; - pNumberFormatter->GetInputLineString(nVal, 0, aText); + OUString aText = pNumberFormatter->GetInputLineString(nVal, 0); rEdit.set_text(aText); } break; diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index 7040a9cf2d79..c95a3df9df27 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -283,10 +283,35 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, aRange.Format(sRangeString, ScRefFlags::VALID, *mpDocument, mpDocument->GetAddressConvention()); mxRangeEntry->SetText(sRangeString); + ScConditionalFormat* format = mpViewData->GetDocument().GetCondFormat( + maPosition.Col(), maPosition.Row(), maPosition.Tab()); + OUString sStyleName; + if (format) + { + const ScFormatEntry* entry = format->GetEntry(mnEntryIndex); + ScFormatEntry::Type type = entry->GetType(); + if (type == ScFormatEntry::Type::Condition) + { + const ScCondFormatEntry* condEntry = static_cast(entry); + sStyleName = condEntry->GetStyle(); + if (mxNumberEntry->get_visible()) + mxNumberEntry->set_text(condEntry->GetExpression(aRange.GetTopLeftCorner(), 0)); + if (mxNumberEntry2->get_visible()) + mxNumberEntry2->set_text(condEntry->GetExpression(aRange.GetTopLeftCorner(), 1)); + } + else if (type == ScFormatEntry::Type::Date) + { + const ScCondDateFormatEntry* dateEntry + = static_cast(entry); + sStyleName = dateEntry->GetStyleName(); + } + } + StartListening(*mpDocument->GetStyleSheetPool(), DuplicateHandling::Prevent); ScCondFormatHelper::FillStyleListBox(mpDocument, *mxStyles); - mxStyles->set_active(1); + mxStyles->set_active_text(sStyleName); + StyleSelectHdl(*mxStyles); mxWdPreviewWin->show(); } @@ -342,14 +367,12 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo std::unique_ptr pFormat(new ScConditionalFormat(0, mpDocument)); - OUString sExpression1 - = (mxNumberEntry->get_visible() == true && mxAllInputs->get_visible() == true - ? mxNumberEntry->get_text() - : u""_ustr); - OUString sExpression2 - = (mxNumberEntry2->get_visible() == true && mxAllInputs->get_visible() == true - ? mxNumberEntry2->get_text() - : u""_ustr); + OUString sExpression1 = (mxNumberEntry->get_visible() && mxAllInputs->get_visible() + ? mxNumberEntry->get_text() + : u""_ustr); + OUString sExpression2 = (mxNumberEntry2->get_visible() && mxAllInputs->get_visible() + ? mxNumberEntry2->get_text() + : u""_ustr); switch (meMode) { diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 1382057b4524..9735b15c711e 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -1540,17 +1540,15 @@ void ScFilterDlg::SetValString( const OUString& rQueryStr, const ScQueryEntry::I if (rItem.meType == ScQueryEntry::ByValue) { if (pDoc) - { - pDoc->GetFormatTable()->GetInputLineString(rItem.mfVal, 0, rValStr); - } + rValStr = pDoc->GetFormatTable()->GetInputLineString(rItem.mfVal, 0); } else if (rItem.meType == ScQueryEntry::ByDate) { if (pDoc) { SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); - pFormatter->GetInputLineString(rItem.mfVal, - pFormatter->GetStandardFormat( SvNumFormatType::DATE), rValStr); + rValStr = pFormatter->GetInputLineString(rItem.mfVal, + pFormatter->GetStandardFormat( SvNumFormatType::DATE)); } } else diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index c657f482da34..e0fcf640f756 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -447,6 +447,7 @@ ScTpSubTotalOptions::ScTpSubTotalOptions(weld::Container* pPage, weld::DialogCon , m_xBtnPagebreak(m_xBuilder->weld_check_button(u"pagebreak"_ustr)) , m_xBtnCase(m_xBuilder->weld_check_button(u"case"_ustr)) , m_xBtnSort(m_xBuilder->weld_check_button(u"sort"_ustr)) + , m_xBtnSummary(m_xBuilder->weld_check_button(u"summarybelow"_ustr)) , m_xFlSort(m_xBuilder->weld_label(u"label2"_ustr)) , m_xBtnAscending(m_xBuilder->weld_radio_button(u"ascending"_ustr)) , m_xBtnDescending(m_xBuilder->weld_radio_button(u"descending"_ustr)) @@ -490,6 +491,7 @@ void ScTpSubTotalOptions::Reset( const SfxItemSet* /* rArgSet */ ) m_xBtnCase->set_active( rSubTotalData.bCaseSens ); m_xBtnFormats->set_active( rSubTotalData.bIncludePattern ); m_xBtnSort->set_active( rSubTotalData.bDoSort ); + m_xBtnSummary->set_active( rSubTotalData.bSummaryBelow ); m_xBtnAscending->set_active( rSubTotalData.bAscending ); m_xBtnDescending->set_active( !rSubTotalData.bAscending ); @@ -524,6 +526,10 @@ bool ScTpSubTotalOptions::FillItemSet( SfxItemSet* rArgSet ) theSubTotalData.bCaseSens = m_xBtnCase->get_active(); theSubTotalData.bIncludePattern = m_xBtnFormats->get_active(); theSubTotalData.bDoSort = m_xBtnSort->get_active(); + + theSubTotalData.bSummaryBelow = m_xBtnSummary->get_active(); + pDoc->SetTotalsRowBelow(pViewData->GetTabNo(), theSubTotalData.bSummaryBelow); + theSubTotalData.bAscending = m_xBtnAscending->get_active(); theSubTotalData.bUserDef = m_xBtnUserDef->get_active(); theSubTotalData.nUserIndex = (m_xBtnUserDef->get_active()) diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 43ca32993d80..842474dd7af7 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -487,7 +487,8 @@ private: bool DoTableBackgroundDialog( sal_Int32 nResult, const VclPtr& pDlg, const std::shared_ptr& xReq, Color aOldTabBgColor, sal_uInt16 nSlot ); void ExecuteStyleEdit(SfxRequest& rReq, SfxStyleSheetBase* pStyleSheet, sal_uInt16 nRetMask, sal_uInt16 nSlotId, bool bAddUndo, bool bUndo, - ScStyleSaveData& rOldData, ScStyleSaveData& rNewData, + const std::shared_ptr& rOldData, + const std::shared_ptr& rNewData, SfxStyleFamily eFamily, bool bStyleToMarked, bool bListAction, SdrObject* pEditObject, ESelection aSelection); void ExecuteStyleEditDialog(VclPtr pDlg, diff --git a/sc/source/ui/inc/tpsubt.hxx b/sc/source/ui/inc/tpsubt.hxx index ecfa2ec18522..42eed5e4046e 100644 --- a/sc/source/ui/inc/tpsubt.hxx +++ b/sc/source/ui/inc/tpsubt.hxx @@ -135,6 +135,7 @@ private: std::unique_ptr m_xBtnPagebreak; std::unique_ptr m_xBtnCase; std::unique_ptr m_xBtnSort; + std::unique_ptr m_xBtnSummary; std::unique_ptr m_xFlSort; std::unique_ptr m_xBtnAscending; std::unique_ptr m_xBtnDescending; diff --git a/sc/source/ui/miscdlgs/filldlg.cxx b/sc/source/ui/miscdlgs/filldlg.cxx index 9bcc5bfbf6ed..38cfb3782b32 100644 --- a/sc/source/ui/miscdlgs/filldlg.cxx +++ b/sc/source/ui/miscdlgs/filldlg.cxx @@ -169,13 +169,12 @@ void ScFillSeriesDlg::Init( sal_uInt16 nPossDir ) m_xEdStartVal->set_text( aStartStrVal); - OUString aIncrTxt; - rDoc.GetFormatTable()->GetInputLineString( fIncrement, 0, aIncrTxt ); + OUString aIncrTxt = rDoc.GetFormatTable()->GetInputLineString( fIncrement, 0 ); m_xEdIncrement->set_text( aIncrTxt ); OUString aEndTxt; if ( fEndVal != MAXDOUBLE ) - rDoc.GetFormatTable()->GetInputLineString( fEndVal, 0, aEndTxt ); + aEndTxt = rDoc.GetFormatTable()->GetInputLineString( fEndVal, 0 ); m_xEdEndVal->set_text( aEndTxt ); } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 248c1763badf..556edb426ba9 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -787,6 +787,7 @@ static const SfxItemPropertySet* lcl_GetSheetPropertySet() { SC_UNO_CODENAME, SC_WID_UNO_CODENAME, cppu::UnoType::get(), 0, 0}, { SC_UNO_NAMEDRANGES, SC_WID_UNO_NAMES, cppu::UnoType::get(), 0, 0 }, { SC_UNO_SOLVERSETTINGS, SC_WID_UNO_SOLVERSETTINGS, cppu::UnoType::get(), 0, 0 }, + { SC_UNONAME_TOTALBELOW, SC_WID_UNO_TOTALBELOW, cppu::UnoType::get(), 0, 0 }, }; static SfxItemPropertySet aSheetPropertySet( aSheetPropertyMap_Impl ); return &aSheetPropertySet; @@ -5373,8 +5374,7 @@ void SAL_CALL ScCellRangeObj::filter( const uno::ReferenceGetDocument().GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr); + OUString aStr = pDocSh->GetDocument().GetFormatTable()->GetInputLineString(rItem.mfVal, 0); rItem.maString = rPool.intern(aStr); } } @@ -8063,6 +8063,11 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry // how to set the format correctly } } + else if (pEntry->nWID == SC_WID_UNO_TOTALBELOW) + { + bool bTotalsRowBelow = ScUnoHelpFunctions::GetBoolFromAny(aValue); + rDoc.SetTotalsRowBelow(nTab, bTotalsRowBelow); + } else ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID } diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index 170f1a58993d..db8946232706 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -1085,8 +1085,7 @@ void fillQueryParam( if (rItem.meType == ScQueryEntry::ByValue) { - OUString aStr; - pDoc->GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr); + OUString aStr = pDoc->GetFormatTable()->GetInputLineString(rItem.mfVal, 0); rItem.maString = rPool.intern(aStr); } } @@ -1142,8 +1141,7 @@ void fillQueryParam( if (aItem.meType == ScQueryEntry::ByValue) { - OUString aStr; - pDoc->GetFormatTable()->GetInputLineString(aItem.mfVal, 0, aStr); + OUString aStr = pDoc->GetFormatTable()->GetInputLineString(aItem.mfVal, 0); aItem.maString = rPool.intern(aStr); } else if (aItem.meType == ScQueryEntry::ByTextColor @@ -1321,8 +1319,7 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields( if (rItem.meType != ScQueryEntry::ByString) { - OUString aStr; - rDoc.GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr); + OUString aStr = rDoc.GetFormatTable()->GetInputLineString(rItem.mfVal, 0); rItem.maString = rPool.intern(aStr); } diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 31cf4dd6296f..ab0bf810ee0b 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -1304,7 +1304,7 @@ bool ScTabViewObj::MouseReleased( const awt::MouseEvent& e ) aMouseEvent.Y = e.Y; aMouseEvent.ClickCount = e.ClickCount; aMouseEvent.PopupTrigger = e.PopupTrigger; - aMouseEvent.Target = xTarget; + aMouseEvent.Target = std::move(xTarget); aMouseEvent.Modifiers = e.Modifiers; // Listener's handler may remove it from the listeners list diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx index 0f00dae66ed7..0687f9c302ca 100644 --- a/sc/source/ui/vba/excelvbahelper.cxx +++ b/sc/source/ui/vba/excelvbahelper.cxx @@ -83,7 +83,7 @@ GetAutoFiltRange( const ScDocShell* pShell, sal_Int16 nSheet ) xProps->getPropertyValue(u"AutoFilter"_ustr) >>= bHasAuto; if ( bHasAuto ) { - xDataBaseRange=xDBRange; + xDataBaseRange = std::move(xDBRange); } } return xDataBaseRange; diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 299e6adb4527..3d15627aa7c5 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -621,7 +621,7 @@ ScVbaApplication::getActiveSheet() xWorkbook->getActiveSheet(); if ( xWorksheet.is() ) { - result = xWorksheet; + result = std::move(xWorksheet); } } diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx index 2a0aea444fe9..a866b7c6105e 100644 --- a/sc/source/ui/vba/vbaformat.cxx +++ b/sc/source/ui/vba/vbaformat.cxx @@ -135,14 +135,12 @@ ScVbaFormat< Ifc... >::getVerticalAlignment( ) switch( aAPIAlignment ) { case table::CellVertJustify2::BOTTOM: + case table::CellVertJustify2::STANDARD: aResult <<= excel::XlVAlign::xlVAlignBottom; break; case table::CellVertJustify2::CENTER: aResult <<= excel::XlVAlign::xlVAlignCenter; break; - case table::CellVertJustify2::STANDARD: - aResult <<= excel::XlVAlign::xlVAlignBottom; - break; case table::CellVertJustify2::TOP: aResult <<= excel::XlVAlign::xlVAlignTop; break; @@ -171,14 +169,12 @@ ScVbaFormat< Ifc... >::setHorizontalAlignment( const uno::Any& HorizontalAlignme switch ( nAlignment ) { case excel::XlHAlign::xlHAlignJustify: + case excel::XlHAlign::xlHAlignDistributed: aVal <<= table::CellHoriJustify_BLOCK; break; case excel::XlHAlign::xlHAlignCenter: aVal <<= table::CellHoriJustify_CENTER; break; - case excel::XlHAlign::xlHAlignDistributed: - aVal <<= table::CellHoriJustify_BLOCK; - break; case excel::XlHAlign::xlHAlignLeft: aVal <<= table::CellHoriJustify_LEFT; break; diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index d93bc994f099..af9858e5dba4 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -4198,7 +4198,7 @@ static uno::Reference< sheet::XCellRangeReferrer > getNamedRange( const uno::Ref { if ( thisRange == xName->getReferredCells() ) { - xNamedRange = xName; + xNamedRange = std::move(xName); break; } } diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 1e4b9f1bdc33..71a827abc1f3 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -3643,6 +3643,12 @@ void ScCellShell::ExecuteSubtotals(SfxRequest& rReq) } pDBData->GetSubTotalParam( aSubTotalParam ); + + ScDocument& rDoc = GetViewData().GetDocument(); + SCTAB nTab = GetViewData().GetTabNo(); + if (!rDoc.GetTotalsRowBelow(nTab)) + aSubTotalParam.bSummaryBelow = false; + aSubTotalParam.bRemoveOnly = false; if (bAnonymous) { diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index 09507f258d69..d6ba1e499a66 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -55,24 +55,24 @@ ScTabControl::ScTabControl( vcl::Window* pParent, ScViewData* pData ) SCTAB nCount = rDoc.GetTableCount(); for (SCTAB i=0; i(i)+1, aString, TabBarPageBits::Blue); + else + InsertPage( static_cast(i)+1, aString ); + + if ( rDoc.IsTabProtected(i) ) + SetProtectionSymbol(static_cast(i)+1, true); + + if ( !rDoc.IsDefaultTabBgColor(i) ) { - if (rDoc.GetName(i,aString)) - { - if ( rDoc.IsScenario(i) ) - InsertPage( static_cast(i)+1, aString, TabBarPageBits::Blue); - else - InsertPage( static_cast(i)+1, aString ); - - if ( rDoc.IsTabProtected(i) ) - SetProtectionSymbol(static_cast(i)+1, true); - - if ( !rDoc.IsDefaultTabBgColor(i) ) - { - aTabBgColor = rDoc.GetTabBgColor(i); - SetTabBgColor( static_cast(i)+1, aTabBgColor ); - } - } + aTabBgColor = rDoc.GetTabBgColor(i); + SetTabBgColor( static_cast(i)+1, aTabBgColor ); } } diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 36802c39168b..9088af8a6e24 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -1291,7 +1291,11 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll) // slower than they are used to. If that becomes an // issue for enough users, the reduction factor may // need to be lowered to find a good balance point. +#ifdef _WIN32 + static const tools::Long nHScrollReductionFactor = 3; +#else static const tools::Long nHScrollReductionFactor = 8; +#endif // tdf#161945 increase sensitivity for negative horizontal deltas // A side effect of the anti-jitter code is that it tends diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 4702091e82dc..44813b6c53bc 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -1334,7 +1334,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { bool bIsCol = (nSlot == SID_WINDOW_FIX_COL); sal_Int32 nFreezeIndex = 1; - if (const SfxInt32Item* pItem = rReq.GetArg(nSlot)) + if (const SfxInt32Item* pItem = rReq.GetArg(FN_PARAM_1)) { nFreezeIndex = pItem->GetValue(); if (nFreezeIndex < 0) diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index f79601df9f39..a01da9d50b3f 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -962,8 +962,8 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) bool bStyleToMarked = false; bool bListAction = false; bool bAddUndo = false; // add ScUndoModifyStyle (style modified) - ScStyleSaveData aOldData; // for undo/redo - ScStyleSaveData aNewData; + auto xOldData = std::make_shared(); // for undo/redo + auto xNewData = std::make_shared(); SfxStyleFamily eFamily = SfxStyleFamily::Para; const SfxUInt16Item* pFamItem; @@ -1052,7 +1052,7 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) pStyleSheet = pStylePool->Find( aStyleName, eFamily ); - aOldData.InitFromStyle( pStyleSheet ); + xOldData->InitFromStyle( pStyleSheet ); } break; @@ -1236,7 +1236,7 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) if ( pStyleSheet ) { - aOldData.InitFromStyle( pStyleSheet ); + xOldData->InitFromStyle( pStyleSheet ); if ( bUndo ) { @@ -1254,7 +1254,7 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) } } - aNewData.InitFromStyle( pStyleSheet ); + xNewData->InitFromStyle( pStyleSheet ); bAddUndo = true; rReq.Done(); } @@ -1365,7 +1365,7 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) if ( bUsed ) ScPrintFunc( pDocSh, GetPrinter(true), nInTab ).UpdatePages(); - aNewData.InitFromStyle( pStyleSheet ); + xNewData->InitFromStyle( pStyleSheet ); bAddUndo = true; rReq.Done(); nRetMask = sal_uInt16(true); @@ -1442,7 +1442,7 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) else { pStyleSheet = GetDrawView()->GetStyleSheet(); - aOldData.InitFromStyle( pStyleSheet ); + xOldData->InitFromStyle( pStyleSheet ); } if ( bUndo ) @@ -1459,7 +1459,7 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) pStyleSet->Put(aCoreSet); static_cast(pStyleSheet)->Broadcast(SfxHint(SfxHintId::DataChanged)); - aNewData.InitFromStyle( pStyleSheet ); + xNewData->InitFromStyle( pStyleSheet ); bAddUndo = true; // call SetStyleSheet after adding the ScUndoModifyStyle @@ -1483,18 +1483,19 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) if (pStyleSheet) { ExecuteStyleEdit(rReq, pStyleSheet, nRetMask, nSlotId, bAddUndo, bUndo, - aOldData, aNewData, eFamily, bStyleToMarked, bListAction, pEditObject, aSelection); + xOldData, xNewData, eFamily, bStyleToMarked, bListAction, pEditObject, aSelection); return; // skip calling ExecuteStyleEditPost because we invoked an async dialog } } ExecuteStyleEditPost(rReq, pStyleSheet, nSlotId, nRetMask, bAddUndo, bUndo, - eFamily, aOldData, aNewData, bStyleToMarked, bListAction, pEditObject, aSelection); + eFamily, *xOldData, *xNewData, bStyleToMarked, bListAction, pEditObject, aSelection); } void ScTabViewShell::ExecuteStyleEdit(SfxRequest& rReq, SfxStyleSheetBase* pStyleSheet, sal_uInt16 nRetMask, sal_uInt16 nSlotId, bool bAddUndo, bool bUndo, - ScStyleSaveData& rOldData, ScStyleSaveData& rNewData, SfxStyleFamily eFamily, + const std::shared_ptr& rOldData, + const std::shared_ptr& rNewData, SfxStyleFamily eFamily, bool bStyleToMarked, bool bListAction, SdrObject* pEditObject, ESelection aSelection) { @@ -1583,16 +1584,16 @@ void ScTabViewShell::ExecuteStyleEdit(SfxRequest& rReq, SfxStyleSheetBase* pStyl pDlg->StartExecuteAsync( [this, pDlg, xRequest=std::move(xRequest), pStyleSheet, nRetMask, xOldSet=std::move(xOldSet), nSlotId, bAddUndo, bUndo, - aOldData=rOldData, aNewData=rNewData, aOldName, eFamily, bStyleToMarked, + xOldData = rOldData, xNewData = rNewData, aOldName, eFamily, bStyleToMarked, bListAction, pEditObject, aSelection] (sal_Int32 nResult) mutable -> void { SetInFormatDialog(false); ExecuteStyleEditDialog(pDlg, pStyleSheet, nResult, nRetMask, xOldSet, nSlotId, - bAddUndo, aNewData, aOldName); + bAddUndo, *xNewData, aOldName); pDlg->disposeOnce(); ExecuteStyleEditPost(*xRequest, pStyleSheet, nSlotId, nRetMask, bAddUndo, bUndo, eFamily, - aOldData, aNewData, bStyleToMarked, bListAction, pEditObject, aSelection); + *xOldData, *xNewData, bStyleToMarked, bListAction, pEditObject, aSelection); } ); } diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 0a174df6d84b..a2b5fb9e8873 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -625,6 +625,7 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) break; case SID_INSERT_SIGNATURELINE: + case SID_INSERT_QRCODE: if ( bTabProt || bShared || (pSdrView && pSdrView->GetMarkedObjectList().GetMarkCount() != 0)) rSet.DisableItem( nWhich ); break; @@ -634,10 +635,6 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) rSet.DisableItem(nWhich); break; - case SID_INSERT_QRCODE: - if ( bTabProt || bShared || (pSdrView && pSdrView->GetMarkedObjectList().GetMarkCount() != 0)) - rSet.DisableItem( nWhich ); - break; case SID_EDIT_QRCODE: if (!IsQRCodeSelected()) rSet.DisableItem(nWhich); diff --git a/sc/uiconfig/scalc/ui/formatcellsdialog.ui b/sc/uiconfig/scalc/ui/formatcellsdialog.ui index d4104ef99913..ea0daf8e9fd5 100644 --- a/sc/uiconfig/scalc/ui/formatcellsdialog.ui +++ b/sc/uiconfig/scalc/ui/formatcellsdialog.ui @@ -92,7 +92,6 @@ True True True - left True True diff --git a/sc/uiconfig/scalc/ui/subtotaloptionspage.ui b/sc/uiconfig/scalc/ui/subtotaloptionspage.ui index d81fb987be61..0d1c54f510d0 100644 --- a/sc/uiconfig/scalc/ui/subtotaloptionspage.ui +++ b/sc/uiconfig/scalc/ui/subtotaloptionspage.ui @@ -1,39 +1,39 @@ - + True - False - 6 + False + 6 vertical 12 True - False + False True - 0 - none + 0 + none - + True - False - True - True - 6 + False 12 6 + True + True + 6 _Page break between groups True - True - False + True + False True - True - True + True + True Inserts a new page after each group of subtotaled data. @@ -41,19 +41,19 @@ - 0 - 0 + 0 + 0 _Case sensitive True - True - False + True + False True - True - True + True + True Recalculates subtotals when you change the case of a data label. @@ -61,19 +61,19 @@ - 0 - 1 + 0 + 1 Pre-_sort area according to groups True - True - False + True + False True - True - True + True + True Sorts the area that you selected in the Group by box of the Group tabs according to the columns that you selected. @@ -81,8 +81,28 @@ - 0 - 2 + 0 + 2 + + + + + _Summary below data + True + True + False + True + True + True + + + Decide if the subtotals below or above the data. Reposition subtotals when you change the summary below data options. + + + + + 0 + 3 @@ -90,7 +110,7 @@ True - False + False Groups @@ -107,31 +127,31 @@ True - False + False True True - 0 - none + 0 + none - + True - False - True - True - 6 + False 12 6 + True + True + 6 _Ascending True - True - False + True + False True - True + True True - True + True Sorts beginning with the lowest value. You can define the sort rules on Data - Sort - Options. @@ -139,19 +159,19 @@ - 0 - 0 + 0 + 0 D_escending True - True - False + True + False True - True - True + True + True ascending @@ -160,19 +180,19 @@ - 0 - 1 + 0 + 1 I_nclude formats True - True - False + True + False True - True - True + True + True Considers formatting attributes when sorting. @@ -180,40 +200,40 @@ - 0 - 2 + 0 + 2 C_ustom sort order True - True - False + True + False True - True - True + True + True - 0 - 3 + 0 + 3 True - False + False 12 - 0 - 4 + 0 + 4 @@ -221,7 +241,7 @@ True - False + False Sort diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx index e2ad9e2a7557..64277a2053c9 100644 --- a/scaddins/source/analysis/analysishelper.cxx +++ b/scaddins/source/analysis/analysishelper.cxx @@ -775,7 +775,7 @@ bool ParseDouble( const sal_Unicode*& rp, double& rRet ) sal_Int32 nMaxExp = 307; sal_uInt16 nDigCnt = 18; // max. number of digits to read in, rest doesn't matter - enum State { S_End = 0, S_Sign, S_IntStart, S_Int, S_IgnoreIntDigs, S_Frac, S_IgnoreFracDigs, S_ExpSign, S_Exp }; + enum State { S_End, S_Sign, S_IntStart, S_Int, S_IgnoreIntDigs, S_Frac, S_IgnoreFracDigs, S_ExpSign, S_Exp }; State eS = S_Sign; @@ -785,7 +785,7 @@ bool ParseDouble( const sal_Unicode*& rp, double& rRet ) const sal_Unicode* p = rp; sal_Unicode c; - while( eS ) + while( eS != S_End ) { c = *p; switch( eS ) diff --git a/scp2/source/ooo/module_helppack.ulf b/scp2/source/ooo/module_helppack.ulf index 18a1a0e54051..0afe7079df7f 100644 --- a/scp2/source/ooo/module_helppack.ulf +++ b/scp2/source/ooo/module_helppack.ulf @@ -202,6 +202,12 @@ en-US = "Southern Sotho (Sutu)" [STR_DESC_MODULE_HELPPACK_ST] en-US = "Installs Southern Sotho (Sutu) help in %PRODUCTNAME %PRODUCTVERSION" +[STR_NAME_MODULE_HELPPACK_TL] +en-US = "Tagalog" + +[STR_DESC_MODULE_HELPPACK_TL] +en-US = "Installs Tagalog help in %PRODUCTNAME %PRODUCTVERSION" + [STR_NAME_MODULE_HELPPACK_TN] en-US = "Tswana" diff --git a/scp2/source/ooo/module_langpack.ulf b/scp2/source/ooo/module_langpack.ulf index e9274207734c..af10f8007e1b 100644 --- a/scp2/source/ooo/module_langpack.ulf +++ b/scp2/source/ooo/module_langpack.ulf @@ -250,6 +250,12 @@ en-US = "Southern Sotho (Sutu)" [STR_DESC_MODULE_LANGPACK_ST] en-US = "Installs the Southern Sotho (Sutu) user interface" +[STR_NAME_MODULE_LANGPACK_TL] +en-US = "Tagalog" + +[STR_DESC_MODULE_LANGPACK_TL] +en-US = "Installs the Tagalog user interface" + [STR_NAME_MODULE_LANGPACK_TN] en-US = "Tswana" diff --git a/scripting/source/provider/ProviderCache.cxx b/scripting/source/provider/ProviderCache.cxx index 2c1b1c27639a..b32ab099002e 100644 --- a/scripting/source/provider/ProviderCache.cxx +++ b/scripting/source/provider/ProviderCache.cxx @@ -98,7 +98,7 @@ ProviderCache::getAllProviders() Reference xScriptProvider = rDetail.second.provider; if ( xScriptProvider.is() ) { - pproviders[ providerIndex++ ] = xScriptProvider; + pproviders[ providerIndex++ ] = std::move(xScriptProvider); } else { @@ -106,7 +106,7 @@ ProviderCache::getAllProviders() try { xScriptProvider = createProvider(rDetail.second); - pproviders[ providerIndex++ ] = xScriptProvider; + pproviders[ providerIndex++ ] = std::move(xScriptProvider); } catch ( const Exception& ) { @@ -158,7 +158,7 @@ ProviderCache::populateCache() { serviceName = *pName; ProviderDetails details; - details.factory = factory; + details.factory = std::move(factory); m_hProviderDetailsCache[ serviceName ] = std::move(details); } } diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index 50f88cc93a3d..d4dad173b7fb 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -36,6 +36,7 @@ namespace com::sun::star::xml::dom { class XNode; } namespace com::sun::star::uno { class XInterface; } +namespace editeng { class SvxFieldItemUpdater; } namespace vcl { class Font; } namespace com::sun::star::presentation { class XPresentation2; } class SdOutliner; @@ -628,6 +629,9 @@ public: void dumpAsXml(xmlTextWriterPtr pWriter) const override; private: + + void UpdatePageRelativeURLsImpl(const std::function& rItemCallback); + /** This member stores the printer independent layout mode. Please refer to SetPrinterIndependentLayout() for its values. diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx index 317e99160a18..df3a657317b5 100644 --- a/sd/inc/sdpage.hxx +++ b/sd/inc/sdpage.hxx @@ -248,7 +248,7 @@ public: const ::tools::Rectangle& rOldBoundRect) override; void SetLayoutName(const OUString& aName); - virtual OUString GetLayoutName() const override { return maLayoutName; } + const OUString& GetLayoutName() const { return maLayoutName; } void SetFileName(const OUString& aName) { maFileName = aName; } const OUString& GetFileName() const { return maFileName; } diff --git a/sd/inc/stlpool.hxx b/sd/inc/stlpool.hxx index 9e1693249f86..a72acb6d9330 100644 --- a/sd/inc/stlpool.hxx +++ b/sd/inc/stlpool.hxx @@ -122,7 +122,8 @@ private: void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, StyleSheetCopyResultVector& rCreatedSheets ); void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, StyleSheetCopyResultVector& rCreatedSheets, std::u16string_view rRenameSuffix ); - virtual rtl::Reference Create(const OUString& rName, SfxStyleFamily eFamily, SfxStyleSearchBits nMask) override; + virtual rtl::Reference Create(const OUString& rName, SfxStyleFamily eFamily, + SfxStyleSearchBits nMask, const OUString& rParentStyleSheetName) override; using SfxStyleSheetPool::Create; virtual ~SdStyleSheetPool() override; diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx index aa7238e5b0e8..f11500b620f7 100644 --- a/sd/inc/stlsheet.hxx +++ b/sd/inc/stlsheet.hxx @@ -54,7 +54,8 @@ typedef cppu::ImplInheritanceHelper< SfxUnoStyleSheet, class SdStyleSheet final : public SdStyleSheetBase { public: - SdStyleSheet( const OUString& rDisplayName, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily, SfxStyleSearchBits nMask ); + SdStyleSheet( const OUString& rDisplayName, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily, + SfxStyleSearchBits nMask, const OUString& rParentStyleSheetName = u""_ustr ); virtual bool SetParent (const OUString& rParentName) override; virtual SfxItemSet& GetItemSet() override; diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc index 3ff7cac89795..e8a6fe8683e1 100644 --- a/sd/inc/strings.hrc +++ b/sd/inc/strings.hrc @@ -469,4 +469,8 @@ #define STR_INSERT_TABLESTYLE NC_("STR_INSERT_TABLESTYLE", "Add a new design") #define STR_REMOVE_TABLESTYLE NC_("STR_REMOVE_TABLESTYLE", "The selected style is in use in this document.\nIf you will delete this style, tables using it will revert to the default style.\nDo you still wish to delete this style?\n") +// To translators: %n is replaced by a large number, 100 at the time of introduction +#define STR_MANY_MASTER_PAGES NC_("STR_MANY_MASTER_PAGES", "%n Master Slides") +#define STR_MANY_MASTER_PAGES_DETAIL NC_("STR_MANY_MASTER_PAGES_DETAIL", "Large amounts of Master Slides degrade loading performance") + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/qa/unit/SVGExportTests.cxx b/sd/qa/unit/SVGExportTests.cxx index bd800a516db9..bcd0b2908f06 100644 --- a/sd/qa/unit/SVGExportTests.cxx +++ b/sd/qa/unit/SVGExportTests.cxx @@ -131,20 +131,20 @@ public: xmlDocUniquePtr svgDoc = parseXml(maTempFile); CPPUNIT_ASSERT(svgDoc); - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2] ), "class", u"Master_Slide"); - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2] ), "class", u"Master_Slide"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects"); // Current Date Field - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[4] ), "class", u"TextShape"); - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[4]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Date"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[4] ), "class", u"TextShape"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[4]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Date"); // Current Time Field - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[5] ), "class", u"TextShape"); - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[5]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Time"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[5] ), "class", u"TextShape"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[5]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText Time"); // Slide Name Field - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape"); - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName"); // Slide Number Field - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape"); - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber"); } void testSVGExportEmbeddedVideo() @@ -280,15 +280,15 @@ public: xmlDocUniquePtr svgDoc = parseXml(maTempFile); CPPUNIT_ASSERT(svgDoc); - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2] ), "class", u"Master_Slide"); - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2] ), "class", u"Master_Slide"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2] ), "class", u"BackgroundObjects"); // Slide Name Field - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape"); - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[6] ), "class", u"TextShape"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[6]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageName"); // Slide Number Field - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape"); - assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[9]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[7] ), "class", u"TextShape"); + assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_DEFS[10]/SVG_G[2]/SVG_G[2]/SVG_G[7]/SVG_G/SVG_TEXT/SVG_TSPAN/SVG_TSPAN/SVG_TSPAN ), "class", u"PlaceholderText PageNumber"); } CPPUNIT_TEST_SUITE(SdSVGFilterTest); diff --git a/sd/source/console/PresenterAccessibility.cxx b/sd/source/console/PresenterAccessibility.cxx index da3af5563fd3..6b100c8d634b 100644 --- a/sd/source/console/PresenterAccessibility.cxx +++ b/sd/source/console/PresenterAccessibility.cxx @@ -715,7 +715,7 @@ void PresenterAccessible::AccessibleObject::SetWindow ( mxContentWindow->removeWindowListener(this); } - mxContentWindow = xContentWindow; + mxContentWindow = std::move(xContentWindow); mxBorderWindow.set(rxBorderWindow, UNO_QUERY); if (mxContentWindow.is()) diff --git a/sd/source/console/PresenterPaneContainer.cxx b/sd/source/console/PresenterPaneContainer.cxx index c844fb010430..ba8f8e53c6ca 100644 --- a/sd/source/console/PresenterPaneContainer.cxx +++ b/sd/source/console/PresenterPaneContainer.cxx @@ -112,7 +112,7 @@ PresenterPaneContainer::SharedPaneDescriptor { Reference xWindow (rxPane->getWindow()); pDescriptor->mxContentWindow = xWindow; - pDescriptor->mxPaneId = xPaneId; + pDescriptor->mxPaneId = std::move(xPaneId); pDescriptor->mxPane = rxPane; pDescriptor->mxPane->SetTitle(pDescriptor->msTitle); diff --git a/sd/source/console/PresenterWindowManager.cxx b/sd/source/console/PresenterWindowManager.cxx index 11457552e728..6b6b07e4ffe0 100644 --- a/sd/source/console/PresenterWindowManager.cxx +++ b/sd/source/console/PresenterWindowManager.cxx @@ -982,7 +982,7 @@ void PresenterWindowManager::ProvideBackgroundBitmap() } else { - mxScaledBackgroundBitmap = xBitmap; + mxScaledBackgroundBitmap = std::move(xBitmap); } } diff --git a/sd/source/core/CustomAnimationCloner.cxx b/sd/source/core/CustomAnimationCloner.cxx index 495c8ce6ee93..8c89a5874f43 100644 --- a/sd/source/core/CustomAnimationCloner.cxx +++ b/sd/source/core/CustomAnimationCloner.cxx @@ -108,7 +108,7 @@ namespace sd Reference< XShape > xTarget( pTarget->getUnoShape(), UNO_QUERY ); if( xSource.is() && xTarget.is() ) { - maShapeMap[xSource] = xTarget; + maShapeMap[xSource] = std::move(xTarget); } } } diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 80082a3a5dfe..4122b08548f9 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -2542,7 +2542,7 @@ void EffectSequenceHelper::createTextGroupParagraphEffects( const CustomAnimatio } ParagraphTarget aTarget; - aTarget.Shape = xTarget; + aTarget.Shape = std::move(xTarget); for( const auto i : aParaList ) { diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index c790ac1130a9..ed91f4034046 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include #include @@ -125,7 +127,7 @@ SdrObject* SdDrawDocument::GetObj(std::u16string_view rObjName) const // Find SdPage by name sal_uInt16 SdDrawDocument::GetPageByName(std::u16string_view rPgName, bool& rbIsMasterPage) const { - SdPage* pPage = nullptr; + const SdPage* pPage = nullptr; sal_uInt16 nPage = 0; const sal_uInt16 nMaxPages = GetPageCount(); sal_uInt16 nPageNum = SDRPAGE_NOTFOUND; @@ -136,8 +138,7 @@ sal_uInt16 SdDrawDocument::GetPageByName(std::u16string_view rPgName, bool& rbIs // ignored) while (nPage < nMaxPages && nPageNum == SDRPAGE_NOTFOUND) { - pPage = const_cast(static_cast( - GetPage(nPage))); + pPage = static_cast(GetPage(nPage)); if (pPage != nullptr && pPage->GetPageKind() != PageKind::Handout @@ -155,8 +156,7 @@ sal_uInt16 SdDrawDocument::GetPageByName(std::u16string_view rPgName, bool& rbIs while (nPage < nMaxMasterPages && nPageNum == SDRPAGE_NOTFOUND) { - pPage = const_cast(static_cast( - GetMasterPage(nPage))); + pPage = static_cast(GetMasterPage(nPage)); if (pPage && pPage->GetName() == rPgName) { @@ -173,14 +173,14 @@ sal_uInt16 SdDrawDocument::GetPageByName(std::u16string_view rPgName, bool& rbIs bool SdDrawDocument::IsPageNameUnique( std::u16string_view rPgName ) const { sal_uInt16 nCount = 0; - SdPage* pPage = nullptr; + const SdPage* pPage = nullptr; // Search all regular pages and all notes pages (handout pages are ignored) sal_uInt16 nPage = 0; sal_uInt16 nMaxPages = GetPageCount(); while (nPage < nMaxPages) { - pPage = const_cast(static_cast(GetPage(nPage))); + pPage = static_cast(GetPage(nPage)); if (pPage && pPage->GetName() == rPgName && pPage->GetPageKind() != PageKind::Handout) nCount++; @@ -193,7 +193,7 @@ bool SdDrawDocument::IsPageNameUnique( std::u16string_view rPgName ) const nMaxPages = GetMasterPageCount(); while (nPage < nMaxPages) { - pPage = const_cast(static_cast(GetMasterPage(nPage))); + pPage = static_cast(GetMasterPage(nPage)); if (pPage && pPage->GetName() == rPgName) nCount++; @@ -262,29 +262,83 @@ void SdDrawDocument::UpdatePageObjectsInNotes(sal_uInt16 nStartPos) } } +namespace +{ +class SvxFieldItemUpdater_BaseProperties final : public editeng::SvxFieldItemUpdater +{ + sdr::properties::BaseProperties& mrProps; + +public: + SvxFieldItemUpdater_BaseProperties(sdr::properties::BaseProperties& rProps) + : mrProps(rProps) {} + + virtual void SetItem(const SvxFieldItem& rNew) override + { + mrProps.SetObjectItem(rNew); + } +}; +} + +static void UpdatePageRelativeURLs(SdrObject& rObj, const std::function& rItemCallback) +{ + if (SdrObjList* pChildrenObjs = rObj.getChildrenOfSdrObject()) + { + for (const rtl::Reference& pSubObj : *pChildrenObjs) + UpdatePageRelativeURLs(*pSubObj, rItemCallback); + } + + // cannot call GetObjectItemSet on a group + if (rObj.GetObjIdentifier() != SdrObjKind::Group) + { + sdr::properties::BaseProperties& rProps = rObj.GetProperties(); + const SfxItemSet& rSet = rProps.GetObjectItemSet(); + if (const SvxFieldItem* pFieldItem = rSet.GetItemIfSet(EE_FEATURE_FIELD)) + { + SvxFieldItemUpdater_BaseProperties aItemUpdater(rProps); + rItemCallback(*pFieldItem, aItemUpdater); + } + } + + SdrTextObj* pTxtObj = DynCastSdrTextObj(&rObj); + if (!pTxtObj) + return; + OutlinerParaObject* pOutlinerParagraphObject = pTxtObj->GetOutlinerParaObject(); + if (!pOutlinerParagraphObject) + return; + EditTextObject& aEdit = const_cast(pOutlinerParagraphObject->GetTextObject()); + if (!aEdit.IsFieldObject()) + return; + const SvxFieldItem* pFieldItem = aEdit.GetField(); + if (!pFieldItem) + return; + aEdit.GetFieldUpdater().UpdatePageRelativeURLs(rItemCallback); +}; + +void SdDrawDocument::UpdatePageRelativeURLsImpl(const std::function& rItemCallback) +{ + for (sal_uInt16 nPage = 0, nPageCount = GetPageCount(); nPage < nPageCount; ++nPage) + { + SdrPage* pPage = GetPage(nPage); + for(size_t nObj = 0, nObjCount = pPage->GetObjCount(); nObj < nObjCount; ++nObj) + ::UpdatePageRelativeURLs(*pPage->GetObj(nObj), rItemCallback); + } +} + void SdDrawDocument::UpdatePageRelativeURLs(std::u16string_view aOldName, std::u16string_view aNewName) { if (aNewName.empty()) return; - SfxItemPool& rPool(GetPool()); - - rPool.iterateItemSurrogates(EE_FEATURE_FIELD, [&](SfxItemPool::SurrogateData& rData) + const OUString sNotes(SdResId(STR_NOTES)); + auto aItemCallback = [&sNotes, &aOldName, &aNewName](const SvxFieldItem & rFieldItem, editeng::SvxFieldItemUpdater& rFieldItemUpdater) -> void { - const SvxFieldItem* pFieldItem(dynamic_cast(&rData.getItem())); - - if (nullptr == pFieldItem) - return true; // continue callbacks - - const SvxURLField* pURLField(dynamic_cast(pFieldItem->GetField())); - - if (nullptr == pURLField) - return true; // continue callbacks - + const SvxFieldData* pFieldData = rFieldItem.GetField(); + if (pFieldData->GetClassId() != SvxURLField::CLASS_ID) + return; + const SvxURLField* pURLField(static_cast(pFieldData)); OUString aURL(pURLField->GetURL()); - if (aURL.isEmpty() || (aURL[0] != 35) || (aURL.indexOf(aOldName, 1) != 1)) - return true; // continue callbacks + return; bool bURLChange(false); @@ -296,7 +350,6 @@ void SdDrawDocument::UpdatePageRelativeURLs(std::u16string_view aOldName, std::u } else { - const OUString sNotes(SdResId(STR_NOTES)); if (aURL.getLength() == sal_Int32(aOldName.size()) + 2 + sNotes.getLength() && aURL.indexOf(sNotes, aOldName.size() + 2) == sal_Int32(aOldName.size() + 2)) { @@ -308,36 +361,30 @@ void SdDrawDocument::UpdatePageRelativeURLs(std::u16string_view aOldName, std::u if(bURLChange) { - SvxFieldItem* pNewFieldItem(pFieldItem->Clone(&rPool)); - const_cast(static_cast(pNewFieldItem->GetField()))->SetURL(aURL); - rData.setItem(std::unique_ptr(pNewFieldItem)); + SvxFieldItem aNewFieldItem(rFieldItem); + const_cast(static_cast(aNewFieldItem.GetField()))->SetURL(aURL); + rFieldItemUpdater.SetItem(aNewFieldItem); } + }; - return true; // continue callbacks - }); + UpdatePageRelativeURLsImpl(aItemCallback); } void SdDrawDocument::UpdatePageRelativeURLs(SdPage const * pPage, sal_uInt16 nPos, sal_Int32 nIncrement) { bool bNotes = (pPage->GetPageKind() == PageKind::Notes); - SfxItemPool& rPool(GetPool()); - rPool.iterateItemSurrogates(EE_FEATURE_FIELD, [&](SfxItemPool::SurrogateData& rData) + auto aItemCallback = [this, nPos, bNotes, nIncrement](const SvxFieldItem & rFieldItem, editeng::SvxFieldItemUpdater& rFieldItemUpdater) -> void { - const SvxFieldItem* pFieldItem(static_cast(&rData.getItem())); - - if (nullptr == pFieldItem) - return true; // continue callbacks - - const SvxURLField* pURLField(dynamic_cast(pFieldItem->GetField())); + const SvxURLField* pURLField(dynamic_cast(rFieldItem.GetField())); if (nullptr == pURLField) - return true; // continue callbacks + return; OUString aURL(pURLField->GetURL()); if (aURL.isEmpty() || (aURL[0] != 35)) - return true; // continue callbacks + return; OUString aHashSlide; if (meDocType == DocumentType::Draw) @@ -346,7 +393,7 @@ void SdDrawDocument::UpdatePageRelativeURLs(SdPage const * pPage, sal_uInt16 nPo aHashSlide = "#" + SdResId(STR_PAGE); if (!aURL.startsWith(aHashSlide)) - return true; // continue callbacks + return; OUString aURLCopy = aURL; const OUString sNotes(SdResId(STR_NOTES)); @@ -357,7 +404,7 @@ void SdDrawDocument::UpdatePageRelativeURLs(SdPage const * pPage, sal_uInt16 nPo && aURLCopy.endsWith(sNotes) ); if (bNotesLink != bNotes) - return true; // no compatible link and page, continue callbacks + return; // no compatible link and page if (bNotes) aURLCopy = aURLCopy.replaceAt(aURLCopy.getLength() - sNotes.getLength(), sNotes.getLength(), u""); @@ -366,7 +413,7 @@ void SdDrawDocument::UpdatePageRelativeURLs(SdPage const * pPage, sal_uInt16 nPo sal_uInt16 realPageNumber = (nPos + 1)/ 2; if ( number < realPageNumber ) - return true; // continue callbacks + return; // update link page number number += nIncrement; @@ -377,12 +424,12 @@ void SdDrawDocument::UpdatePageRelativeURLs(SdPage const * pPage, sal_uInt16 nPo aURL += " " + sNotes; } - SvxFieldItem* pNewFieldItem(pFieldItem->Clone(&rPool)); - const_cast(static_cast(pNewFieldItem->GetField()))->SetURL(aURL); - rData.setItem(std::unique_ptr(pNewFieldItem)); + SvxFieldItem aNewFieldItem(rFieldItem); + const_cast(static_cast(aNewFieldItem.GetField()))->SetURL(aURL); + rFieldItemUpdater.SetItem(aNewFieldItem); + }; - return true; // continue callbacks - }); + UpdatePageRelativeURLsImpl(aItemCallback); } // Move page diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 3b2c64f10888..77975328daed 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -1386,7 +1386,7 @@ static bool isMasterPageLayoutNameUnique(const SdDrawDocument& rDoc, std::u16str for(sal_uInt16 a(0); a < nPageCount; a++) { - const SdrPage* pCandidate = rDoc.GetMasterPage(a); + const SdPage* pCandidate = static_cast(rDoc.GetMasterPage(a)); OUString aPageLayoutName(pCandidate->GetLayoutName()); sal_Int32 nIndex = aPageLayoutName.indexOf(SD_LT_SEPARATOR); if( nIndex != -1 ) diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx index 9696668dc326..2262ef1203d2 100644 --- a/sd/source/core/stlfamily.cxx +++ b/sd/source/core/stlfamily.cxx @@ -192,12 +192,11 @@ OUString SAL_CALL SdStyleFamily::getName() if( pPage == nullptr ) throw DisposedException(); - OUString aLayoutName( pPage->GetLayoutName() ); - sal_Int32 nIndex = aLayoutName.indexOf(SD_LT_SEPARATOR); - if( nIndex != -1 ) - aLayoutName = aLayoutName.copy(0, nIndex); - - return aLayoutName; + const OUString& rLayoutName = pPage->GetLayoutName(); + sal_Int32 nIndex = rLayoutName.indexOf(SD_LT_SEPARATOR); + if (nIndex != -1) + return rLayoutName.copy(0, nIndex); + return rLayoutName; } else { diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index 2cfd2544fe00..9823c031c251 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -130,9 +130,10 @@ SdStyleSheetPool::~SdStyleSheetPool() DBG_ASSERT( mpDoc == nullptr, "sd::SdStyleSheetPool::~SdStyleSheetPool(), dispose me first!" ); } -rtl::Reference SdStyleSheetPool::Create(const OUString& rName, SfxStyleFamily eFamily, SfxStyleSearchBits _nMask ) +rtl::Reference SdStyleSheetPool::Create(const OUString& rName, SfxStyleFamily eFamily, + SfxStyleSearchBits _nMask, const OUString& rParentStyleSheetName ) { - return new SdStyleSheet(rName, *this, eFamily, _nMask); + return new SdStyleSheet(rName, *this, eFamily, _nMask, rParentStyleSheetName); } SfxStyleSheetBase* SdStyleSheetPool::GetTitleSheet(std::u16string_view rLayoutName) @@ -211,10 +212,19 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(std::u16string_view rLayoutName, if (!Find(aLevelName, SfxStyleFamily::Page)) { bCreated = true; - pSheet = &Make(aLevelName, SfxStyleFamily::Page,nUsedMask); - pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel ); - pSheet->SetParent( OUString() ); + OUString sParentStyleSheetName; + // if we created outline styles, we need to chain them + if (nLevel > 1) + { + OUString aPreviousLevelName( aPrefix + aName + " " + OUString::number( nLevel-1 ) ); + SfxStyleSheetBase* pParent = Find(aPreviousLevelName, SfxStyleFamily::Page); + if (pParent) + sParentStyleSheetName = pParent->GetName(); + } + + pSheet = &Make(aLevelName, SfxStyleFamily::Page, nUsedMask, sParentStyleSheetName); + pSheet->SetHelpId( aHelpFile, HID_PSEUDOSHEET_OUTLINE + nLevel ); // attributing for level 1, the others levels inherit if (nLevel == 1) @@ -297,27 +307,6 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(std::u16string_view rLayoutName, } } - // if we created outline styles, we need to chain them - if( bCreated ) - { - SfxStyleSheetBase* pParent = nullptr; - for (sal_Int32 nLevel = 1; nLevel < 10; nLevel++) - { - OUString aLevelName( aPrefix + aName + " " + OUString::number( nLevel ) ); - - pSheet = Find(aLevelName, SfxStyleFamily::Page); - - DBG_ASSERT( pSheet, "missing layout style!"); - - if( pSheet ) - { - if (pParent) - pSheet->SetParent(pParent->GetName()); - pParent = pSheet; - } - } - } - /************************************************************************** * Title **************************************************************************/ diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 60ae6f2588b7..0389adbb145f 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -140,8 +140,11 @@ void ModifyListenerForwarder::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*r mpStyleSheet->notifyModifyListener(); } -SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool& _rPool, SfxStyleFamily eFamily, SfxStyleSearchBits _nMask) -: SdStyleSheetBase( rDisplayName, _rPool, eFamily, _nMask) +SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool& _rPool, + SfxStyleFamily eFamily, + SfxStyleSearchBits _nMask, + const OUString& rParentStyleSheetName) +: SdStyleSheetBase( rDisplayName, _rPool, eFamily, _nMask, rParentStyleSheetName) , msApiName( rDisplayName ) , mxPool( &_rPool ) { diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx index b40137bb9cdc..7f1e2be5133b 100644 --- a/sd/source/filter/eppt/pptexanimations.cxx +++ b/sd/source/filter/eppt/pptexanimations.cxx @@ -706,7 +706,7 @@ void AnimationExporter::exportNode( SvStream& rStrm, Reference< XAnimationNode > { if ( xChildNode->getType() == AnimationNodeType::AUDIO ) { - xAudioNode = xChildNode; + xAudioNode = std::move(xChildNode); nAudioGroup = mnCurrentGroup; } else diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 3d7b2faba601..91737b1727ff 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -306,7 +306,7 @@ bool SdGRFFilter::Export() uno::Any aSelection( pDrawController->getSelection() ); uno::Reference< lang::XComponent > xSelection; if ( aSelection >>= xSelection ) - xSource = xSelection; + xSource = std::move(xSelection); } } xExporter->setSourceDocument( xSource ); diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx index ee332d9c252b..3fba334ce872 100644 --- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx +++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx @@ -280,7 +280,7 @@ uno::Reference SAL_CALL && (aPoint.X < aBBox.X+aBBox.Width) && (aPoint.Y < aBBox.Y+aBBox.Height) ) { - xChildAtPosition = xChild; + xChildAtPosition = std::move(xChild); break; } } diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index 3d233e39322d..99ce44b5cf50 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -928,7 +928,7 @@ void CustomAnimationList::append( CustomAnimationEffectPtr pEffect ) mxTreeView->insert(nullptr, -1, &aDescription, &sId, nullptr, nullptr, false, xEntry.get()); // and the new root entry becomes the possible next group header - mxLastTargetShape = xTargetShape; + mxLastTargetShape = std::move(xTargetShape); mnLastGroupId = nGroupId; mxLastParentEntry = std::move(xEntry); } diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 1925e4fdf8e9..b0075ad75a71 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -1631,7 +1631,7 @@ void CustomAnimationPane::onChangeCurrentPage() Reference< XDrawPage > xNewPage( mxView->getCurrentPage() ); if( xNewPage != mxCurrentPage ) { - mxCurrentPage = xNewPage; + mxCurrentPage = std::move(xNewPage); SdPage* pPage = SdPage::getImplementation( mxCurrentPage ); if( pPage ) { @@ -1774,7 +1774,7 @@ void CustomAnimationPane::onAdd() if( getTextSelection( maViewSelection, xShape, aParaList ) ) { ParagraphTarget aParaTarget; - aParaTarget.Shape = xShape; + aParaTarget.Shape = std::move(xShape); for( const auto& rPara : aParaList ) { diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index 0ae1a5dd7d7a..69a22927cb49 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -619,7 +619,7 @@ void SlideTransitionPane::updateControls() { mxRB_REPEAT_DISABLED->set_active( false ); mxRB_REPEAT_AUTO->set_active( true ); - mxMF_REPEAT_AUTO_AFTER->set_value(rSettings.mnPauseTimeout, FieldUnit::SECOND); + mxMF_REPEAT_AUTO_AFTER->set_value(rSettings.mnPauseTimeout * 100.0, FieldUnit::SECOND); } if (comphelper::LibreOfficeKit::isActive()) @@ -842,7 +842,7 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co if ( mxMF_REPEAT_AUTO_AFTER->get_sensitive() ) { rSettings.mbEndless = true; - rSettings.mnPauseTimeout = static_cast(mxMF_REPEAT_AUTO_AFTER->get_value(FieldUnit::SECOND)); + rSettings.mnPauseTimeout = static_cast(mxMF_REPEAT_AUTO_AFTER->get_value(FieldUnit::SECOND) / 100.0) ; } } } diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index ad88bff0ca6e..e2e5977a7e1e 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -1011,7 +1011,10 @@ void AnnotationManagerImpl::SyncAnnotationObjects() SdrObject* pObject = xAnnotation->findAnnotationObject(); if (pObject) + { + nIndex++; continue; + } if (!bAnnotatonInserted && mpDoc->IsUndoEnabled()) mpDoc->BegUndo(SdResId(STR_ANNOTATION_UNDO_INSERT)); diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index fd58db937d89..3970d95f62bf 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -280,55 +280,60 @@ IMPL_LINK( AnimationWindow, ClickPlayHdl, weld::Button&, rButton, void ) sal_uLong nTmpTime = 0; size_t i = 0; bool bCount = i < nCount; - if( bReverse ) + if (bCount) { - i = nCount - 1; - } - while( bCount && bMovie ) - { - // make list and view consistent - assert(i < m_FrameList.size()); - m_nCurrentFrame = i; - - UpdateControl(bDisableCtrls); - - if( m_xRbtBitmap->get_active() ) - { - ::tools::Time const & rTime = m_FrameList[i].second; - - m_xFormatter->SetTime( rTime ); - sal_uLong nTime = rTime.GetMSFromTime(); - - WaitInEffect( nTime, nTmpTime, pProgress.get() ); - nTmpTime += nTime; - } - else - { - WaitInEffect( 100, nTmpTime, pProgress.get() ); - nTmpTime += 100; - } if( bReverse ) + i = nCount - 1; + + while (bMovie) { - if (i == 0) + // make list and view consistent + assert(i < m_FrameList.size()); + m_nCurrentFrame = i; + + UpdateControl(bDisableCtrls); + + if( m_xRbtBitmap->get_active() ) { - // Terminate loop. - bCount = false; + ::tools::Time const & rTime = m_FrameList[i].second; + + m_xFormatter->SetTime( rTime ); + sal_uLong nTime = rTime.GetMSFromTime(); + + WaitInEffect( nTime, nTmpTime, pProgress.get() ); + nTmpTime += nTime; } else { - --i; + WaitInEffect( 100, nTmpTime, pProgress.get() ); + nTmpTime += 100; } - } - else - { - i++; - if (i >= nCount) + if( bReverse ) { - // Terminate loop. - bCount = false; - // Move i back into valid range. - i = nCount - 1; + if (i == 0) + { + // Terminate loop. + bCount = false; + } + else + { + --i; + } } + else + { + i++; + if (i >= nCount) + { + // Terminate loop. + bCount = false; + // Move i back into valid range. + i = nCount - 1; + } + } + + if (!bCount) + break; } } @@ -543,6 +548,8 @@ void AnimationWindow::UpdateControl(bool const bDisableCtrls) if (!m_FrameList.empty() && !bMovie) { + assert(m_nCurrentFrame != EMPTY_FRAMELIST && "only arises when m_FrameList.empty()"); + size_t nIndex = m_nCurrentFrame + 1; m_xNumFldBitmap->set_value(nIndex); diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index 4b1e790428f8..234c63578667 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -230,6 +230,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) } break; + case SID_VERSION: case SID_CLOSEDOC: { ExecuteSlot(rReq, SfxObjectShell::GetStaticInterface()); @@ -244,12 +245,6 @@ void DrawDocShell::Execute( SfxRequest& rReq ) } break; - case SID_VERSION: - { - ExecuteSlot( rReq, SfxObjectShell::GetStaticInterface() ); - } - break; - case SID_HANGUL_HANJA_CONVERSION: { if( mpViewShell ) diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 8980bc2a0148..c71706e3caab 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -296,8 +297,10 @@ bool DrawDocShell::Load( SfxMedium& rMedium ) if( bRet ) { + SdDrawDocument* pDoc = GetDoc(); + // for legacy markup in OOoXML filter, convert the animations now - EffectMigration::DocumentLoaded(*GetDoc()); + EffectMigration::DocumentLoaded(*pDoc); UpdateTablePointers(); // If we're an embedded OLE object, use tight bounds @@ -317,6 +320,15 @@ bool DrawDocShell::Load( SfxMedium& rMedium ) const INetURLObject aUrl; SfxObjectShell::SetAutoLoad( aUrl, 0, false ); + + const sal_uInt16 nMasterPages = pDoc->GetMasterSdPageCount(PageKind::Standard); + if (nMasterPages > 100) + { + const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetLocaleDataWrapper(); + OUString sMasterPages = rLocaleData.getNum(nMasterPages, 0, true, false); + AppendInfoBarWhenReady(u"toomanymasterpages"_ustr, SdResId(STR_MANY_MASTER_PAGES).replaceFirst("%n", sMasterPages), + SdResId(STR_MANY_MASTER_PAGES_DETAIL), InfobarType::INFO); + } } else { diff --git a/sd/source/ui/func/fucon3d.cxx b/sd/source/ui/func/fucon3d.cxx index b26d634898b5..f770fe0c4d08 100644 --- a/sd/source/ui/func/fucon3d.cxx +++ b/sd/source/ui/func/fucon3d.cxx @@ -278,11 +278,6 @@ void FuConstruct3dObject::ImpPrepareBasic3DShape(E3dCompoundObject const * p3DOb } break; - case SID_3D_SPHERE: - { - } - break; - case SID_3D_SHELL: case SID_3D_HALF_SPHERE: { @@ -290,6 +285,7 @@ void FuConstruct3dObject::ImpPrepareBasic3DShape(E3dCompoundObject const * p3DOb } break; + case SID_3D_SPHERE: case SID_3D_CYLINDER: case SID_3D_CONE: case SID_3D_PYRAMID: diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index 446c58381811..24f8ad1e3046 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -716,18 +716,21 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt) ForcePointer(&rMEvt); mpWindow->ReleaseMouse(); - const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); - if ( mpView && rMarkList.GetMarkCount() == 0 ) + if (mpView) { - sal_uInt16 nDrgLog1 = sal_uInt16 ( mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() ); - if ( std::abs(aMDPos.X() - aPnt.X()) < nDrgLog1 && - std::abs(aMDPos.Y() - aPnt.Y()) < nDrgLog1 && - !rMEvt.IsShift() && !rMEvt.IsMod2() ) + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + if ( rMarkList.GetMarkCount() == 0 ) { - SdrPageView* pPV2 = mpView->GetSdrPageView(); - SdrViewEvent aVEvt; - mpView->PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt); - mpView->MarkObj(aVEvt.mpRootObj, pPV2); + sal_uInt16 nDrgLog1 = sal_uInt16 ( mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() ); + if ( std::abs(aMDPos.X() - aPnt.X()) < nDrgLog1 && + std::abs(aMDPos.Y() - aPnt.Y()) < nDrgLog1 && + !rMEvt.IsShift() && !rMEvt.IsMod2() ) + { + SdrPageView* pPV2 = mpView->GetSdrPageView(); + SdrViewEvent aVEvt; + mpView->PickAnything(rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt); + mpView->MarkObj(aVEvt.mpRootObj, pPV2); + } } } diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index c0a3447a47e7..83e73e2ea4e8 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -678,9 +678,6 @@ IMPL_LINK(LayoutMenu, EventMultiplexerListener, ::sd::tools::EventMultiplexerEve case EventMultiplexerEventId::ShapeChanged: case EventMultiplexerEventId::ShapeInserted: case EventMultiplexerEventId::ShapeRemoved: - UpdateSelection(); - break; - case EventMultiplexerEventId::CurrentPageChanged: case EventMultiplexerEventId::SlideSortedSelection: UpdateSelection(); diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 214bdeb1410e..3ed644ce75f3 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -579,7 +579,7 @@ void TableDesignWidget::onSelectionChanged() if( mxSelectedTable != xNewSelection ) { - mxSelectedTable = xNewSelection; + mxSelectedTable = std::move(xNewSelection); updateControls(); } } diff --git a/sd/source/ui/unoidl/randomnode.cxx b/sd/source/ui/unoidl/randomnode.cxx index d8f0fda1d80a..98ff26f2b95f 100644 --- a/sd/source/ui/unoidl/randomnode.cxx +++ b/sd/source/ui/unoidl/randomnode.cxx @@ -527,7 +527,7 @@ Reference< XAnimationNode > SAL_CALL RandomAnimationNode::appendChild( const Ref } if( !maTarget.hasValue() && !mxFirstNode.is() ) - mxFirstNode = xAnimate; + mxFirstNode = std::move(xAnimate); return newChild; } diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 3abf1be3b0ad..0186b53f1b61 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -329,7 +329,7 @@ bool SlideBackgroundInfo::getFillStyleImpl(const uno::Reference SAL_CALL SdUnoSearchReplaceShape::findNex // get next shape on our page uno::Reference< drawing::XShape > xFound2( GetNextShape( mpPage, xCurrentShape ) ); if( xFound2.is() && (xFound2.get() != xCurrentShape.get()) ) - xCurrentShape = xFound2; + xCurrentShape = std::move(xFound2); else xCurrentShape = nullptr; @@ -621,7 +621,7 @@ uno::Reference< drawing::XShape > SdUnoSearchReplaceShape::GetShape( const uno: if(!xParent.is() || xText.get() == xParent.get()) return xShape; - xText = xParent; + xText = std::move(xParent); } } while( !xShape.is() ); } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index aafee36fa8b4..16d765e1bd3f 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1338,34 +1338,34 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { if( rMarkList.GetMarkCount() == 1 ) { - const SdrGrafObj* pObj = dynamic_cast(rMarkList.GetMark(0)->GetMarkedSdrObj()); - if (pObj && pObj->GetGraphicType() == GraphicType::Bitmap) - { - weld::Window* pFrame = GetFrameWeld(); - GraphicAttr aGraphicAttr = pObj->GetGraphicAttr(); - short nState = RET_CANCEL; - if (aGraphicAttr != GraphicAttr()) // the image has been modified + if (const SdrGrafObj* pObj = dynamic_cast(rMarkList.GetMark(0)->GetMarkedSdrObj())) + if (pObj->GetGraphicType() == GraphicType::Bitmap || pObj->GetGraphicType() == GraphicType::GdiMetafile) { - if (pFrame) + weld::Window* pFrame = GetFrameWeld(); + GraphicAttr aGraphicAttr = pObj->GetGraphicAttr(); + short nState = RET_CANCEL; + if (aGraphicAttr != GraphicAttr()) // the image has been modified { - nState = GraphicHelper::HasToSaveTransformedImage(pFrame); + if (pFrame) + { + nState = GraphicHelper::HasToSaveTransformedImage(pFrame); + } + } + else + { + nState = RET_NO; + } + + if (nState == RET_YES) + { + GraphicHelper::ExportGraphic(pFrame, pObj->GetTransformedGraphic(), u""_ustr); + } + else if (nState == RET_NO) + { + const GraphicObject& aGraphicObject(pObj->GetGraphicObject()); + GraphicHelper::ExportGraphic(pFrame, aGraphicObject.GetGraphic(), u""_ustr); } } - else - { - nState = RET_NO; - } - - if (nState == RET_YES) - { - GraphicHelper::ExportGraphic(pFrame, pObj->GetTransformedGraphic(), u""_ustr); - } - else if (nState == RET_NO) - { - const GraphicObject& aGraphicObject(pObj->GetGraphicObject()); - GraphicHelper::ExportGraphic(pFrame, aGraphicObject.GetGraphic(), u""_ustr); - } - } } Cancel(); rReq.Ignore(); diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 8fcd132ff3de..90fa7e8cafdb 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -1318,7 +1318,7 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet) if( nPos >= GetDoc()->GetSdPageCount( PageKind::Standard ) ) nPos = 0; - SdrPage* pPage = GetDoc()->GetSdPage( static_cast(nPos), PageKind::Standard ); + SdPage* pPage = GetDoc()->GetSdPage( static_cast(nPos), PageKind::Standard ); if (GetDoc()->GetDocumentType() == DocumentType::Draw) aPageStr = SdResId(STR_SD_PAGE_COUNT_DRAW); diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx index 21b3bd1aed43..68baa2b8067d 100644 --- a/sd/source/ui/view/tabcontr.cxx +++ b/sd/source/ui/view/tabcontr.cxx @@ -203,7 +203,9 @@ sal_Int8 TabControl::ExecuteDrop( const ExecuteDropEvent& rEvt ) if( bInternalMove ) { - sal_uInt16 nPageId = ShowDropPos( aPos ) - 1; + sal_uInt16 nDropPos = ShowDropPos( aPos ); + assert(nDropPos > 0); + sal_uInt16 nPageId = nDropPos - 1; switch (rEvt.mnAction) { diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index c786a70bd5e0..81fc252c7a6b 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -88,8 +88,16 @@ constexpr OUString aBigPlaceHolders[] = static BitmapEx& getButtonImage( int index, bool large ) { - static vcl::DeleteOnDeinit< BitmapEx > gSmallButtonImages[SAL_N_ELEMENTS(aSmallPlaceHolders)] = { vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty }; - static vcl::DeleteOnDeinit< BitmapEx > gLargeButtonImages[SAL_N_ELEMENTS(aBigPlaceHolders)] = { vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty }; + static ::tools::DeleteOnDeinit< BitmapEx > gSmallButtonImages[SAL_N_ELEMENTS(aSmallPlaceHolders)] = { + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty, + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty, + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty, + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty }; + static ::tools::DeleteOnDeinit< BitmapEx > gLargeButtonImages[SAL_N_ELEMENTS(aBigPlaceHolders)] = { + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty, + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty, + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty, + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty }; assert(SAL_N_ELEMENTS(aSmallPlaceHolders) == SAL_N_ELEMENTS(aBigPlaceHolders)); diff --git a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui index c8680a4f8f80..f6e18798f702 100644 --- a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui +++ b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui @@ -370,7 +370,7 @@ - After Slideshow: + After : True True False @@ -419,7 +419,7 @@ True False - Repeat After + Repeat Slideshow diff --git a/sdext/source/minimizer/graphiccollector.cxx b/sdext/source/minimizer/graphiccollector.cxx index ec7171a89ecf..61cf80142824 100644 --- a/sdext/source/minimizer/graphiccollector.cxx +++ b/sdext/source/minimizer/graphiccollector.cxx @@ -171,7 +171,7 @@ static void ImpAddFillBitmapEntity( const Reference< XComponentContext >& rxMSF, } GraphicCollector::GraphicUser aUser; aUser.mxPropertySet = rxPropertySet; - aUser.mxGraphic = xGraphic; + aUser.mxGraphic = std::move(xGraphic); aUser.mbFillBitmap = true; aUser.maLogicalSize = aLogicalSize; aUser.mxPagePropertySet = rxPagePropertySet; diff --git a/sdext/source/minimizer/pagecollector.cxx b/sdext/source/minimizer/pagecollector.cxx index f86444abbfae..265922803e7c 100644 --- a/sdext/source/minimizer/pagecollector.cxx +++ b/sdext/source/minimizer/pagecollector.cxx @@ -106,7 +106,7 @@ void PageCollector::CollectMasterPages( const Reference< XModel >& rxModel, std: if ( aIter == rMasterPageList.end() ) { MasterPageEntity aMasterPageEntity; - aMasterPageEntity.xMasterPage = xMasterPage; + aMasterPageEntity.xMasterPage = std::move(xMasterPage); aMasterPageEntity.bUsed = false; rMasterPageList.push_back( aMasterPageEntity ); } diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx index 16142cd532c9..d99d32bbfa50 100644 --- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx +++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx @@ -194,14 +194,14 @@ void DrawXmlEmitter::fillFrameProps( DrawElement& rElem, bool bWasTransformed ) { - static constexpr OUStringLiteral sDrawZIndex = u"draw:z-index"; - static constexpr OUStringLiteral sDrawStyleName = u"draw:style-name"; - static constexpr OUStringLiteral sDrawTextStyleName = u"draw:text-style-name"; - static constexpr OUStringLiteral sSvgX = u"svg:x"; - static constexpr OUStringLiteral sSvgY = u"svg:y"; - static constexpr OUStringLiteral sSvgWidth = u"svg:width"; - static constexpr OUStringLiteral sSvgHeight = u"svg:height"; - static constexpr OUStringLiteral sDrawTransform = u"draw:transform"; + static constexpr OUString sDrawZIndex = u"draw:z-index"_ustr; + static constexpr OUString sDrawStyleName = u"draw:style-name"_ustr; + static constexpr OUString sDrawTextStyleName = u"draw:text-style-name"_ustr; + static constexpr OUString sSvgX = u"svg:x"_ustr; + static constexpr OUString sSvgY = u"svg:y"_ustr; + static constexpr OUString sSvgWidth = u"svg:width"_ustr; + static constexpr OUString sSvgHeight = u"svg:height"_ustr; + static constexpr OUString sDrawTransform = u"draw:transform"_ustr; rProps[ sDrawZIndex ] = OUString::number( rElem.ZOrder ); rProps[ sDrawStyleName ] = rEmitContext.rStyles.getStyleName( rElem.StyleId ); diff --git a/sfx2/qa/cppunit/doc.cxx b/sfx2/qa/cppunit/doc.cxx index 555c5f5aea78..92bfadd363e9 100644 --- a/sfx2/qa/cppunit/doc.cxx +++ b/sfx2/qa/cppunit/doc.cxx @@ -126,7 +126,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSetDocumentPropertiesUpdate) } } } -)json"_ostr); +)json"); uno::Sequence aArgs = comphelper::containerToSequence(aArgsVec); dispatchCommand(mxComponent, u".uno:SetDocumentProperties"_ustr, aArgs); diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index eb70d5fe7c38..47780c70d666 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -4771,6 +4771,7 @@ SfxVoidItem VersionDialog SID_VERSION ] SfxUInt16Item Signature SID_SIGNATURE +(SfxStringItem SignatureCert FN_PARAM_1, SfxStringItem SignatureKey FN_PARAM_2) [ AutoUpdate = FALSE, FastCall = FALSE, diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 851d3b9f5307..de9c54d90e5b 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -575,8 +575,8 @@ static SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask , xHelpContent->setName(u"OFFICE_HELP"_ustr); - rHelpTask = xHelpTask; - rHelpContent = xHelpContent; + rHelpTask = std::move(xHelpTask); + rHelpContent = std::move(xHelpContent); return pHelpWindow; } @@ -1101,13 +1101,12 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow) xChanges->commit(); aBusy.decBusy(); } - // Checks whether the user clicked "Read Help Online" (RET_OK) or "Information on downloading offline help" (RET_YES) - if(retOnlineHelpBox == RET_OK || retOnlineHelpBox == RET_YES) + if(!bShowOfflineHelpPopUp || retOnlineHelpBox == RET_OK || retOnlineHelpBox == RET_YES) { bool bTopicExists; - if (retOnlineHelpBox == RET_OK) + if (!bShowOfflineHelpPopUp || retOnlineHelpBox == RET_OK) { bTopicExists = impl_showOnlineHelp(aHelpURL, pWeldWindow); } @@ -1288,13 +1287,12 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt xChanges->commit(); aBusy.decBusy(); } - // Checks whether the user clicked "Read Help Online" (RET_OK) or "Information on downloading offline help" (RET_YES) - if(retOnlineHelpBox == RET_OK || retOnlineHelpBox == RET_YES) + if(!bShowOfflineHelpPopUp || retOnlineHelpBox == RET_OK || retOnlineHelpBox == RET_YES) { bool bTopicExists; - if (retOnlineHelpBox == RET_OK) + if (!bShowOfflineHelpPopUp || retOnlineHelpBox == RET_OK) { bTopicExists = impl_showOnlineHelp(aHelpURL, pWidget); } diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx index f0dacde85834..4f5ef41b3874 100644 --- a/sfx2/source/bastyp/progress.cxx +++ b/sfx2/source/bastyp/progress.cxx @@ -214,7 +214,7 @@ void SfxProgress::SetState const SfxUnoAnyItem* pIndicatorItem = pMedium->GetItemSet().GetItem(SID_PROGRESS_STATUSBAR_CONTROL, false); Reference< XStatusIndicator > xInd; if ( pIndicatorItem && (pIndicatorItem->GetValue()>>=xInd) ) - pImpl->xStatusInd = xInd; + pImpl->xStatusInd = std::move(xInd); } } } diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx index e557c66fdb77..0bd2cf0cebc2 100644 --- a/sfx2/source/control/recentdocsviewitem.cxx +++ b/sfx2/source/control/recentdocsviewitem.cxx @@ -385,7 +385,7 @@ void RecentDocsViewItem::OpenDocument() // executed. VCL is not able to survive this as it wants to call listeners // after select!!! sfx2::LoadRecentFile *const pLoadRecentFile = new sfx2::LoadRecentFile; - pLoadRecentFile->xDispatch = xDispatch; + pLoadRecentFile->xDispatch = std::move(xDispatch); pLoadRecentFile->aTargetURL = std::move(aTargetURL); pLoadRecentFile->aArgSeq = aArgsList; pLoadRecentFile->pView = &mrParentView; diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index a54fb990e91a..8156d841d10f 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -371,9 +371,28 @@ void ThumbnailView::CalculateItemPositions(bool bScrollBarUsed) if (nVItemSpace == -1) // auto, split up extra space to use as vertical spacing nVItemSpace = nVSpace / (mnVisLines+1); + // tdf#162510 - calculate maximum number of rows + size_t nItemCountPinned = 0; +#if !ENABLE_WASM_STRIP_RECENT + bool bPinnedItems = true; + for (size_t i = 0; bPinnedItems && i < nItemCount; ++i) + { + ThumbnailViewItem& rItem = *mFilteredItemList[i]; + if (auto const pRecentDocsItem = dynamic_cast(&rItem)) + { + if (pRecentDocsItem->isPinned()) + ++nItemCountPinned; + else + bPinnedItems = false; + } + } +#endif + // calculate maximum number of rows // Floor( (M+N-1)/N )==Ceiling( M/N ) - mnLines = (static_cast(nItemCount)+mnCols-1) / mnCols; + mnLines = (static_cast(nItemCount - nItemCountPinned) + mnCols - 1) / mnCols; + // tdf#162510 - add pinned items to number of lines + mnLines += (static_cast(nItemCountPinned) + mnCols - 1) / mnCols; if ( !mnLines ) mnLines = 1; @@ -407,87 +426,73 @@ void ThumbnailView::CalculateItemPositions(bool bScrollBarUsed) size_t nFirstItem = (bScrollBarUsed ? nHiddenLines : mnFirstLine) * mnCols; size_t nLastItem = nFirstItem + (mnVisLines + 1) * mnCols; - // If want also draw parts of items in the last line, - // then we add one more line if parts of this line are visible - -#if !ENABLE_WASM_STRIP_RECENT - bool bPinnedItems = true; -#endif - size_t nCurCount = 0; - for ( size_t i = 0; i < nItemCount; i++ ) + // tdf#162510 - helper for in order to handle accessibility events + auto handleAccessibleEvent = [&](ThumbnailViewItem& rItem, bool bIsVisible) { - ThumbnailViewItem& rItem = *mFilteredItemList[i]; - -#if !ENABLE_WASM_STRIP_RECENT - // tdf#38742 - show pinned items in a separate line - if (auto const pRecentDocsItem = dynamic_cast(&rItem)) + if (ImplHasAccessibleListeners()) { - if (bPinnedItems && !pRecentDocsItem->isPinned()) - { - bPinnedItems = false; - // Start a new line only if the entire line is not filled - if (nCurCount % mnCols && nCurCount > nFirstItem) - { - x = nStartX; - y += mnItemHeight + nVItemSpace; - } - nCurCount = 0; - } + css::uno::Any aOldAny, aNewAny; + if (bIsVisible) + aNewAny <<= css::uno::Reference( + rItem.GetAccessible(false)); + else + aOldAny <<= css::uno::Reference( + rItem.GetAccessible(false)); + ImplFireAccessibleEvent(css::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny); } -#endif + }; - if ((nCurCount >= nFirstItem) && (nCurCount < nLastItem)) + // tdf#162510 - helper to set visibility and update layout + auto updateItemLayout = [&](ThumbnailViewItem& rItem, bool bIsVisible, size_t& nVisibleCount) + { + if (bIsVisible != rItem.isVisible()) { - if( !rItem.isVisible()) - { - if ( ImplHasAccessibleListeners() ) - { - css::uno::Any aOldAny, aNewAny; + handleAccessibleEvent(rItem, bIsVisible); + rItem.show(bIsVisible); + maItemStateHdl.Call(&rItem); + } - aNewAny <<= css::uno::Reference(rItem.GetAccessible( false )); - ImplFireAccessibleEvent( css::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny ); - } + if (bIsVisible) + { + rItem.setDrawArea(::tools::Rectangle(Point(x, y), Size(mnItemWidth, mnItemHeight))); + rItem.calculateItemsPosition(mnThumbnailHeight, mnItemPadding, + mpItemAttrs->nMaxTextLength, mpItemAttrs.get()); - rItem.show(true); - - maItemStateHdl.Call(&rItem); - } - - rItem.setDrawArea(::tools::Rectangle( Point(x,y), Size(mnItemWidth, mnItemHeight) )); - rItem.calculateItemsPosition(mnThumbnailHeight,mnItemPadding,mpItemAttrs->nMaxTextLength,mpItemAttrs.get()); - - if ( !((nCurCount+1) % mnCols) ) + if ((nVisibleCount + 1) % mnCols) + x += mnItemWidth + nHItemSpace; + else { x = nStartX; - y += mnItemHeight+nVItemSpace; + y += mnItemHeight + nVItemSpace; } - else - x += mnItemWidth+nHItemSpace; + ++nVisibleCount; } - else - { - if( rItem.isVisible()) - { - if ( ImplHasAccessibleListeners() ) - { - css::uno::Any aOldAny, aNewAny; + }; - aOldAny <<= css::uno::Reference(rItem.GetAccessible( false )); - ImplFireAccessibleEvent( css::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny ); - } + size_t nCurCountVisible = 0; +#if !ENABLE_WASM_STRIP_RECENT + // tdf#162510 - process pinned items + for (size_t i = 0; i < nItemCountPinned; i++) + updateItemLayout(*mFilteredItemList[i], nFirstItem <= i && i < nLastItem, nCurCountVisible); - rItem.show(false); - - maItemStateHdl.Call(&rItem); - } - - } - - ++nCurCount; + // tdf#162510 - start a new line only if the entire line is not filled with pinned items + if (nCurCountVisible && nCurCountVisible % mnCols) + { + x = nStartX; + y += mnItemHeight + nVItemSpace; } - // arrange ScrollBar, set values and show it - mnLines = (nCurCount+mnCols-1)/mnCols; + // tdf#162510 - adjust first item to take into account the new line after pinned items + auto nFirstItemAdjustment = mnCols - nItemCountPinned % mnCols; + if (nFirstItemAdjustment <= nFirstItem) + nFirstItem -= nFirstItemAdjustment; +#endif + + // If want also draw parts of items in the last line, + // then we add one more line if parts of this line are visible + nCurCountVisible = 0; + for (size_t i = nItemCountPinned; i < nItemCount; i++) + updateItemLayout(*mFilteredItemList[i], nFirstItem <= i && i < nLastItem, nCurCountVisible); // check if scroll is needed mbScroll = mnLines > mnVisLines; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 7d433aa7329e..b42e8261194c 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1218,8 +1218,7 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) sal_uInt32 nIndex = aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM ); if ( seqValue.hasElements() ) { - OUString sValue; - aNumberFormatter.GetInputLineString( seqValue[0], nIndex, sValue ); + OUString sValue = aNumberFormatter.GetInputLineString( seqValue[0], nIndex ); m_xShowSizeFT->set_label( CreateSizeText( sValue.toInt64( ) ) ); } } @@ -1926,7 +1925,7 @@ void CustomPropertiesWindow::ReloadLinesContent() else if (rAny >>= nTmpValue) { sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex(NF_NUMBER_SYSTEM); - m_aNumberFormatter.GetInputLineString(nTmpValue, nIndex, sValue); + sValue = m_aNumberFormatter.GetInputLineString(nTmpValue, nIndex); pLine->m_xValueEdit->set_text(sValue); nType = Custom_Type_Number; } @@ -2314,8 +2313,7 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName, sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM ); for (const auto& rValue : seqValue) { - OUString sValue; - m_aNumberFormatter.GetInputLineString( rValue, nIndex, sValue ); + OUString sValue = m_aNumberFormatter.GetInputLineString( rValue, nIndex ); std::unique_ptr pValue(new CmisValue(m_xBox.get(), sValue)); pValue->m_xValueEdit->set_editable(bUpdatable); pNewLine->m_aValues.push_back( std::move(pValue) ); @@ -2328,8 +2326,7 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName, sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM ); for (const auto& rValue : seqValue) { - OUString sValue; - m_aNumberFormatter.GetInputLineString( rValue, nIndex, sValue ); + OUString sValue = m_aNumberFormatter.GetInputLineString( rValue, nIndex ); std::unique_ptr pValue(new CmisValue(m_xBox.get(), sValue)); pValue->m_xValueEdit->set_editable(bUpdatable); pNewLine->m_aValues.push_back( std::move(pValue) ); diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 73b270e78f54..ea8d924c9d5a 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -692,7 +692,7 @@ SfxDocumentMetaData::setMetaText(std::unique_lock& rGuard, const OUS if (xNode.is()) { // delete m_xParent->removeChild(xNode); xNode.clear(); - m_meta[name] = xNode; + m_meta[name] = std::move(xNode); return true; } else { return false; @@ -987,7 +987,7 @@ SfxDocumentMetaData::updateElement(std::unique_lock& /*rGuard*/, con } m_xParent->appendChild(xNode); } - m_meta[name] = xNode; + m_meta[name] = std::move(xNode); } catch (const css::xml::dom::DOMException &) { css::uno::Any anyEx = cppu::getCaughtException(); throw css::lang::WrappedTargetRuntimeException( @@ -1201,7 +1201,7 @@ void SfxDocumentMetaData::init( i_xDoc->createElementNS(s_nsODF, sOfficeMeta), css::uno::UNO_QUERY_THROW); xRElem->appendChild(xParent); - m_xParent = xParent; + m_xParent = std::move(xParent); } catch (const css::xml::dom::DOMException &) { css::uno::Any anyEx = cppu::getCaughtException(); throw css::lang::WrappedTargetRuntimeException( @@ -1220,11 +1220,10 @@ void SfxDocumentMetaData::init( // document, it will contain the duplicates unchanged. // The ODF spec says that handling multiple occurrences is // application-specific. - css::uno::Reference xNode = - getChildNodeByName(m_xParent, name); + // Do not create an empty element if it is missing; // for certain elements, such as dateTime, this would be invalid - m_meta[name] = xNode; + m_meta[name] = getChildNodeByName(m_xParent, name); } // select nodes for elements of which we handle all occurrences @@ -1928,7 +1927,7 @@ SfxDocumentMetaData::loadFromStorage( css::uno::Reference xMsf ( m_xContext->getServiceManager()); css::xml::sax::InputSource input; - input.aInputStream = xInStream; + input.aInputStream = std::move(xInStream); sal_uInt64 version = SotStorage::GetVersion( xStorage ); // Oasis is also the default (0) diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 016b25429098..c96e338cbe11 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2408,7 +2408,7 @@ bool SfxMedium::TryDirectTransfer( const OUString& aURL, SfxItemSet const & aTar ::ucbhelper::Content aTargetContent( aURL, xEnv, comphelper::getProcessComponentContext() ); InsertCommandArgument aInsertArg; - aInsertArg.Data = xInStream; + aInsertArg.Data = std::move(xInStream); const SfxBoolItem* pOverWrite = aTargetSet.GetItem(SID_OVERWRITE, false); if ( pOverWrite && !pOverWrite->GetValue() ) // argument says: never overwrite aInsertArg.ReplaceExisting = false; @@ -2935,7 +2935,7 @@ void SfxMedium::GetLockingStream_Impl() pImpl->xStream = pImpl->m_xLockingStream; if ( xInputStream.is() ) - pImpl->xInputStream = xInputStream; + pImpl->xInputStream = std::move(xInputStream); if ( !pImpl->xInputStream.is() && pImpl->xStream.is() ) pImpl->xInputStream = pImpl->xStream->getInputStream(); @@ -4743,7 +4743,7 @@ OUString SfxMedium::SwitchDocumentToTempFile() SetPhysicalName_Impl( OUString() ); SetName( aOrigURL ); GetMedium_Impl(); - pImpl->xStorage = xStorage; + pImpl->xStorage = std::move(xStorage); } } } @@ -4799,7 +4799,7 @@ bool SfxMedium::SwitchDocumentToFile( const OUString& aURL ) SetPhysicalName_Impl( OUString() ); SetName( aOrigURL ); GetMedium_Impl(); - pImpl->xStorage = xStorage; + pImpl->xStorage = std::move(xStorage); } } diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 435657928d71..6ec82f732749 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -617,8 +617,8 @@ bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName, bool if ( bIsAsync ) { - m_xFilterProperties = xFilterProperties; - m_xFilterDialog = xAsyncFilterDialog; + m_xFilterProperties = std::move(xFilterProperties); + m_xFilterDialog = std::move(xAsyncFilterDialog); auto aDialogClosedListener = rtl::Reference(new svt::DialogClosedListener()); aDialogClosedListener->SetDialogClosedLink( LINK( this, ModelData_Impl, OptionsDialogClosedHdl ) ); diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 12c28f4e614d..190b87ef2e1b 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -90,6 +90,7 @@ #include #include #include +#include #include #include @@ -604,6 +605,32 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } else { + // See if a signing cert is passed as a parameter: if so, parse that. + std::string aSignatureCert; + std::string aSignatureKey; + const SfxStringItem* pSignatureCert = rReq.GetArg(FN_PARAM_1); + if (pSignatureCert) + { + aSignatureCert = pSignatureCert->GetValue().toUtf8(); + } + const SfxStringItem* pSignatureKey = rReq.GetArg(FN_PARAM_2); + if (pSignatureKey) + { + aSignatureKey = pSignatureKey->GetValue().toUtf8(); + } + SfxViewFrame* pFrame = GetFrame(); + SfxViewShell* pViewShell = pFrame ? pFrame->GetViewShell() : nullptr; + if (pViewShell) + { + uno::Reference xSigningCertificate; + if (!aSignatureCert.empty() && !aSignatureKey.empty()) + { + xSigningCertificate = SfxLokHelper::getSigningCertificate(aSignatureCert, aSignatureKey); + } + // Always set the signing certificate, to clear data from a previous dispatch. + pViewShell->SetSigningCertificate(xSigningCertificate); + } + // Async, all code before return has to go into the callback. SignDocumentContent(pDialogParent, [this, pDialogParent] (bool bSigned) { AfterSignContent(bSigned, pDialogParent); @@ -1408,13 +1435,6 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) { switch ( nWhich ) { - case SID_DOCTEMPLATE : - { - if ( isExportLocked()) - rSet.DisableItem( nWhich ); - break; - } - case SID_CHECKOUT: { bool bShow = false; @@ -1541,6 +1561,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) break; } + case SID_DOCTEMPLATE: case SID_EXPORTDOC: case SID_EXPORTDOCASPDF: case SID_DIRECTEXPORTDOCASPDF: diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index b26931ca08af..e77fdf2048c9 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3233,7 +3233,7 @@ void SfxBaseModel::impl_store( const OUString& sURL if ( bCopyTo ) { // restore DocumentProperties if a copy was created - m_pData->m_xDocumentProperties = xOldDocProps; + m_pData->m_xDocumentProperties = std::move(xOldDocProps); } Reference < task::XInteractionHandler > xHandler; @@ -3754,7 +3754,7 @@ Reference< ui::XUIConfigurationManager2 > SfxBaseModel::getUIConfigurationManage } } - m_pData->m_xUIConfigurationManager = xNewUIConfMan; + m_pData->m_xUIConfigurationManager = std::move(xNewUIConfMan); } return m_pData->m_xUIConfigurationManager; diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index b106f7f98fcf..d424067ed37f 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -145,7 +145,7 @@ void SfxURLToolBoxControl_Impl::OpenURL( const OUString& rName ) const return; SfxURLToolBoxControl_Impl::ExecuteInfo* pExecuteInfo = new SfxURLToolBoxControl_Impl::ExecuteInfo; - pExecuteInfo->xDispatch = xDispatch; + pExecuteInfo->xDispatch = std::move(xDispatch); pExecuteInfo->aTargetURL = std::move(aTargetURL); pExecuteInfo->aArgs = { comphelper::makePropertyValue(u"Referer"_ustr, u"private:user"_ustr), diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx index f8b31f7c4f10..0ae4d9ae8bf2 100644 --- a/sfx2/source/view/lokcharthelper.cxx +++ b/sfx2/source/view/lokcharthelper.cxx @@ -42,7 +42,7 @@ css::uno::Reference& LokChartHelper::GetXController() ::css::uno::Reference< ::css::frame::XController > xChartController = xChart->getCurrentController(); if( xChartController.is() ) { - mxController = xChartController; + mxController = std::move(xChartController); } } } @@ -62,7 +62,7 @@ css::uno::Reference& LokChartHelper::GetXDispatcher() ::css::uno::Reference< ::css::frame::XDispatch > xDispatcher( xChartController, uno::UNO_QUERY ); if( xDispatcher.is() ) { - mxDispatcher = xDispatcher; + mxDispatcher = std::move(xDispatcher); } } } diff --git a/slideshow/source/engine/animationnodes/animationcommandnode.cxx b/slideshow/source/engine/animationnodes/animationcommandnode.cxx index 121989fa246e..e73f68490f9d 100644 --- a/slideshow/source/engine/animationnodes/animationcommandnode.cxx +++ b/slideshow/source/engine/animationnodes/animationcommandnode.cxx @@ -95,7 +95,7 @@ AnimationCommandNode::AnimationCommandNode( uno::ReferencelookupShape( xShape ) ); mpShape = ::std::dynamic_pointer_cast< IExternalMediaShapeBase >( pShape ); - mxShape = xShape; + mxShape = std::move(xShape); } void AnimationCommandNode::dispose() diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx index bca8cc3f06ca..a968aefadf4e 100644 --- a/slideshow/source/engine/shapes/shapeimporter.cxx +++ b/slideshow/source/engine/shapes/shapeimporter.cxx @@ -207,7 +207,7 @@ ShapeSharedPtr ShapeImporter::createShape( const XShapesEntry& rTop = maShapesStack.top(); css::uno::Reference xMasterPage(rTop.mxShapes, uno::UNO_QUERY_THROW); if (xMasterPage.is()) - xPage = xMasterPage; + xPage = std::move(xMasterPage); } if( shapeType == u"com.sun.star.drawing.MediaShape" || shapeType == u"com.sun.star.presentation.MediaShape" ) diff --git a/slideshow/source/engine/slide/targetpropertiescreator.cxx b/slideshow/source/engine/slide/targetpropertiescreator.cxx index c0d6b38bfef7..2752d543e55c 100644 --- a/slideshow/source/engine/slide/targetpropertiescreator.cxx +++ b/slideshow/source/engine/slide/targetpropertiescreator.cxx @@ -208,7 +208,7 @@ namespace slideshow::internal if( xTargetShape.is() ) { // override target shape with parent-supplied - aTarget.mxRef = xTargetShape; + aTarget.mxRef = std::move(xTargetShape); aTarget.mnParagraphIndex = nParagraphIndex; } else diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 3d9f9f84e180..f5414f105fe0 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -6101,6 +6101,7 @@ include/tools/helpers.hxx include/tools/inetmime.hxx include/tools/inetmsg.hxx include/tools/inetstrm.hxx +include/tools/lazydelete.hxx include/tools/line.hxx include/tools/lineend.hxx include/tools/link.hxx @@ -6295,7 +6296,6 @@ include/vcl/inputtypes.hxx include/vcl/jobset.hxx include/vcl/keycod.hxx include/vcl/layout.hxx -include/vcl/lazydelete.hxx include/vcl/lineinfo.hxx include/vcl/mapmod.hxx include/vcl/menu.hxx diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in index c66d1ad87241..0c31f18b9b0b 100644 --- a/solenv/flatpak-manifest.in +++ b/solenv/flatpak-manifest.in @@ -51,8 +51,8 @@ "sources": [ { "type": "archive", - "url": "https://download.gnome.org/sources/gvfs/1.56/gvfs-1.56.0.tar.xz", - "sha256": "441d2356c72616364cdb420af96199113a13ed9e146f2175fe373989adada39e", + "url": "https://download.gnome.org/sources/gvfs/1.56/gvfs-1.56.1.tar.xz", + "sha256": "86731ccec679648f8734e237b1de190ebdee6e4c8c0f56f454c31588e509aa10", "x-checker-data": { "type": "gnome", "name": "gvfs", diff --git a/solenv/inc/langlist.mk b/solenv/inc/langlist.mk index 52feaa7eba3a..40f78cc5547b 100644 --- a/solenv/inc/langlist.mk +++ b/solenv/inc/langlist.mk @@ -123,6 +123,7 @@ ta \ te \ tg \ th \ +tl \ tn \ tr \ ts \ diff --git a/solenv/qa/python/gbuildtojson.py b/solenv/qa/python/gbuildtojson.py index d8434acc5216..92029bb4e728 100644 --- a/solenv/qa/python/gbuildtojson.py +++ b/solenv/qa/python/gbuildtojson.py @@ -124,7 +124,7 @@ class CheckGbuildToJsonModules(unittest.TestCase): shutil.rmtree(self.tempwork) def test_gbuildtojson(self): - modules = ['accessibility', 'android', 'animations', 'apple_remote', 'avmedia', 'basctl', 'basegfx', 'basic', 'bean', 'canvas', 'chart2', 'codemaker', 'comphelper', 'cppcanvas', 'cui', 'dbaccess', 'desktop', 'docmodel', 'drawinglayer', 'editeng', 'embeddedobj', 'embedserv', 'eventattacher', 'extras', 'filter', 'forms', 'formula', 'fpicker', 'framework', 'hwpfilter', 'i18nlangtag', 'i18nutil', 'idl', 'instsetoo_native', 'io', 'ios', 'jvmaccess', 'jvmfwk', 'l10ntools', 'librelogo', 'libreofficekit', 'linguistic', 'lotuswordpro', 'nlpsolver', 'o3tl', 'offapi', 'officecfg', 'oovbaapi', 'oox', 'opencl', 'package', 'postprocess', 'pyuno', 'registry', 'remotebridges', 'reportbuilder', 'reportdesign', 'ridljar', 'salhelper', 'sax', 'sc', 'sccomp', 'scp2', 'scripting', 'sd', 'sdext', 'setup_native', 'sfx2', 'slideshow', 'smoketest', 'soltools', 'sot', 'starmath', 'store', 'svgio', 'emfio', 'svl', 'svtools', 'svx', 'sw', 'swext', 'sysui', 'test', 'testtools', 'toolkit', 'ucb', 'ucbhelper', 'udkapi', 'uitest', 'UnoControls', 'unodevtools', 'unoidl', 'unoil', 'unotest', 'unotools', 'unoxml', 'ure', 'uui', 'vbahelper', 'vcl', 'winaccessibility', 'wizards', 'writerperfect', 'xmerge', 'xmlhelp', 'xmloff', 'xmlreader', 'xmlscript', 'xmlsecurity'] + modules = ['accessibility', 'android', 'animations', 'apple_remote', 'avmedia', 'basctl', 'basegfx', 'basic', 'bean', 'canvas', 'chart2', 'codemaker', 'comphelper', 'cppcanvas', 'cui', 'dbaccess', 'desktop', 'docmodel', 'drawinglayer', 'editeng', 'embeddedobj', 'embedserv', 'eventattacher', 'extras', 'filter', 'forms', 'formula', 'fpicker', 'framework', 'hwpfilter', 'i18nlangtag', 'i18nutil', 'idl', 'instsetoo_native', 'io', 'ios', 'jvmaccess', 'jvmfwk', 'l10ntools', 'librelogo', 'libreofficekit', 'linguistic', 'lotuswordpro', 'nlpsolver', 'o3tl', 'offapi', 'officecfg', 'oovbaapi', 'oox', 'opencl', 'package', 'postprocess', 'pyuno', 'registry', 'remotebridges', 'reportbuilder', 'reportdesign', 'ridljar', 'salhelper', 'sax', 'sc', 'sccomp', 'scp2', 'scripting', 'sd', 'sdext', 'setup_native', 'sfx2', 'slideshow', 'smoketest', 'soltools', 'sot', 'starmath', 'store', 'svgio', 'emfio', 'svl', 'svtools', 'svx', 'sw', 'swext', 'sysui', 'test', 'testtools', 'toolkit', 'ucb', 'ucbhelper', 'udkapi', 'uitest', 'UnoControls', 'unodevtools', 'unoidl', 'unoil', 'unotest', 'unotools', 'unoxml', 'ure', 'uui', 'vbahelper', 'vcl', 'winaccessibility', 'wizards', 'writerperfect', 'xmlhelp', 'xmloff', 'xmlreader', 'xmlscript', 'xmlsecurity'] if os.environ['OS'] == 'WNT': # for now, use a limited subset for testing on windows as it is so annoyingly slow on this modules = ['chart2', 'cui', 'dbaccess', 'framework', 'oox', 'sfx2', 'svl', 'svtools', 'svx', 'toolkit', 'vcl', 'xmloff'] diff --git a/solenv/sanitizers/ui/svt.suppr b/solenv/sanitizers/ui/svt.suppr index 188bd9ea0289..04fbd9e0db29 100644 --- a/solenv/sanitizers/ui/svt.suppr +++ b/solenv/sanitizers/ui/svt.suppr @@ -14,7 +14,6 @@ svtools/uiconfig/ui/printersetupdialog.ui://GtkLabel[@id='comment'] orphan-label svtools/uiconfig/ui/printersetupdialog.ui://GtkLabel[@id='location'] orphan-label svtools/uiconfig/ui/restartdialog.ui://GtkLabel[@id='reason_java'] orphan-label svtools/uiconfig/ui/restartdialog.ui://GtkLabel[@id='reason_mailmerge_install'] orphan-label -svtools/uiconfig/ui/restartdialog.ui://GtkLabel[@id='reason_pdf'] orphan-label svtools/uiconfig/ui/restartdialog.ui://GtkLabel[@id='reason_bibliography_install'] orphan-label svtools/uiconfig/ui/restartdialog.ui://GtkLabel[@id='reason_assigning_folders'] orphan-label svtools/uiconfig/ui/restartdialog.ui://GtkLabel[@id='reason_assigning_javaparameters'] orphan-label diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index 061a794af57c..c7048b166c6f 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -210,9 +211,9 @@ const DataFlavorRepresentation* FormatArray_Impl() static tDataFlavorList& InitFormats_Impl() { - static tDataFlavorList gImplData; + static tools::DeleteOnDeinit gImplData; - return gImplData; + return *gImplData.get(); } /************************************************************************* diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx index 028ebcef76a7..2f76dc3a796e 100644 --- a/starmath/source/mathml/export.cxx +++ b/starmath/source/mathml/export.cxx @@ -90,11 +90,6 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium) // Medium item set SfxItemSet& rMediumItemSet = rMedium.GetItemSet(); - if (pDocShell == nullptr) - { - SAL_WARN("starmath", "Failed to get medium item set"); - return false; - } // Progress bar ~ uno::Reference xStatusIndicator; diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 13bc165e3a54..70ed1dbb8cb6 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1508,28 +1508,22 @@ void SmViewShell::Execute(SfxRequest& rReq) break; } - bool bCallExec = nullptr == pWin; - if( !bCallExec ) + if( pWin ) { - if (pWin) - { - TransferableDataHelper aDataHelper( - TransferableDataHelper::CreateFromClipboard( - pWin->GetClipboard())); + TransferableDataHelper aDataHelper( + TransferableDataHelper::CreateFromClipboard( + pWin->GetClipboard())); - if( aDataHelper.GetTransferable().is() && - aDataHelper.HasFormat( SotClipboardFormatId::STRING )) - pWin->Paste(); - else - bCallExec = true; + if( aDataHelper.GetTransferable().is() && + aDataHelper.HasFormat( SotClipboardFormatId::STRING )) + pWin->Paste(); + else + { + GetViewFrame().GetDispatcher()->ExecuteList( + SID_PASTEOBJECT, SfxCallMode::RECORD, + { new SfxVoidItem(SID_PASTEOBJECT) }); } } - if( bCallExec ) - { - GetViewFrame().GetDispatcher()->ExecuteList( - SID_PASTEOBJECT, SfxCallMode::RECORD, - { new SfxVoidItem(SID_PASTEOBJECT) }); - } } break; diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index 5d126fcff481..6768a83769e5 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -2332,8 +2332,6 @@ void SmNodeToTextVisitor::Visit( SmTextNode* pNode ) Append(u"\""); break; case TNUMBER: - Append( pNode->GetToken().aText ); - break; case TIDENT: Append( pNode->GetToken().aText ); break; @@ -2460,9 +2458,6 @@ void SmNodeToTextVisitor::Visit( SmMathSymbolNode* pNode ) case MS_ALEPH: Append(u"aleph"); break; - case 0x0362: - Append(u"widevec"); - break; case MS_DLARROW: Append(u"dlarrow"); break; @@ -2500,8 +2495,6 @@ void SmNodeToTextVisitor::Visit( SmMathSymbolNode* pNode ) Append(u"infinity"); break; case 0x22b2: // NORMAL SUBGROUP OF - Append(OUStringChar(cChar)); - break; case 0x22b3: // CONTAINS AS NORMAL SUBGROUP Append(OUStringChar(cChar)); break; @@ -2529,6 +2522,7 @@ void SmNodeToTextVisitor::Visit( SmMathSymbolNode* pNode ) case 0xe096: Append(u"widetilde"); break; + case 0x0362: case 0xe098: Append(u"widevec"); break; diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 114983d08a7f..6d9a54313923 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -813,11 +813,11 @@ void ImplIntrospectionAccess::cacheXNameContainer(const std::unique_lock const & AccessController::getPolicy() MutexGuard guard( m_aMutex ); if (! m_xPolicy.is()) { - m_xPolicy = xPolicy; + m_xPolicy = std::move(xPolicy); } } return m_xPolicy; diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index 2aa0ed4ca6d7..80aaae31bfbd 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -526,7 +526,7 @@ void SAL_CALL OServiceManagerWrapper::setPropertyValue( } MutexGuard aGuard( m_aMutex ); - m_xContext = xContext; + m_xContext = std::move(xContext); } else @@ -671,7 +671,7 @@ void OServiceManager::setPropertyValue( } MutexGuard aGuard( m_aMutex ); - m_xContext = xContext; + m_xContext = std::move(xContext); } Any OServiceManager::getPropertyValue(const OUString& PropertyName) diff --git a/svl/qa/unit/items/test_IndexedStyleSheets.cxx b/svl/qa/unit/items/test_IndexedStyleSheets.cxx index 37e741709558..1b404db5fdab 100644 --- a/svl/qa/unit/items/test_IndexedStyleSheets.cxx +++ b/svl/qa/unit/items/test_IndexedStyleSheets.cxx @@ -26,7 +26,7 @@ class MockedStyleSheet : public SfxStyleSheetBase { public: MockedStyleSheet(const OUString& name, SfxStyleFamily fam = SfxStyleFamily::Char) - : SfxStyleSheetBase(name, nullptr, fam, SfxStyleSearchBits::Auto) + : SfxStyleSheetBase(name, nullptr, fam, SfxStyleSearchBits::Auto, u""_ustr) {} }; diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 73c0c0cdbd98..54b9e227ebce 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -101,10 +101,12 @@ public: }; -SfxStyleSheetBase::SfxStyleSheetBase( const OUString& rName, SfxStyleSheetBasePool* p, SfxStyleFamily eFam, SfxStyleSearchBits mask ) +SfxStyleSheetBase::SfxStyleSheetBase( const OUString& rName, SfxStyleSheetBasePool* p, + SfxStyleFamily eFam, SfxStyleSearchBits mask, const OUString& rParentStyleSheetName ) : m_pPool( p ) , nFamily( eFam ) , aName( rName ) + , aParent( rParentStyleSheetName ) , aFollow( rName ) , pSet( nullptr ) , nMask(mask) @@ -627,10 +629,11 @@ rtl::Reference SfxStyleSheetBasePool::Create ( const OUString& rName, SfxStyleFamily eFam, - SfxStyleSearchBits mask + SfxStyleSearchBits mask, + const OUString& sParentStyleSheetName ) { - return new SfxStyleSheetBase( rName, this, eFam, mask ); + return new SfxStyleSheetBase( rName, this, eFam, mask, sParentStyleSheetName ); } rtl::Reference SfxStyleSheetBasePool::Create( const SfxStyleSheetBase& r ) @@ -638,7 +641,8 @@ rtl::Reference SfxStyleSheetBasePool::Create( const SfxStyleS return new SfxStyleSheetBase( r ); } -SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const OUString& rName, SfxStyleFamily eFam, SfxStyleSearchBits mask) +SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const OUString& rName, SfxStyleFamily eFam, SfxStyleSearchBits mask, + const OUString& sParentStyleSheetName) { OSL_ENSURE( eFam != SfxStyleFamily::All, "svl::SfxStyleSheetBasePool::Make(), FamilyAll is not an allowed Family" ); @@ -648,7 +652,7 @@ SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const OUString& rName, SfxStyleF if( !xStyle.is() ) { - xStyle = Create( rName, eFam, mask ); + xStyle = Create( rName, eFam, mask, sParentStyleSheetName ); StoreStyleSheet(xStyle); } return *xStyle; @@ -797,8 +801,9 @@ void SfxStyleSheetBasePool::ChangeParent(std::u16string_view rOld, SfxStyleSheet::SfxStyleSheet(const OUString &rName, const SfxStyleSheetBasePool& r_Pool, SfxStyleFamily eFam, - SfxStyleSearchBits mask ) - : SfxStyleSheetBase(rName, const_cast< SfxStyleSheetBasePool* >( &r_Pool ), eFam, mask) + SfxStyleSearchBits mask, + const OUString& rParentStyleSheetName) + : SfxStyleSheetBase(rName, const_cast< SfxStyleSheetBasePool* >( &r_Pool ), eFam, mask, rParentStyleSheetName) { } @@ -866,13 +871,14 @@ SfxStyleSheetPool::SfxStyleSheetPool( SfxItemPool const& rSet) } rtl::Reference SfxStyleSheetPool::Create( const OUString& rName, - SfxStyleFamily eFam, SfxStyleSearchBits mask ) + SfxStyleFamily eFam, SfxStyleSearchBits mask, + const OUString& rParentStyleSheetName) { - return new SfxStyleSheet( rName, *this, eFam, mask ); + return new SfxStyleSheet( rName, *this, eFam, mask, rParentStyleSheetName ); } -SfxUnoStyleSheet::SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, SfxStyleSearchBits _nMask ) -: cppu::ImplInheritanceHelper(_rName, _rPool, _eFamily, _nMask) +SfxUnoStyleSheet::SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, SfxStyleSearchBits _nMask, const OUString& rParentStyleSheetName ) +: cppu::ImplInheritanceHelper(_rName, _rPool, _eFamily, _nMask, rParentStyleSheetName) { } diff --git a/svl/source/misc/documentlockfile.cxx b/svl/source/misc/documentlockfile.cxx index f3641a5e049d..5ee13a68bbf0 100644 --- a/svl/source/misc/documentlockfile.cxx +++ b/svl/source/misc/documentlockfile.cxx @@ -91,7 +91,7 @@ bool GenDocumentLockFile::CreateOwnLockFile() ::ucbhelper::Content aTargetContent( GetURL(), xEnv, comphelper::getProcessComponentContext() ); ucb::InsertCommandArgument aInsertArg; - aInsertArg.Data = xInput; + aInsertArg.Data = std::move(xInput); aInsertArg.ReplaceExisting = false; uno::Any aCmdArg; aCmdArg <<= aInsertArg; diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx index 9df41b54d77b..10c6e8b24944 100644 --- a/svl/source/misc/sharecontrolfile.cxx +++ b/svl/source/misc/sharecontrolfile.cxx @@ -93,7 +93,7 @@ ShareControlFile::ShareControlFile( std::u16string_view aOrigURL ) m_xInputStream.set( xStream->getInputStream(), uno::UNO_SET_THROW ); m_xOutputStream.set( xStream->getOutputStream(), uno::UNO_SET_THROW ); m_xTruncate.set( m_xOutputStream, uno::UNO_QUERY_THROW ); - m_xStream = xStream; + m_xStream = std::move(xStream); } if ( !IsValid() ) diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx index 840187eca4ee..68469c4e9fc4 100644 --- a/svl/source/numbers/numfmuno.cxx +++ b/svl/source/numbers/numfmuno.cxx @@ -255,14 +255,11 @@ OUString SAL_CALL SvNumberFormatterServiceObj::getInputString( sal_Int32 nKey, d { ::osl::MutexGuard aGuard( m_aMutex ); - OUString aRet; SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : nullptr; if (!pFormatter) throw uno::RuntimeException(); - pFormatter->GetInputLineString(fValue, nKey, aRet); - - return aRet; + return pFormatter->GetInputLineString(fValue, nKey); } // XNumberFormatPreviewer diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index d15201f9c505..bc012180f0f7 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -1943,14 +1943,14 @@ sal_uInt32 SvNumberFormatter::GetEditFormat( double fNumber, sal_uInt32 nFIndex, eType, pFormat, eForLocale); } -void SvNFEngine::GetInputLineString(SvNFLanguageData& rCurrentLanguage, +OUString SvNFEngine::GetInputLineString(SvNFLanguageData& rCurrentLanguage, const SvNFFormatData& rFormatData, const NativeNumberWrapper& rNatNum, const Accessor& rFuncs, const double& fOutNumber, sal_uInt32 nFIndex, - OUString& sOutString, bool bFiltering, bool bForceSystemLocale) { + OUString sOutString; const Color* pColor; sal_uInt32 nRealKey = nFIndex; @@ -2032,16 +2032,16 @@ void SvNFEngine::GetInputLineString(SvNFLanguageData& rCurrentLanguage, { rCurrentLanguage.ChangeStandardPrec(nOldPrec); } + return sOutString; } -void SvNumberFormatter::GetInputLineString(const double& fOutNumber, +OUString SvNumberFormatter::GetInputLineString(const double& fOutNumber, sal_uInt32 nFIndex, - OUString& sOutString, bool bFiltering, bool bForceSystemLocale) { ::osl::MutexGuard aGuard( GetInstanceMutex() ); - SvNFEngine::GetInputLineString(m_aCurrentLanguage, m_aFormatData, GetNatNum(), - m_aRWPolicy, fOutNumber, nFIndex, sOutString, + return SvNFEngine::GetInputLineString(m_aCurrentLanguage, m_aFormatData, GetNatNum(), + m_aRWPolicy, fOutNumber, nFIndex, bFiltering, bForceSystemLocale); } diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index ab33374507fc..cb278cf153c3 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -583,13 +583,9 @@ bool SfxUndoManager::ImplAddUndoAction_NoNotify( std::unique_ptr if (m_xData->pActUndoArray->nCurUndoAction > 0) { --m_xData->pActUndoArray->nCurUndoAction; + // fdo#66071 invalidate the current empty mark when removing + --m_xData->mnEmptyMark; } - else - { - assert(!"CurrentUndoAction going negative (!)"); - } - // fdo#66071 invalidate the current empty mark when removing - --m_xData->mnEmptyMark; } } diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx index 55a7dd563917..0347385cbae4 100644 --- a/svtools/source/filter/exportdialog.cxx +++ b/svtools/source/filter/exportdialog.cxx @@ -112,25 +112,24 @@ static MapUnit GetMapUnit( sal_Int32 nUnit ) sal_Int32 ExportDialog::GetDefaultUnit() const { - sal_Int32 nDefaultUnit = UNIT_CM; + sal_Int32 nDefaultUnit; switch( mrFltCallPara.eFieldUnit ) { // case FieldUnit::NONE : // case FieldUnit::PERCENT : // case FieldUnit::CUSTOM : + case FieldUnit::KM : // PASSTHROUGH INTENDED + case FieldUnit::M : + case FieldUnit::MM_100TH : + case FieldUnit::CM : default: nDefaultUnit = UNIT_CM; break; case FieldUnit::MILE : // PASSTHROUGH INTENDED case FieldUnit::FOOT : case FieldUnit::TWIP : - case FieldUnit::PICA : nDefaultUnit = UNIT_INCH; break; - - case FieldUnit::KM : // PASSTHROUGH INTENDED - case FieldUnit::M : - case FieldUnit::MM_100TH : nDefaultUnit = UNIT_CM; break; - + case FieldUnit::PICA : case FieldUnit::INCH : nDefaultUnit = UNIT_INCH; break; - case FieldUnit::CM : nDefaultUnit = UNIT_CM; break; + case FieldUnit::MM : nDefaultUnit = UNIT_MM; break; case FieldUnit::POINT : nDefaultUnit = UNIT_POINT; break; } @@ -402,7 +401,7 @@ void ExportDialog::GetGraphicSource() uno::Reference< drawing::XDrawPage > xCurrentPage( xDrawView->getCurrentPage() ); if ( xCurrentPage.is() ) { - mxPage = xCurrentPage; // exporting whole page + mxPage = std::move(xCurrentPage); // exporting whole page } } } diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index b7370436b175..2415886e0f23 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -159,9 +159,9 @@ void AcceleratorExecute::init(const css::uno::Reference< css::uno::XComponentCon // SAFE -> ------------------------------ aLock.lock(); - m_xGlobalCfg = xGlobalCfg; - m_xModuleCfg = xModuleCfg; - m_xDocCfg = xDocCfg ; + m_xGlobalCfg = std::move(xGlobalCfg); + m_xModuleCfg = std::move(xModuleCfg); + m_xDocCfg = std::move(xDocCfg); aLock.unlock(); // <- SAFE ---------------------------------- diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index d165a8922f02..c5603057da8b 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -919,8 +919,7 @@ OString HTMLOutFuncs::CreateTableDataOptionsValNum( if ( bValue ) { // printf / scanf is not precise enough - OUString aValStr; - rFormatter.GetInputLineString( fVal, 0, aValStr ); + OUString aValStr = rFormatter.GetInputLineString( fVal, 0 ); OString sTmp(OUStringToOString(aValStr, RTL_TEXTENCODING_UTF8)); aStrTD.append(" " OOO_STRING_SVTOOLS_HTML_O_SDval "=\"" + sTmp + "\""); diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx index 85065724f9f3..de46b999e4d7 100644 --- a/svtools/source/uno/popupmenucontrollerbase.cxx +++ b/svtools/source/uno/popupmenucontrollerbase.cxx @@ -324,7 +324,7 @@ void PopupMenuControllerBase::initializeImpl( std::unique_lock& /*rG if ( xFrame.is() && !aCommandURL.isEmpty() ) { - m_xFrame = xFrame; + m_xFrame = std::move(xFrame); m_aCommandURL = aCommandURL; m_aBaseURL = determineBaseURL( aCommandURL ); m_bInitialized = true; diff --git a/svtools/uiconfig/ui/printersetupdialog.ui b/svtools/uiconfig/ui/printersetupdialog.ui index 1524f9e0f9a4..4ac431e582f7 100644 --- a/svtools/uiconfig/ui/printersetupdialog.ui +++ b/svtools/uiconfig/ui/printersetupdialog.ui @@ -116,6 +116,39 @@ 0 + + + True + False + True + + + Lists the installed printers on your operating system. To change the default printer, select a printer name from the list. + + + + + 1 + 0 + + + + + Properties... + True + True + True + + + Changes the printer settings of your operating system for the current document. + + + + + 2 + 0 + + True @@ -212,39 +245,6 @@ 2 - - - Properties... - True - True - True - - - Changes the printer settings of your operating system for the current document. - - - - - 2 - 0 - - - - - True - False - True - - - Lists the installed printers on your operating system. To change the default printer, select a printer name from the list. - - - - - 1 - 0 - - diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 644eee59dad7..49fd4d45110b 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -1044,10 +1044,6 @@ void EnhancedCustomShape2d::GetParameter( double& rRetValue, const EnhancedCusto } break; case EnhancedCustomShapeParameterType::LEFT : - { - rRetValue = 0.0; - } - break; case EnhancedCustomShapeParameterType::TOP : { rRetValue = 0.0; diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 8e91cbb56a35..8861c69fcdc9 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -538,9 +538,9 @@ IMPL_LINK_NOARG( FmGridHeader, OnAsyncExecuteDrop, void*, void ) if ( !sFieldService.isEmpty() ) xThisRoundCol = xFactory->createColumn(sFieldService); if (nColCount) - xSecondCol = xThisRoundCol; + xSecondCol = std::move(xThisRoundCol); else - xCol = xThisRoundCol; + xCol = std::move(xThisRoundCol); } } @@ -800,10 +800,9 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, weld::Menu& rM std::unique_ptr pItem; SfxItemState eState = pCurrentFrame->GetBindings().QueryState(SID_FM_CTL_PROPERTIES, pItem); - if (eState >= SfxItemState::DEFAULT && pItem != nullptr) + if (eState >= SfxItemState::DEFAULT && pItem) { - bool bChecked = pItem && pItem->GetValue(); - rMenu.set_active(u"column"_ustr, bChecked); + rMenu.set_active(u"column"_ustr, pItem->GetValue()); } } } diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 5c9b79f50a75..b3fe21c0cc0f 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -2529,7 +2529,7 @@ void FmXGridPeer::releaseDispatchProviderInterceptor(const Reference< css::frame } } - xChainWalk = xSlave; + xChainWalk = std::move(xSlave); } // our interceptor chain has changed and we're alive ? if (!isDesignMode()) diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index a66e64a472e9..e0ce5ee2ae7e 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -1786,7 +1786,7 @@ namespace svxform Reference< XNameContainer > xContainer = xFormsSupp->getXForms(); if ( xContainer.is() ) { - m_xDataContainer = xContainer; + m_xDataContainer = std::move(xContainer); const Sequence< OUString > aNameList = m_xDataContainer->getElementNames(); for ( const OUString& rName : aNameList ) { @@ -2311,7 +2311,7 @@ namespace svxform Reference< css::xml::dom::XNode > xNewNode = m_xUIHelper->renameNode( m_pItemNode->m_xNode, m_xNameED->get_text() ); m_xUIHelper->setNodeValue( xNewNode, m_xDefaultED->get_text() ); - m_pItemNode->m_xNode = xNewNode; + m_pItemNode->m_xNode = std::move(xNewNode); } } catch ( Exception const & ) @@ -2979,7 +2979,7 @@ namespace svxform m_xBindLB->append_text(sEntry); if ( !m_xTempBinding.is() ) - m_xTempBinding = xPropSet; + m_xTempBinding = std::move(xPropSet); } } } diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index 8516cb2d49f3..466efe1ef8ec 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -520,7 +520,7 @@ void FmPropBrw::impl_ensurePropertyBrowser_nothrow( FmFormShell* _pFormShell ) { DBG_UNHANDLED_EXCEPTION("svx"); } - m_xLastKnownDocument = xDocument; + m_xLastKnownDocument = std::move(xDocument); } diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index eb6414e8e7de..bc0e8e604389 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -135,7 +135,7 @@ namespace throw RuntimeException( u"Found inconsistent form component hierarchies (2)!"_ustr ); if ( lhsControlModel.is() ) - m_rControlModelMap[ lhsControlModel ] = rhsControlModel; + m_rControlModelMap[ lhsControlModel ] = std::move(rhsControlModel); } private: diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 1b91ac1585bd..8fd0b05635d5 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -1971,7 +1971,7 @@ bool FmXFormShell::setCurrentSelection_Lock( InterfaceBag&& _rSelection ) if ( !xNewCurrentForm.is() ) { // the first form we encountered - xNewCurrentForm = xThisRoundsForm; + xNewCurrentForm = std::move(xThisRoundsForm); } else if ( xNewCurrentForm != xThisRoundsForm ) { // different forms -> no "current form" at all @@ -2072,7 +2072,7 @@ void FmXFormShell::startListening_Lock() break; } } - m_xNavigationController = xParent; + m_xNavigationController = std::move(xParent); } break; @@ -2215,7 +2215,7 @@ IMPL_LINK(FmXFormShell, OnFoundData_Lock, FmFoundRecordInformation&, rfriWhere, DBG_ASSERT(xModelSet.is(), "FmXFormShell::OnFoundData : invalid control model (no property set) !"); xModelSet->setPropertyValue( FM_PROP_ALWAYSSHOWCURSOR, Any( true ) ); xModelSet->setPropertyValue( FM_PROP_CURSORCOLOR, Any( COL_LIGHTRED ) ); - m_xLastGridFound = xControlModel; + m_xLastGridFound = std::move(xControlModel); if ( xGrid.is() ) xGrid->setCurrentColumnPosition(static_cast(nGridColumn)); @@ -2441,7 +2441,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest_Lock, FmSearchContext&, rfmscCont return 0; } - rfmscContextInfo.xCursor = xIter; + rfmscContextInfo.xCursor = std::move(xIter); rfmscContextInfo.strUsedFields = strFieldList; rfmscContextInfo.sFieldDisplayNames = sFieldDisplayNames; @@ -2522,7 +2522,7 @@ void FmXFormShell::UpdateForms_Lock(bool _bInvalidate) if ( m_xForms != xForms ) { RemoveElement_Lock( m_xForms ); - m_xForms = xForms; + m_xForms = std::move(xForms); AddElement_Lock(m_xForms); } @@ -3433,13 +3433,13 @@ void FmXFormShell::CreateExternalView_Lock() Reference< XResultSet> xForm(xCurrentNavController->getModel(), UNO_QUERY); aArg.Value <<= xForm; - m_xExternalDisplayedForm = xForm; + m_xExternalDisplayedForm = std::move(xForm); // do this before dispatching the "attach" command, as the attach may result in a call to our queryDispatch (for the FormSlots) // which needs the m_xExternalDisplayedForm xAttachDispatch->dispatch(aAttachURL, Sequence< PropertyValue>(&aArg, 1)); - m_xExtViewTriggerController = xCurrentNavController; + m_xExtViewTriggerController = std::move(xCurrentNavController); // we want to know modifications done in the external view // if the external controller is a XFormController we can use all our default handlings for it diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index 3f5f28884724..08a9692837e4 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -1236,7 +1236,7 @@ void FmUndoModelReplaceAction::Undo() m_pObject->SetUnoControlModel(m_xReplaced); m_pObject->SetChanged(); - m_xReplaced = xCurrentModel; + m_xReplaced = std::move(xCurrentModel); } } catch(Exception&) diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index fed5613c7d81..5e9ad0db0812 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -714,7 +714,7 @@ IMPL_LINK_NOARG(FmXFormView, OnActivate, void*, void) Reference< XFormController > xActiveController(fad(xController)); if (xActiveController.is()) { - xControllerToActivate = xActiveController; + xControllerToActivate = std::move(xActiveController); break; } } diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index fa45f354ed12..16d7d3389048 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -366,7 +366,7 @@ void ColumnInfoCache::initializeControls( const Sequence< Reference< XControl > if ( gridCol < gridColCount ) { // found a grid column which is bound to the given - rCol.xFirstGridWithInputRequiredColumn = xGrid; + rCol.xFirstGridWithInputRequiredColumn = std::move(xGrid); rCol.nRequiredGridColumn = gridCol; break; } diff --git a/svx/source/items/galleryitem.cxx b/svx/source/items/galleryitem.cxx index 91f2d24ebbc2..b69062f75386 100644 --- a/svx/source/items/galleryitem.cxx +++ b/svx/source/items/galleryitem.cxx @@ -115,8 +115,8 @@ bool SvxGalleryItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /* nMemberId m_nType = nType; m_aURL = aURL; - m_xDrawing = xDrawing; - m_xGraphic = xGraphic; + m_xDrawing = std::move(xDrawing); + m_xGraphic = std::move(xGraphic); return true; } diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index dee5ab7865db..9a1d32dc6345 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include @@ -135,7 +135,7 @@ void ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence(drawingla } else { - static vcl::DeleteOnDeinit< drawinglayer::primitive2d::DiscreteShadow > aDiscreteShadow(( + static tools::DeleteOnDeinit< drawinglayer::primitive2d::DiscreteShadow > aDiscreteShadow(( BitmapEx(SIP_SA_PAGESHADOW35X35))); if(aDiscreteShadow.get()) diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx index ff733c0b6e53..a1cdeb7df6f9 100644 --- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx +++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx @@ -18,7 +18,7 @@ */ #include -#include +#include #include #include @@ -29,7 +29,7 @@ namespace drawinglayer::primitive2d { BitmapEx createDefaultCross_3x3(const basegfx::BColor& rBColor) { - static vcl::DeleteOnDeinit< BitmapEx > aRetVal(vcl::DeleteOnDeinitFlag::Empty); + static tools::DeleteOnDeinit< BitmapEx > aRetVal(tools::DeleteOnDeinitFlag::Empty); static basegfx::BColor aBColor; static std::mutex aMutex; diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index 7b3c3a705a5c..516103aaccfd 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -225,7 +225,7 @@ namespace drawinglayer::primitive2d aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor(); } - const_cast< SdrTextPrimitive2D* >(this)->mxLastVisualizingPage = xCurrentlyVisualizingPage; + const_cast< SdrTextPrimitive2D* >(this)->mxLastVisualizingPage = std::move(xCurrentlyVisualizingPage); const_cast< SdrTextPrimitive2D* >(this)->mnLastPageNumber = nCurrentlyValidPageNumber; const_cast< SdrTextPrimitive2D* >(this)->mnLastPageCount = nCurrentlyValidPageCount; const_cast< SdrTextPrimitive2D* >(this)->maLastTextBackgroundColor = aNewTextBackgroundColor; diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx index 90e7820f1200..0df3ee38bad1 100644 --- a/svx/source/sdr/properties/graphicproperties.cxx +++ b/svx/source/sdr/properties/graphicproperties.cxx @@ -101,14 +101,6 @@ namespace sdr::properties // local changes rObj.SetXPolyDirty(); - // #i29367# Update GraphicAttr, too. This was formerly - // triggered by SdrGrafObj::Notify, which is no longer - // called nowadays. BTW: strictly speaking, the whole - // ImpSetAttrToGrafInfostuff could - // be dumped, when SdrGrafObj::aGrafInfo is removed and - // always created on the fly for repaint. - rObj.ImpSetAttrToGrafInfo(); - // call parent RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight); } @@ -122,9 +114,6 @@ namespace sdr::properties // local changes SdrGrafObj& rObj = static_cast(GetSdrObject()); rObj.SetXPolyDirty(); - - // local changes - rObj.ImpSetAttrToGrafInfo(); } void GraphicProperties::ForceDefaultAttributes() diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx index f6b79cb4b5b7..e3dcb280e92f 100644 --- a/svx/source/svdraw/svdetc.cxx +++ b/svx/source/svdraw/svdetc.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -242,12 +243,13 @@ bool OLEObjCache::UnloadObj(SdrOle2Obj& rObj) std::optional GetDraftFillColor(const SfxItemSet& rSet) { drawing::FillStyle eFill=rSet.Get(XATTR_FILLSTYLE).GetValue(); - + Color aResult; switch(eFill) { case drawing::FillStyle_SOLID: { - return rSet.Get(XATTR_FILLCOLOR).GetColorValue(); + aResult = rSet.Get(XATTR_FILLCOLOR).GetColorValue(); + break; } case drawing::FillStyle_HATCH: { @@ -262,14 +264,16 @@ std::optional GetDraftFillColor(const SfxItemSet& rSet) } const basegfx::BColor aAverageColor(basegfx::average(aCol1.getBColor(), aCol2.getBColor())); - return Color(aAverageColor); + aResult = Color(aAverageColor); + break; } case drawing::FillStyle_GRADIENT: { const basegfx::BGradient& rGrad=rSet.Get(XATTR_FILLGRADIENT).GetGradientValue(); Color aCol1(Color(rGrad.GetColorStops().front().getStopColor())); Color aCol2(Color(rGrad.GetColorStops().back().getStopColor())); const basegfx::BColor aAverageColor(basegfx::average(aCol1.getBColor(), aCol2.getBColor())); - return Color(aAverageColor); + aResult = Color(aAverageColor); + break; } case drawing::FillStyle_BITMAP: { @@ -309,14 +313,38 @@ std::optional GetDraftFillColor(const SfxItemSet& rSet) nGn /= nCount; nBl /= nCount; - return Color(sal_uInt8(nRt), sal_uInt8(nGn), sal_uInt8(nBl)); + aResult = Color(sal_uInt8(nRt), sal_uInt8(nGn), sal_uInt8(nBl)); } break; } - default: break; + default: + return {}; } - return {}; + sal_uInt16 nTransparencyPercentage = rSet.Get(XATTR_FILLTRANSPARENCE).GetValue(); + if (!nTransparencyPercentage) + return aResult; + + auto nTransparency = nTransparencyPercentage / 100.0; + auto nOpacity = 1 - nTransparency; + + svtools::ColorConfig aColorConfig; + Color aBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor); + + // https://en.wikipedia.org/wiki/Alpha_compositing + // We are here calculating transperency fill color against background with + // To put it is simple words with example + // I.E: fill is Red (FF0000) and background is pure white (FFFFFF) + // If we add 50% transperency to fill color will look like Pink(ff7777) + + // TODO: calculate this colors based on object in background and not just the doc color + aResult.SetRed( + std::min(aResult.GetRed() * nOpacity + aBackground.GetRed() * nTransparency, 255.0)); + aResult.SetGreen( + std::min(aResult.GetGreen() * nOpacity + aBackground.GetGreen() * nTransparency, 255.0)); + aResult.SetBlue( + std::min(aResult.GetBlue() * nOpacity + aBackground.GetBlue() * nTransparency, 255.0)); + return aResult; } std::unique_ptr SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel& rModel) diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 73296e97a1f3..5666c1c03993 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include #include #include @@ -776,7 +776,7 @@ BitmapEx ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, BitmapColorIndex eIndex) // if we can't load the marker... - static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet {}; + static tools::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet {}; return aModernSet.get()->GetBitmapEx(eKindOfMarker, sal_uInt16(eIndex)); } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 76a4d4483743..892884b04f11 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -119,7 +119,7 @@ #include #include #include -#include +#include using namespace ::com::sun::star; @@ -509,7 +509,7 @@ void SdrObject::handlePageChange(SdrPage*, SdrPage* ) // init global static itempool SdrItemPool& SdrObject::GetGlobalDrawObjectItemPool() { - static vcl::DeleteRtlReferenceOnDeinit xGlobalItemPool( []() { + static tools::DeleteRtlReferenceOnDeinit xGlobalItemPool( []() { rtl::Reference xNewPool(new SdrItemPool()); rtl::Reference pGlobalOutlPool = EditEngine::CreatePool(); xNewPool->SetSecondaryPool(pGlobalOutlPool.get()); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 57cb8780fef3..82a312c77d9c 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -252,8 +252,6 @@ SdrGrafObj::SdrGrafObj(SdrModel& rSdrModel, SdrGrafObj const & rSource) { SetGraphicLink( m_aFileName ); } - - ImpSetAttrToGrafInfo(); } SdrGrafObj::SdrGrafObj( @@ -412,12 +410,22 @@ GraphicAttr SdrGrafObj::GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlag const bool bRotate = bool( nTransformFlags & SdrGrafObjTransformsAttrs::ROTATE ) && (maGeo.m_nRotationAngle && maGeo.m_nRotationAngle != 18000_deg100); - // Need cropping info earlier - const_cast(this)->ImpSetAttrToGrafInfo(); - // Actually transform the graphic only in this case. // Cropping always happens, though. - aActAttr = m_aGrafInfo; + const SfxItemSet& rSet = GetObjectItemSet(); + const sal_uInt16 nTrans = rSet.Get( SDRATTR_GRAFTRANSPARENCE ).GetValue(); + const SdrGrafCropItem& rCrop = rSet.Get( SDRATTR_GRAFCROP ); + + aActAttr.SetLuminance( rSet.Get( SDRATTR_GRAFLUMINANCE ).GetValue() ); + aActAttr.SetContrast( rSet.Get( SDRATTR_GRAFCONTRAST ).GetValue() ); + aActAttr.SetChannelR( rSet.Get( SDRATTR_GRAFRED ).GetValue() ); + aActAttr.SetChannelG( rSet.Get( SDRATTR_GRAFGREEN ).GetValue() ); + aActAttr.SetChannelB( rSet.Get( SDRATTR_GRAFBLUE ).GetValue() ); + aActAttr.SetGamma( rSet.Get( SDRATTR_GRAFGAMMA ).GetValue() * 0.01 ); + aActAttr.SetAlpha(255 - basegfx::fround(nTrans * 2.55)); + aActAttr.SetInvert( rSet.Get( SDRATTR_GRAFINVERT ).GetValue() ); + aActAttr.SetDrawMode( rSet.Get( SDRATTR_GRAFMODE ).GetValue() ); + aActAttr.SetCrop( rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom() ); if( bMirror ) { @@ -481,12 +489,14 @@ Size SdrGrafObj::getOriginalSize() const else aSize = OutputDevice::LogicToLogic(aSize, GetGrafPrefMapMode(), MapMode(getSdrModelFromSdrObject().GetScaleUnit())); - if (m_aGrafInfo.IsCropped()) + const SfxItemSet& rSet = GetObjectItemSet(); + const SdrGrafCropItem& rCrop = rSet.Get( SDRATTR_GRAFCROP ); + if ( rCrop.GetLeft() != 0 || rCrop.GetTop() != 0 || rCrop.GetRight() != 0 || rCrop.GetBottom() != 0 ) // if is cropped { - const tools::Long aCroppedWidth(aSize.getWidth() - m_aGrafInfo.GetLeftCrop() - - m_aGrafInfo.GetRightCrop()); - const tools::Long aCroppedHeight(aSize.getHeight() - m_aGrafInfo.GetTopCrop() - - m_aGrafInfo.GetBottomCrop()); + const tools::Long aCroppedWidth(aSize.getWidth() - rCrop.GetLeft() + - rCrop.GetRight()); + const tools::Long aCroppedHeight(aSize.getHeight() - rCrop.GetTop() + - rCrop.GetBottom()); aSize = Size(aCroppedWidth, aCroppedHeight); } @@ -1018,7 +1028,6 @@ void SdrGrafObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { SetXPolyDirty(); SdrRectObj::Notify( rBC, rHint ); - ImpSetAttrToGrafInfo(); } @@ -1027,27 +1036,6 @@ void SdrGrafObj::SetMirrored( bool _bMirrored ) m_bMirrored = _bMirrored; } -void SdrGrafObj::ImpSetAttrToGrafInfo() -{ - const SfxItemSet& rSet = GetObjectItemSet(); - const sal_uInt16 nTrans = rSet.Get( SDRATTR_GRAFTRANSPARENCE ).GetValue(); - const SdrGrafCropItem& rCrop = rSet.Get( SDRATTR_GRAFCROP ); - - m_aGrafInfo.SetLuminance( rSet.Get( SDRATTR_GRAFLUMINANCE ).GetValue() ); - m_aGrafInfo.SetContrast( rSet.Get( SDRATTR_GRAFCONTRAST ).GetValue() ); - m_aGrafInfo.SetChannelR( rSet.Get( SDRATTR_GRAFRED ).GetValue() ); - m_aGrafInfo.SetChannelG( rSet.Get( SDRATTR_GRAFGREEN ).GetValue() ); - m_aGrafInfo.SetChannelB( rSet.Get( SDRATTR_GRAFBLUE ).GetValue() ); - m_aGrafInfo.SetGamma( rSet.Get( SDRATTR_GRAFGAMMA ).GetValue() * 0.01 ); - m_aGrafInfo.SetAlpha(255 - basegfx::fround(nTrans * 2.55)); - m_aGrafInfo.SetInvert( rSet.Get( SDRATTR_GRAFINVERT ).GetValue() ); - m_aGrafInfo.SetDrawMode( rSet.Get( SDRATTR_GRAFMODE ).GetValue() ); - m_aGrafInfo.SetCrop( rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom() ); - - SetXPolyDirty(); - SetBoundAndSnapRectsDirty(); -} - void SdrGrafObj::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly ) { Size aSize; diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index db4a041c577d..bb82ecb9289e 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1742,11 +1742,6 @@ SdrLayerAdmin& SdrPage::GetLayerAdmin() return *mpLayerAdmin; } -OUString SdrPage::GetLayoutName() const -{ - return OUString(); -} - void SdrPage::SetInserted( bool bIns ) { if( mbInserted == bIns ) diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 610cfcc748de..b300c4284c38 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -402,7 +402,7 @@ SdrTableObjImpl& SdrTableObjImpl::operator=( const SdrTableObjImpl& rSource ) } // set that TableStyle - mxTableStyle = xNewTableStyle; + mxTableStyle = std::move(xNewTableStyle); // Apply Style to Cells ApplyCellStyles(); diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx index 0cb561b355e1..e110827e6995 100644 --- a/svx/source/table/tabledesign.cxx +++ b/svx/source/table/tabledesign.cxx @@ -417,7 +417,7 @@ void SAL_CALL TableDesignStyle::replaceByName( const OUString& rName, const Any& if (xNewStyle && xNewStyle->isUserDefined()) mbModified = true; - maCellStyles[nIndex] = xNewStyle; + maCellStyles[nIndex] = std::move(xNewStyle); } diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx index 184eaa13cfb4..7fb11fd7a482 100644 --- a/svx/source/table/tablemodel.cxx +++ b/svx/source/table/tablemodel.cxx @@ -378,11 +378,17 @@ uno::Reference SAL_CALL TableModel::getCellByPosition( sal_In { ::SolarMutexGuard aGuard; - CellRef xCell( getCell( nColumn, nRow ) ); - if( xCell.is() ) - return xCell; + sal_Int32 nRowCount = getRowCountImpl(); + if( nRow < 0 || nRow >= nRowCount ) + throw lang::IndexOutOfBoundsException(OUString::Concat("row ") + OUString::number(nRow) + + " out of range 0.." + OUString::number(nRowCount)); - throw lang::IndexOutOfBoundsException(); + sal_Int32 nColCount = getColumnCountImpl(); + if( nColumn < 0 || nColumn >= nColCount ) + throw lang::IndexOutOfBoundsException(OUString::Concat("col ") + OUString::number(nColumn) + + " out of range 0.." + OUString::number(nColCount)); + + return maRows[nRow]->maCells[nColumn]; } diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 6cab2fac0af4..4380fbc2fe6c 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -485,6 +485,7 @@ private: std::vector> aImgVec; bool bParagraphMode; bool m_bIsWriter; + bool m_bIsCalc; void InitImageList(); void CalcSizeValueSet(); @@ -2471,11 +2472,16 @@ SvxFrameWindow_Impl::SvxFrameWindow_Impl(SvxFrameToolBoxControl* pControl, weld: , mxFrameSetWin(new weld::CustomWeld(*m_xBuilder, u"valueset"_ustr, *mxFrameSet)) , bParagraphMode(false) , m_bIsWriter(false) + , m_bIsCalc(false) { // check whether the document is Writer or not + // check also if it's Calc or not if (Reference xSI{ m_xFrame->getController()->getModel(), UNO_QUERY }) + { m_bIsWriter = xSI->supportsService(u"com.sun.star.text.TextDocument"_ustr); + m_bIsCalc = xSI->supportsService(u"com.sun.star.sheet.SpreadsheetDocument"_ustr); + } mxFrameSet->SetStyle(WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT); AddStatusListener(u".uno:BorderReducedMode"_ustr); @@ -2495,14 +2501,14 @@ SvxFrameWindow_Impl::SvxFrameWindow_Impl(SvxFrameToolBoxControl* pControl, weld: // diagonal borders available only for Calc. // Therefore, Calc uses 10 border types while // Writer uses 8 of them - for a single cell. - for ( i=1; i < (m_bIsWriter ? 9 : 11); i++ ) + for ( i=1; i < (m_bIsCalc ? 11 : 9); i++ ) mxFrameSet->InsertItem(i, Image(aImgVec[i-1].first), aImgVec[i-1].second); //bParagraphMode should have been set in StateChanged if ( !bParagraphMode ) // when multiple cell selected: // Writer has 12 border types and Calc has 15 of them. - for ( i = (m_bIsWriter ? 9 : 11); i < (m_bIsWriter ? 13 : 16); i++ ) + for ( i = (m_bIsCalc ? 11 : 9); i < (m_bIsCalc ? 16 : 13); i++ ) mxFrameSet->InsertItem(i, Image(aImgVec[i-1].first), aImgVec[i-1].second); // adjust frame column for Writer @@ -2568,7 +2574,7 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl, ValueSet*, void) // nSel has 15 cases which means 15 border // types for Calc. But Writer uses only 12 // of them - when diagonal borders excluded. - if (m_bIsWriter) + if (!m_bIsCalc) { // add appropriate increments // to match the correct borders. @@ -2735,7 +2741,7 @@ void SvxFrameWindow_Impl::statusChanged( const css::frame::FeatureStateEvent& rE return; // set 12 border types for Writer, otherwise 15 for Calc. - bool bTableMode = ( mxFrameSet->GetItemCount() == static_cast(m_bIsWriter ? 12 : 15) ); + bool bTableMode = ( mxFrameSet->GetItemCount() == static_cast(m_bIsCalc ? 15 : 12) ); bool bResize = false; if ( bTableMode && bParagraphMode ) @@ -2769,10 +2775,10 @@ void SvxFrameWindow_Impl::CalcSizeValueSet() void SvxFrameWindow_Impl::InitImageList() { - if (m_bIsWriter) + if (!m_bIsCalc) { - // Writer-specific aImgVec. - // Since Writer doesn't have diagonal borders, + // not Writer/Impress/Draw-specific aImgVec. + // Since they don't have diagonal borders, // we have to use 12 border types here. aImgVec = { {BitmapEx(RID_SVXBMP_FRAME1), SvxResId(RID_SVXSTR_TABLE_PRESET_NONE)}, diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index dea32b511d39..e516e990cf80 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -640,6 +640,7 @@ rtl::Reference SvxDrawPage::CreateShapeByTypeAndInventor( SdrObjKind n pRet = new SvxShapePolyPolygon( pObj ); break; case SdrObjKind::Rectangle: + case SdrObjKind::Annotation: pRet = new SvxShapeRect( pObj ); break; case SdrObjKind::CircleOrEllipse: @@ -766,9 +767,6 @@ rtl::Reference SvxDrawPage::CreateShapeByTypeAndInventor( SdrObjKind n case SdrObjKind::Table: pRet = new SvxTableShape( pObj ); break; - case SdrObjKind::Annotation: - pRet = new SvxShapeRect( pObj ); - break; default: // unknown 2D-object on page assert(false && "Not implemented Starone-Shape created"); pRet = new SvxShapeText( pObj ); diff --git a/sw/inc/IShellCursorSupplier.hxx b/sw/inc/IShellCursorSupplier.hxx index ec945f24d3b4..10e7b83ea130 100644 --- a/sw/inc/IShellCursorSupplier.hxx +++ b/sw/inc/IShellCursorSupplier.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_ISHELLCURSORSUPPLIER_HXX -#define INCLUDED_SW_INC_ISHELLCURSORSUPPLIER_HXX +#pragma once class SwCursor; @@ -38,6 +37,4 @@ public: } // namespace sw -#endif // INCLUDED_SW_INC_ISHELLCURSORSUPPLIER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/PageColumnPopup.hxx b/sw/inc/PageColumnPopup.hxx index 6d50daa1576a..ff193a321fee 100644 --- a/sw/inc/PageColumnPopup.hxx +++ b/sw/inc/PageColumnPopup.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_PAGECOLUMNPOPUP_HXX -#define INCLUDED_SW_INC_PAGECOLUMNPOPUP_HXX +#pragma once #include @@ -38,6 +37,4 @@ public: virtual void SAL_CALL initialize(const css::uno::Sequence& rArguments) override; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/PageMarginPopup.hxx b/sw/inc/PageMarginPopup.hxx index ddfb7049f037..6999bcc36e05 100644 --- a/sw/inc/PageMarginPopup.hxx +++ b/sw/inc/PageMarginPopup.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_PAGEMARGINPOPUP_HXX -#define INCLUDED_SW_INC_PAGEMARGINPOPUP_HXX +#pragma once #include @@ -38,6 +37,4 @@ public: virtual void SAL_CALL initialize(const css::uno::Sequence& rArguments) override; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/PageOrientationPopup.hxx b/sw/inc/PageOrientationPopup.hxx index 9f50ffdacd60..2e60dbbdb07e 100644 --- a/sw/inc/PageOrientationPopup.hxx +++ b/sw/inc/PageOrientationPopup.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_PAGEORIENTATIONPOPUP_HXX -#define INCLUDED_SW_INC_PAGEORIENTATIONPOPUP_HXX +#pragma once #include @@ -38,6 +37,4 @@ public: virtual void SAL_CALL initialize(const css::uno::Sequence& rArguments) override; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/PageSizePopup.hxx b/sw/inc/PageSizePopup.hxx index 3eb4088c2af9..65eb144a4bc3 100644 --- a/sw/inc/PageSizePopup.hxx +++ b/sw/inc/PageSizePopup.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_PAGESIZEPOPUP_HXX -#define INCLUDED_SW_INC_PAGESIZEPOPUP_HXX +#pragma once #include @@ -38,6 +37,4 @@ public: virtual void SAL_CALL initialize(const css::uno::Sequence& rArguments) override; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index dec8cec70764..8c25f381641b 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -16,9 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef INCLUDED_SW_INC_POSTITMGR_HXX -#define INCLUDED_SW_INC_POSTITMGR_HXX +#pragma once #include #include "swdllapi.h" @@ -256,6 +254,4 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public SfxListener, sw::sidebarwindows::SidebarPosition GetSidebarPos(const Point& rPointLogic); }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwAppletImpl.hxx b/sw/inc/SwAppletImpl.hxx index ea30a104ce69..13409e337305 100644 --- a/sw/inc/SwAppletImpl.hxx +++ b/sw/inc/SwAppletImpl.hxx @@ -16,9 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef INCLUDED_SW_INC_SWAPPLETIMPL_HXX -#define INCLUDED_SW_INC_SWAPPLETIMPL_HXX +#pragma once #include @@ -62,6 +60,5 @@ public: const OUString& GetAltText() const { return m_sAlt; } void SetAltText( const OUString& rAlt ) {m_sAlt = rAlt;} }; -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwCapConfigProp.hxx b/sw/inc/SwCapConfigProp.hxx index 20257f3d9716..9a317b199750 100644 --- a/sw/inc/SwCapConfigProp.hxx +++ b/sw/inc/SwCapConfigProp.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_SWCAPCONFIGPROP_HXX -#define INCLUDED_SW_INC_SWCAPCONFIGPROP_HXX +#pragma once enum CapConfigProp { @@ -33,6 +32,4 @@ enum CapConfigProp PROP_CAP_OBJECT_APPLYATTRIBUTES, //9 }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwCapObjType.hxx b/sw/inc/SwCapObjType.hxx index 729e1a7b2f66..bab5b39888fd 100644 --- a/sw/inc/SwCapObjType.hxx +++ b/sw/inc/SwCapObjType.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_SWCAPOBJTYPE_HXX -#define INCLUDED_SW_INC_SWCAPOBJTYPE_HXX +#pragma once enum SwCapObjType { @@ -27,6 +26,4 @@ enum SwCapObjType OLE_CAP }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwDocIdle.hxx b/sw/inc/SwDocIdle.hxx index 2eeeee1c9870..4d573b748a85 100644 --- a/sw/inc/SwDocIdle.hxx +++ b/sw/inc/SwDocIdle.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_SWDOCIDLE_HXX -#define INCLUDED_SW_INC_SWDOCIDLE_HXX +#pragma once #include @@ -46,6 +45,4 @@ public: }; } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwGetPoolIdFromName.hxx b/sw/inc/SwGetPoolIdFromName.hxx index 6d66616dd0c4..1f46af93661f 100644 --- a/sw/inc/SwGetPoolIdFromName.hxx +++ b/sw/inc/SwGetPoolIdFromName.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_SWGETPOOLIDFROMNAME_HXX -#define INCLUDED_SW_INC_SWGETPOOLIDFROMNAME_HXX +#pragma once #include @@ -35,6 +34,4 @@ enum class SwGetPoolIdFromName : sal_uInt16 CellStyle = 0x40 }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwNodeNum.hxx b/sw/inc/SwNodeNum.hxx index 2aff25d306ba..c0faf2e514aa 100644 --- a/sw/inc/SwNodeNum.hxx +++ b/sw/inc/SwNodeNum.hxx @@ -16,9 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef INCLUDED_SW_INC_SWNODENUM_HXX -#define INCLUDED_SW_INC_SWNODENUM_HXX +#pragma once #include "SwNumberTree.hxx" @@ -96,6 +94,4 @@ private: virtual void NotifyNode() override; }; -#endif // INCLUDED_SW_INC_SWNODENUM_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwNumberTreeTypes.hxx b/sw/inc/SwNumberTreeTypes.hxx index 505802edf291..ff04dd268958 100644 --- a/sw/inc/SwNumberTreeTypes.hxx +++ b/sw/inc/SwNumberTreeTypes.hxx @@ -16,9 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef INCLUDED_SW_INC_SWNUMBERTREETYPES_HXX -#define INCLUDED_SW_INC_SWNUMBERTREETYPES_HXX +#pragma once #include #include @@ -29,6 +27,4 @@ typedef tools::Long tSwNumTreeNumber; typedef std::vector tNumberVector; } -#endif // INCLUDED_SW_INC_SWNUMBERTREETYPES_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwRewriter.hxx b/sw/inc/SwRewriter.hxx index a0ab5e371342..e41a076568ba 100644 --- a/sw/inc/SwRewriter.hxx +++ b/sw/inc/SwRewriter.hxx @@ -16,9 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef INCLUDED_SW_INC_SWREWRITER_HXX -#define INCLUDED_SW_INC_SWREWRITER_HXX +#pragma once #include #include @@ -47,6 +45,4 @@ public: static OUString GetPlaceHolder(SwUndoArg eId); }; -#endif // INCLUDED_SW_INC_SWREWRITER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwSmartTagMgr.hxx b/sw/inc/SwSmartTagMgr.hxx index f1c254f93e45..6dd8fb020506 100644 --- a/sw/inc/SwSmartTagMgr.hxx +++ b/sw/inc/SwSmartTagMgr.hxx @@ -16,9 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef INCLUDED_SW_INC_SWSMARTTAGMGR_HXX -#define INCLUDED_SW_INC_SWSMARTTAGMGR_HXX +#pragma once #include #include @@ -42,6 +40,4 @@ public: virtual void SAL_CALL changesOccurred(const css::util::ChangesEvent& Event) override; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwStyleNameMapper.hxx b/sw/inc/SwStyleNameMapper.hxx index 139f09c974db..0fdfb381711a 100644 --- a/sw/inc/SwStyleNameMapper.hxx +++ b/sw/inc/SwStyleNameMapper.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_SWSTYLENAMEMAPPER_HXX -#define INCLUDED_SW_INC_SWSTYLENAMEMAPPER_HXX +#pragma once #include #include @@ -153,6 +152,5 @@ public: static const std::vector& GetTableStyleProgNameArray(); static const std::vector& GetCellStyleProgNameArray(); }; -#endif // _NAME_MAPPER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwUndoField.hxx b/sw/inc/SwUndoField.hxx index dcdc57b0b9bd..fc82fe12fa71 100644 --- a/sw/inc/SwUndoField.hxx +++ b/sw/inc/SwUndoField.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_SWUNDOFIELD_HXX -#define INCLUDED_SW_INC_SWUNDOFIELD_HXX +#pragma once #include "undobj.hxx" @@ -80,6 +79,4 @@ public: virtual void RepeatImpl( ::sw::RepeatContext & ) override; }; -#endif // INCLUDED_SW_INC_SWUNDOFIELD_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwXMLSectionList.hxx b/sw/inc/SwXMLSectionList.hxx index e05eeb3a6be1..4bea922cf42f 100644 --- a/sw/inc/SwXMLSectionList.hxx +++ b/sw/inc/SwXMLSectionList.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_SWXMLSECTIONLIST_HXX -#define INCLUDED_SW_INC_SWXMLSECTIONLIST_HXX +#pragma once #include @@ -37,6 +36,4 @@ private: const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ToxLinkProcessor.hxx b/sw/inc/ToxLinkProcessor.hxx index b0c708fb6519..967e658d4970 100644 --- a/sw/inc/ToxLinkProcessor.hxx +++ b/sw/inc/ToxLinkProcessor.hxx @@ -6,9 +6,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef SW_TOXLINKPROCESSOR_HXX_ -#define SW_TOXLINKPROCESSOR_HXX_ +#pragma once #include "fmtinfmt.hxx" #include @@ -91,6 +89,4 @@ private: } -#endif /* SW_TOXLINKPROCESSOR_HXX_ */ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ToxTabStopTokenHandler.hxx b/sw/inc/ToxTabStopTokenHandler.hxx index 29d634c67914..23a7d720682c 100644 --- a/sw/inc/ToxTabStopTokenHandler.hxx +++ b/sw/inc/ToxTabStopTokenHandler.hxx @@ -7,9 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef TOXTABSTOPTOKENHANDLER_HXX_ -#define TOXTABSTOPTOKENHANDLER_HXX_ +#pragma once #include @@ -115,6 +113,4 @@ private: } -#endif /* TOXTABSTOPTOKENHANDLER_HXX_ */ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ToxTextGenerator.hxx b/sw/inc/ToxTextGenerator.hxx index 105aa9eb0660..11ba9488716a 100644 --- a/sw/inc/ToxTextGenerator.hxx +++ b/sw/inc/ToxTextGenerator.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef SW_TOXTEXTGENERATOR_HXX_ -#define SW_TOXTEXTGENERATOR_HXX_ +#pragma once #include #include @@ -171,6 +170,4 @@ private: } -#endif /* SW_TOXTEXTGENERATOR_HXX_ */ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ToxWhitespaceStripper.hxx b/sw/inc/ToxWhitespaceStripper.hxx index 755c3f721af2..0d6cbb113cbf 100644 --- a/sw/inc/ToxWhitespaceStripper.hxx +++ b/sw/inc/ToxWhitespaceStripper.hxx @@ -7,8 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef TOXWHITESPACESTRIPPER_HXX_ -#define TOXWHITESPACESTRIPPER_HXX_ +#pragma once #include #include @@ -44,4 +43,4 @@ private: } // end namespace sw -#endif /* TOXWHITESPACESTRIPPER_HXX_ */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/UndoParagraphSignature.hxx b/sw/inc/UndoParagraphSignature.hxx index 4fe5640a6193..0a8dc07b7da7 100644 --- a/sw/inc/UndoParagraphSignature.hxx +++ b/sw/inc/UndoParagraphSignature.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_UNDOPARAGRAPHSIGNATURE_HXX -#define INCLUDED_SW_INC_UNDOPARAGRAPHSIGNATURE_HXX +#pragma once #include "undobj.hxx" #include @@ -61,6 +60,4 @@ private: void Remove(); }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx index d99d8dc16c7a..bf9969e37461 100644 --- a/sw/inc/accmap.hxx +++ b/sw/inc/accmap.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_ACCMAP_HXX -#define INCLUDED_SW_INC_ACCMAP_HXX +#pragma once #include #include @@ -303,6 +302,5 @@ private: public: virtual bool IsDocumentSelAll() override; }; -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/acmplwrd.hxx b/sw/inc/acmplwrd.hxx index 935a92076ef9..56b60236c953 100644 --- a/sw/inc/acmplwrd.hxx +++ b/sw/inc/acmplwrd.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_ACMPLWRD_HXX -#define INCLUDED_SW_INC_ACMPLWRD_HXX +#pragma once #include #include @@ -73,6 +72,4 @@ public: bool GetWordsMatching(std::u16string_view aMatch, std::vector& aWords) const; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/anchoreddrawobject.hxx b/sw/inc/anchoreddrawobject.hxx index bfc40fe07a3c..482b5d6dd28d 100644 --- a/sw/inc/anchoreddrawobject.hxx +++ b/sw/inc/anchoreddrawobject.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_ANCHOREDDRAWOBJECT_HXX -#define INCLUDED_SW_INC_ANCHOREDDRAWOBJECT_HXX +#pragma once #include "anchoredobject.hxx" #include @@ -164,6 +163,4 @@ class SwAnchoredDrawObject final : public SwAnchoredObject virtual const char* getElementName( ) const override { return "SwAnchoredDrawObject"; } }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx index 837d25dcb77d..7d06010f2f1c 100644 --- a/sw/inc/anchoredobject.hxx +++ b/sw/inc/anchoredobject.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_ANCHOREDOBJECT_HXX -#define INCLUDED_SW_INC_ANCHOREDOBJECT_HXX +#pragma once #include "swtypes.hxx" #include "swrect.hxx" @@ -515,6 +514,4 @@ class SwObjPositioningInProgress ~SwObjPositioningInProgress(); }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx index 6996f5090b68..ab1d87f74a8b 100644 --- a/sw/inc/authfld.hxx +++ b/sw/inc/authfld.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_AUTHFLD_HXX -#define INCLUDED_SW_INC_AUTHFLD_HXX +#pragma once #include @@ -240,6 +239,4 @@ inline void SwAuthEntry::SetAuthorField(ToxAuthorityField ePos, const OUString& m_aAuthFields[ePos] = rField; } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/authratr.hxx b/sw/inc/authratr.hxx index 2c68369215d1..62ae6de0b79d 100644 --- a/sw/inc/authratr.hxx +++ b/sw/inc/authratr.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_AUTHRATR_HXX -#define INCLUDED_SW_INC_AUTHRATR_HXX +#pragma once #include #include "swdllapi.h" @@ -39,6 +38,4 @@ public: } }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/bitmaps.hlst b/sw/inc/bitmaps.hlst index 5dacda42e987..45ef3a2805cd 100644 --- a/sw/inc/bitmaps.hlst +++ b/sw/inc/bitmaps.hlst @@ -120,4 +120,11 @@ inline constexpr OUString RID_BMP_QUERYINSMODE = u"res/queryinsmode.png"_ustr; inline constexpr OUString RID_SVXBMP_LOCKED = u"res/locked.png"_ustr; inline constexpr OUString RID_SVXBMP_UNLOCKED = u"res/unlocked.png"_ustr; +inline constexpr OUString RID_BMP_LINEBREAK_NONE = u"sw/res/linebreak_none.png"_ustr; +inline constexpr OUString RID_BMP_LINEBREAK_LEFT = u"sw/res/linebreak_left.png"_ustr; +inline constexpr OUString RID_BMP_LINEBREAK_RIGHT = u"sw/res/linebreak_right.png"_ustr; +inline constexpr OUString RID_BMP_LINEBREAK_FULL = u"sw/res/linebreak_full.png"_ustr; +inline constexpr OUString RID_BMP_COLBREAK = u"sw/res/colbreak.png"_ustr; +inline constexpr OUString RID_BMP_PAGEBREAK = u"sw/res/pagebreak.png"_ustr; + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/inc/breakit.hxx b/sw/inc/breakit.hxx index d21fb85bce45..64e63aa3a8e2 100644 --- a/sw/inc/breakit.hxx +++ b/sw/inc/breakit.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_BREAKIT_HXX -#define INCLUDED_SW_INC_BREAKIT_HXX +#pragma once #include #include @@ -124,6 +123,4 @@ public: // @@@ backward compatibility @@@ SW_DLLPUBLIC extern SwBreakIt* g_pBreakIt; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx index 9aa00ec0225c..ff9fde612ece 100644 --- a/sw/inc/calc.hxx +++ b/sw/inc/calc.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_CALC_HXX -#define INCLUDED_SW_INC_CALC_HXX +#pragma once #include #include @@ -216,6 +215,4 @@ public: OUString* pValidName = nullptr ); }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ccoll.hxx b/sw/inc/ccoll.hxx index 4052d4f0afdd..5c9d1f8b9c71 100644 --- a/sw/inc/ccoll.hxx +++ b/sw/inc/ccoll.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_CCOLL_HXX -#define INCLUDED_SW_INC_CCOLL_HXX +#pragma once #include #include @@ -62,6 +61,4 @@ public: }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/cellatr.hxx b/sw/inc/cellatr.hxx index 54ddf2caa5ba..854f755636bd 100644 --- a/sw/inc/cellatr.hxx +++ b/sw/inc/cellatr.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_CELLATR_HXX -#define INCLUDED_SW_INC_CELLATR_HXX +#pragma once #include #include @@ -127,6 +126,4 @@ inline const SwTableBoxFormula &SwFormat::GetTableBoxFormula(bool bInP) c inline const SwTableBoxValue &SwFormat::GetTableBoxValue(bool bInP) const { return m_aSet.GetTableBoxValue(bInP); } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/cellfml.hxx b/sw/inc/cellfml.hxx index 7f71a161baae..a4f6bb2e5366 100644 --- a/sw/inc/cellfml.hxx +++ b/sw/inc/cellfml.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_CELLFML_HXX -#define INCLUDED_SW_INC_CELLFML_HXX +#pragma once #include "swdllapi.h" @@ -148,6 +147,4 @@ public: static sal_uInt16 GetLnPosInTable( const SwTable& rTable, const SwTableBox* pBox ); }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/charatr.hxx b/sw/inc/charatr.hxx index 0e97a27abff2..9b16277e284e 100644 --- a/sw/inc/charatr.hxx +++ b/sw/inc/charatr.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_CHARATR_HXX -#define INCLUDED_SW_INC_CHARATR_HXX +#pragma once #include "format.hxx" #include "hintids.hxx" @@ -128,6 +127,4 @@ inline const SvxFontItem &SwFormat::GetCTLFont(bool bInP) const inline const SvxColorItem &SwFormat::GetColor(bool bInP) const { return m_aSet.GetColor(bInP); } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/charfmt.hxx b/sw/inc/charfmt.hxx index ac29a29aa84e..166db1d708fc 100644 --- a/sw/inc/charfmt.hxx +++ b/sw/inc/charfmt.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_CHARFMT_HXX -#define INCLUDED_SW_INC_CHARFMT_HXX +#pragma once #include "format.hxx" #include "hintids.hxx" @@ -56,6 +55,4 @@ namespace CharFormat extern bool IsItemIncluded( const sal_uInt16 nWhich, const SwTextAttr *pAttr ); } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 6a2406c0a32a..395bf663deec 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -219,8 +219,6 @@ class SwUINumRuleItem; #define FN_INSERT_REF_FIELD (FN_INSERT + 13) /* Insert Reference Field */ -#define FN_INSERT_HYPERLINK (FN_INSERT + 14) /* Character dialogue / hyperlink page */ - #define FN_INSERT_LINEBREAK (FN_INSERT + 18) /* Newline */ #define FN_INSERT_FIELD_DATA_ONLY (FN_INSERT + 19) /* Field dialog for mail merge*/ #define FN_INSERT_CONTENT_CONTROL (FN_INSERT + 20) /* Rich text content control */ diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 8b9f138506aa..806b1b7d2472 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -237,6 +237,7 @@ private: bool m_bBasicHideCursor : 1; // true -> HideCursor from Basic bool m_bSetCursorInReadOnly : 1;// true -> Cursor is allowed in ReadOnly-Areas bool m_bOverwriteCursor : 1; // true -> show Overwrite Cursor + bool m_bIsCursorPosChanged : 1; // true -> if the cursor position is changed last cursor update // true -> send accessible events when cursor changes // (set to false when using internal-only helper cursor) @@ -551,6 +552,9 @@ public: // Check if selection is within one paragraph. bool IsSelOnePara() const; + // Check if selection starts a paragraph. + bool IsSelStartPara() const; + /* * Returns SRectangle, at which the cursor is located. */ diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 1dc75f7f352c..e90b2b0278f5 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -350,7 +350,7 @@ private: SwFrameFormat* ); sal_Int8 SetFlyFrameAnchor( SwFrameFormat& rFlyFormat, SfxItemSet& rSet, bool bNewFrames ); - typedef SwFormat* (SwDoc::*FNCopyFormat)( const OUString&, SwFormat*, bool, bool ); + typedef SwFormat* (SwDoc::*FNCopyFormat)( const OUString&, SwFormat*, bool ); SwFormat* CopyFormat( const SwFormat& rFormat, const SwFormatsBase& rFormatArr, FNCopyFormat fnCopyFormat, const SwFormat& rDfltFormat ); void CopyFormatArr( const SwFormatsBase& rSourceArr, SwFormatsBase const & rDestArr, @@ -391,11 +391,11 @@ private: DECL_LINK( DoUpdateModifiedOLE, Timer *, void ); public: - SW_DLLPUBLIC SwFormat *MakeCharFormat_(const OUString &, SwFormat *, bool, bool ); - SwFormat *MakeFrameFormat_(const OUString &, SwFormat *, bool, bool ); + SW_DLLPUBLIC SwFormat *MakeCharFormat_(const OUString &, SwFormat *, bool ); + SwFormat *MakeFrameFormat_(const OUString &, SwFormat *, bool ); private: - SwFormat *MakeTextFormatColl_(const OUString &, SwFormat *, bool, bool ); + SwFormat *MakeTextFormatColl_(const OUString &, SwFormat *, bool ); private: OUString msDocAccTitle; diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index f29c4ed78134..858c778ac784 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -54,6 +54,7 @@ class SwDrawModel; class SwViewShell; class SwDocStyleSheetPool; class SwXTextDocument; +class SwTextFormatColl; namespace svt { class EmbeddedObjectRef; @@ -143,6 +144,8 @@ class SW_DLLPUBLIC SwDocShell SAL_DLLPRIVATE void Delete(const OUString &rName, SfxStyleFamily nFamily); SAL_DLLPRIVATE void Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden); + SAL_DLLPRIVATE bool MakeInlineHeading(SwWrtShell *pSh, SwTextFormatColl* pColl, + const sal_uInt16 nMode); SAL_DLLPRIVATE SfxStyleFamily ApplyStyles(const OUString &rName, const SfxStyleFamily nFamily, SwWrtShell* pShell, diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index d550f98c0386..e53dc2c743e6 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -212,7 +212,7 @@ class SwDocStyleSheetPool final : public SfxStyleSheetBasePool SwDoc& m_rDoc; bool m_bOrganizer : 1; ///< Organizer - virtual rtl::Reference Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits nMask) override; + virtual rtl::Reference Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits nMask, const OUString& rParentStyleSheetName) override; virtual rtl::Reference Create( const SfxStyleSheetBase& ) override; using SfxStyleSheetBasePool::Find; @@ -221,7 +221,8 @@ public: SwDocStyleSheetPool( SwDoc&, bool bOrganizer ); virtual SfxStyleSheetBase& Make(const OUString&, SfxStyleFamily, - SfxStyleSearchBits nMask = SfxStyleSearchBits::All) override; + SfxStyleSearchBits nMask = SfxStyleSearchBits::All, + const OUString& rParentStyleSheetName = u""_ustr) override; virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All ) override; diff --git a/sw/inc/pch/precompiled_vbaswobj.hxx b/sw/inc/pch/precompiled_vbaswobj.hxx index 88ac8570d5fe..4139cfe26b1b 100644 --- a/sw/inc/pch/precompiled_vbaswobj.hxx +++ b/sw/inc/pch/precompiled_vbaswobj.hxx @@ -117,7 +117,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 896a237b27c4..1752a167d149 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include namespace com::sun::star::accessibility { class XAccessible; } @@ -193,7 +193,6 @@ class SAL_DLLPUBLIC_RTTI SwViewShell : public sw::Ring protected: static ShellResource* spShellRes; ///< Resources for the Shell. - static vcl::DeleteOnDeinit< std::shared_ptr > spCareDialog; ///< Avoid this window. SwRect maVisArea; ///< The modern version of VisArea. tools::Rectangle maLOKVisibleArea;///< The visible area in the LibreOfficeKit client. @@ -477,8 +476,7 @@ public: static weld::Window* CareChildWin(SwViewShell const & rVSh); SW_DLLPUBLIC static void SetCareDialog(const std::shared_ptr& rNew); - static weld::Window* GetCareDialog(SwViewShell const & rVSh) - { return (*spCareDialog.get()) ? spCareDialog.get()->get() : CareChildWin(rVSh); } + static weld::Window* GetCareDialog(SwViewShell const & rVSh); SfxViewShell *GetSfxViewShell() const { return mpSfxViewShell; } void SetSfxViewShell(SfxViewShell *pNew) { mpSfxViewShell = pNew; } diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx index d15eeaf70da9..91295c1ce819 100644 --- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx +++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx @@ -31,7 +31,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckDocumentIssues) { createSwDoc("DocumentTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -44,7 +43,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testTableSplitMergeAndAltText) { createSwDoc("AccessibilityTests1.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -64,7 +62,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckParagraphIssues) // some text inside the paragraph createSwDoc("ParagraphTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -76,7 +73,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckBackgroundImage) { createSwDoc("BackgroundImageTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -88,7 +84,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckLinkedImage) { createSwDoc("LinkedImageTest.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -100,7 +95,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckNewlineSpace) { createSwDoc("NewlineTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -115,7 +109,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckSpacebarSpace) { createSwDoc("SpaceTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -129,7 +122,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testHyperlinks) { createSwDoc("HyperlinkTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -145,7 +137,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckHighlightedText) { createSwDoc("HighlightTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -159,7 +150,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testNumberingCheck) { createSwDoc("AccessibilityTests_NumberingCheck.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -175,7 +165,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeFootnote) { createSwDoc("FakeFootnoteTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -192,7 +181,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeCaption) { createSwDoc("FakeCaptionTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -204,7 +192,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTableFormatting) { createSwDoc("TableFormattingTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -216,7 +203,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTabsFormatting) { createSwDoc("TabsTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -238,7 +224,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTOCHyperlink) { createSwDoc("TOCHyperlinkTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -253,7 +238,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testDeleteHeader) // Delete Header from doc and check if we have less Direct format warning createSwDoc("DeleteHeader.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -268,7 +252,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testDeleteHeader) CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[6]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[7]->m_eIssueID); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // modify header @@ -293,7 +277,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testStylesWithHeader) // Check direct formats, char/para styles and not allowed page styles createSwDoc("PageCharParaStyles.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -332,7 +315,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTabsinTOC) { createSwDoc("Tabs-in-TOC.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -369,8 +351,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testOnlineNodeSplitAppend) createSwDoc("OnlineCheck.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // Enable online a11y checker diff --git a/sw/qa/core/attr/attr.cxx b/sw/qa/core/attr/attr.cxx index a1d35941d00b..fcb68493875f 100644 --- a/sw/qa/core/attr/attr.cxx +++ b/sw/qa/core/attr/attr.cxx @@ -33,8 +33,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSwAttrSet) { // Given a document with track changes and the whole document is selected: createSwDoc("attr-set.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); dispatchCommand(mxComponent, u".uno:Cut"_ustr, {}); diff --git a/sw/qa/core/crsr/crsr.cxx b/sw/qa/core/crsr/crsr.cxx index 2fa7439626d2..9bd9391e2259 100644 --- a/sw/qa/core/crsr/crsr.cxx +++ b/sw/qa/core/crsr/crsr.cxx @@ -90,8 +90,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testFindReplace) CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testSelAllStartsWithTable) { createSwDoc("sel-all-starts-with-table.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwDoc* pDoc = pDocShell->GetDoc(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); @@ -113,7 +112,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlLineBreak) { // Given a document with a (rich text) content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -126,7 +124,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlLineBreak) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When pressing "enter" in the middle of that content control: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/true); // Go after "t". pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 2, /*bBasicCall=*/false); @@ -145,7 +143,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlReadOnly) { // Given a document with a checkbox content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -160,7 +157,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlReadOnly) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When entering the content control: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -173,8 +170,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlReadOnly) CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testTdf135451) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Insert narrow no-break space and move the cursor right before it pWrtShell->Insert(u"a" + OUStringChar(CHAR_NNBSP) + "b"); @@ -194,8 +190,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testDropdownContentControl) { // Given a document with a dropdown content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST); // When entering the content control: @@ -212,8 +207,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlProtectedSection) { // Given a document with a date content control in a protected section: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DATE); pWrtShell->SelAll(); OUString aSectionName = pWrtShell->GetUniqueSectionName(); diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx index 80f149be88ac..4933451f4468 100644 --- a/sw/qa/core/doc/doc.cxx +++ b/sw/qa/core/doc/doc.cxx @@ -60,7 +60,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testMathInsertAnchorType) SwDoc* pDoc = getSwDoc(); // When inserting an a math object. - SwWrtShell* pShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pShell = getSwDocShell()->GetWrtShell(); SvGlobalName aGlobalName(SO3_SM_CLASSID); pShell->InsertObject(svt::EmbeddedObjectRef(), &aGlobalName); @@ -100,8 +100,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextboxTextRotateAngle) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testNumDownIndent) { createSwDoc("num-down-indent.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); @@ -124,8 +123,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBulletsOnSpaceOff) pAutoCorrect->GetSwFlags().bSetNumRuleAfterSpace = false; createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); @@ -148,8 +146,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBulletsOnSpace) pAutoCorrect->GetSwFlags().bSetNumRuleAfterSpace = true; createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); @@ -169,8 +166,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBulletsOnSpace) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testLocaleIndependentTemplate) { createSwDoc("locale-independent-template.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); SfxItemSet aSet(pWrtShell->GetAttrPool(), svl::Items); pWrtShell->GetCurAttr(aSet); @@ -208,11 +204,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxMakeFlyFrame) { // Given a document with an as-char textbox (as-char draw format + at-char fly format): createSwDoc("textbox-makeflyframe.docx"); - SwDoc* pDoc = getSwDoc(); // When cutting the textbox and pasting it to a new document: selectShape(1); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); rtl::Reference pTransfer = new SwTransferable(*pWrtShell); pTransfer->Cut(); @@ -246,7 +241,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testIMEGrouping) Scheduler::ProcessEventsToIdle(); // When pressing two keys via IME: - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); rEditWin.PostExtTextInputEvent(VclEventId::ExtTextInput, u"a"_ustr); rEditWin.PostExtTextInputEvent(VclEventId::EndExtTextInput, u""_ustr); @@ -297,7 +292,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testContentControlDelete) { // Given a document with a content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -310,7 +304,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testContentControlDelete) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When deleting the dummy character at the end of the content control: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->DelLeft(); diff --git a/sw/qa/core/draw/draw.cxx b/sw/qa/core/draw/draw.cxx index e796e7d3f392..5cefd05827ad 100644 --- a/sw/qa/core/draw/draw.cxx +++ b/sw/qa/core/draw/draw.cxx @@ -36,7 +36,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTextboxDeleteAsChar) // Load a document with an as-char shape in it that has a textbox and an image in it. createSwDoc("as-char-textbox.docx"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); sal_Int32 nActual = pPage->GetObjCount(); // 3 objects on the draw page: a shape + fly frame pair and a Writer image. @@ -63,7 +63,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTextboxUndoOrdNum) // - picture createSwDoc("textbox-undo-ordnum.docx"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); const auto& rFormats = *pDoc->GetSpzFrameFormats(); // Test the state before del + undo. for (const auto& pFormat : rFormats) diff --git a/sw/qa/core/edit/edit.cxx b/sw/qa/core/edit/edit.cxx index 71dcaae879a5..934cb6346d24 100644 --- a/sw/qa/core/edit/edit.cxx +++ b/sw/qa/core/edit/edit.cxx @@ -31,15 +31,14 @@ CPPUNIT_TEST_FIXTURE(Test, testRedlineHidden) { // Given a document with ShowRedlineChanges=false: createSwDoc("redline-hidden.fodt"); - SwDoc* pDoc = getSwDoc(); // When formatting a paragraph by setting the para adjust to center, then make sure setting the // new item set on the paragraph doesn't crash: - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); SfxItemSet aSet(pView->GetPool(), svl::Items); SvxAdjustItem aItem(SvxAdjust::Center, RES_PARATR_ADJUST); aSet.Put(aItem); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SetAttrSet(aSet, SetAttrMode::DEFAULT, nullptr, true); } @@ -60,8 +59,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDeleteSelNormalize) { // Given a read-only document with a fillable form, the placeholder text is selected: createSwDoc("delete-sel-normalize.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->GotoFormControl(/*bNext=*/true); diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx index 5ecb2ba06e0e..a9b11aca3322 100644 --- a/sw/qa/core/fields/fields.cxx +++ b/sw/qa/core/fields/fields.cxx @@ -60,7 +60,6 @@ CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip) { // Create a document with a bibliography reference in it. createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xFactory(mxComponent, uno::UNO_QUERY); uno::Reference xField( xFactory->createInstance(u"com.sun.star.text.TextField.Bibliography"_ustr), uno::UNO_QUERY); @@ -78,7 +77,7 @@ CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip) xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false); // Get the tooltip of the field. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); SwPaM* pCursor = pWrtShell->GetCursor(); auto pField = dynamic_cast( @@ -159,7 +158,7 @@ CPPUNIT_TEST_FIXTURE(Test, testChapterFieldsFollowedBy) CPPUNIT_TEST_FIXTURE(Test, testTdf86790) { - loadFromFile(u"tdf86790.docx"); + createSwDoc("tdf86790.docx"); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess( @@ -386,7 +385,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFootnoteStyleRef) /// STYLEREFs with the REFFLDFLAG_HIDE_NON_NUMERICAL flag should hide all characters that are not numerical or delimiters CPPUNIT_TEST_FIXTURE(Test, testNumericalStyleRef) { - loadFromFile(u"suppress-non-numerical.docx"); + createSwDoc("suppress-non-numerical.docx"); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess( @@ -416,7 +415,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNumericalStyleRef) /// this docx only has such stylerefs to avoid confusion) CPPUNIT_TEST_FIXTURE(Test, testOOXMLStyleRefFlags) { - loadFromFile(u"styleref-flags.docx"); + createSwDoc("styleref-flags.docx"); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess( @@ -447,6 +446,7 @@ CPPUNIT_TEST_FIXTURE(Test, testOOXMLStyleRefFlags) /// this docx only has such stylerefs to avoid confusion) CPPUNIT_TEST_FIXTURE(Test, testODFStyleRef) { + // if createSwDoc is used then calcLayout is called and the field values are different loadFromFile(u"styleref.odt"); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx index 058afa7b87a3..bfa776d98a86 100644 --- a/sw/qa/core/frmedt/frmedt.cxx +++ b/sw/qa/core/frmedt/frmedt.cxx @@ -44,15 +44,14 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testTextboxReanchor) { // Load a document with a textframe and a textbox(shape+textframe). createSwDoc("textbox-reanchor.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SdrPage* pDrawPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pDrawShape = pDrawPage->GetObj(1); CPPUNIT_ASSERT_EQUAL(u"draw shape"_ustr, pDrawShape->GetName()); // Select the shape of the textbox. Point aPoint; - SwWrtShell* pShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pShell = getSwDocShell()->GetWrtShell(); pShell->SelectObj(aPoint, /*nFlag=*/0, pDrawShape); // Anchor the shape of the textbox into its own textframe. @@ -98,11 +97,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testVertPosFromBottomBoundingBox) // Calculate the allowed bounding box of the shape, e.g. the shape's position & size dialog uses // this to limit the vertical position to sensible values. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRect aBoundRect; RndStdIds eAnchorType = RndStdIds::FLY_AT_CHAR; - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); const auto& rFrameFormats = *pDoc->GetFrameFormats(); const SwFormatAnchor* pFormatAhchor = &rFrameFormats[0]->GetAnchor(); sal_Int16 eHoriRelOrient = text::RelOrientation::PAGE_FRAME; @@ -125,8 +123,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testPasteFlyInTextBox) { // Given a document that contains a textbox, which contains an sw image (fly frame) createSwDoc("paste-fly-in-textbox.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); SwDoc* pDoc = pDocShell->GetDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); @@ -161,7 +158,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testTextBoxSelectCursorPos) SdrObject* pFlyObject = pPage->GetObj(1); SwContact* pFlyContact = static_cast(pFlyObject->GetUserCall()); CPPUNIT_ASSERT_EQUAL(static_cast(RES_FLYFRMFMT), pFlyContact->GetFormat()->Which()); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SelectObj(Point(), 0, pFlyObject); // Then make sure the cursor is the anchor of the draw format: diff --git a/sw/qa/core/layout/flycnt.cxx b/sw/qa/core/layout/flycnt.cxx index 3e9fcb981125..ec4cee9ed13a 100644 --- a/sw/qa/core/layout/flycnt.cxx +++ b/sw/qa/core/layout/flycnt.cxx @@ -733,9 +733,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyThenTable) uno::Sequence aFilterOptions = { comphelper::makePropertyValue(u"Hidden"_ustr, true), }; - mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/core/layout/data/") - + "floattable-then-table.docx", - u"com.sun.star.text.TextDocument"_ustr, aFilterOptions); + loadWithParams(createFileURL(u"floattable-then-table.docx"), aFilterOptions); // When layout is calculated during PDF export: // Then make sure that finishes without errors: diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 45756891d3bf..3a9e06de4caa 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -93,8 +93,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBorderCollapseCompat) // Load a document with a border conflict: top cell has a dotted bottom border, bottom cell has // a solid upper border. createSwDoc("border-collapse-compat.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump aDumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); @@ -113,8 +112,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrTableRowSpan) // Load a document which has a table. The A1 cell has btlr text direction, and the A1..A3 cells // are merged. createSwDoc("btlr-table-row-span.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump aDumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); @@ -149,8 +147,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTablesMoveBackwards) { // Load a document with 1 pages: empty content on first page, then 21 tables on the second page. createSwDoc("tables-move-backwards.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); // Delete the content on the first page. @@ -220,8 +217,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxNotModifiedOnOpen) // tdf#138050: a freshly opened document containing a shape with a text box // should not appear to be modified createSwDoc("textbox-phantom-change.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); // Without the fix in place this test would have shown that the document // was modified due to a fix to tdf#135198 @@ -231,8 +227,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxNotModifiedOnOpen) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxAutoGrowVertical) { createSwDoc("textbox-autogrow-vertical.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pShape = pPage->GetObj(0); tools::Rectangle aShapeRect = pShape->GetCurrentBoundRect(); @@ -253,8 +248,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification) { // Load a document with a textbox in it: the layout will have to position the shape part. createSwDoc("textbox-modification.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); // Without the accompanying fix in place, this test would have failed, as the document was // marked as modified right after the import. @@ -280,8 +274,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell) { // Load a document with a nested table, the inner A1 cell has a btlr text direction. createSwDoc("btlr-nested-cell.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); SwFrame* pPage = pLayout->GetLower(); SwFrame* pBody = pPage->GetLower(); @@ -378,7 +371,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMirrorMargin) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->InsertPageBreak(); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); @@ -438,7 +431,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMarginPageBorder) #if !defined(MACOSX) && !defined(_WIN32) // Given a document with a non-0 gutter margin. createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xStandard( getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), uno::UNO_QUERY); sal_Int32 nGutterMm100 = 2000; @@ -451,7 +443,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMarginPageBorder) xStandard->setPropertyValue(u"LeftBorder"_ustr, uno::Any(aBorder)); // Then make sure border is at the left edge of the text area. - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); @@ -473,8 +465,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testVerticallyMergedCellBorder) { // Given a document with a table: 2 columns, 5 rows. B2 -> B5 is merged: createSwDoc("vmerge-cell-border.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // When rendering the table: std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -553,8 +544,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testLinkedBullet) { // Given a document with a graphic bullet, where the image is a linked one: createSwDoc("linked-bullet.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // When rendering that document: std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -573,8 +563,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testInnerCellBorderIntersect) { // Given a table with both outer and inner borders: createSwDoc("inner-border.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // When rendering table borders: std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -689,8 +678,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoubleBorderVertical) { // Given a table with a left and right double border, outer is thick, inner is thin: createSwDoc("double-border-vertical.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // When rendering that document: std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -738,8 +726,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoubleBorderHorizontal) { // Given a table with a top and bottom double border, outer is thin, inner is thick: createSwDoc("double-border-horizontal.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // When rendering table borders: std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -787,8 +774,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testParaBorderInCellClip) { // Given a document which has outside-cell borders defined, which should not be visible: createSwDoc("para-border-in-cell-clip.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // When rendering those borders: std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -808,8 +794,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoublePageBorder) { // Given a page with a top and bottom double border, outer is thick, inner is thin: createSwDoc("double-page-border.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // When rendering that document: std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -862,8 +847,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testNegativePageBorder) // Given a document with a top margin and a negative border distance: createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert(u"test"_ustr); uno::Reference xPageStyle( @@ -905,8 +889,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testNegativePageBorderNoMargin) // Given a document with no top margin and a negative border distance: createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert(u"test"_ustr); uno::Reference xPageStyle( @@ -942,7 +925,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testFollowTextFlowWrapInBackground) createSwDoc(); SwDoc* pDoc = getSwDoc(); pDoc->getIDocumentSettingAccess().set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING, true); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0); pWrtShell->InsertTable(aTableOptions, 1, 1); pWrtShell->MoveTable(GotoPrevTable, fnTableStart); @@ -975,13 +958,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testPageRemoveFlyTable) { // Given a document with a ToC and several tables, one table marked with a bookmark: createSwDoc("page-remove-fly-table.odt"); - SwDoc* pDoc = getSwDoc(); // When updating the ToC and incrementally formatting the document: - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); SfxDispatcher& rDispatcher = *pView->GetViewFrame().GetDispatcher(); rDispatcher.Execute(FN_UPDATE_TOX); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Reformat(); // Then make sure that the 2nd table below the bookmark has no unwanted top margin: @@ -1014,7 +996,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testNewFollowTextFlowWrapInBackground) // through and follow-text-flow set to true, legacy USE_FORMER_TEXT_WRAPPING is not set: createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0); pWrtShell->InsertTable(aTableOptions, 1, 1); pWrtShell->MoveTable(GotoPrevTable, fnTableStart); diff --git a/sw/qa/core/layout/paintfrm.cxx b/sw/qa/core/layout/paintfrm.cxx index e859cd293710..cddb43f4b80d 100644 --- a/sw/qa/core/layout/paintfrm.cxx +++ b/sw/qa/core/layout/paintfrm.cxx @@ -31,8 +31,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitTableBorder) { // Given a document with a split table, table borders are defined, but cell borders are not: createSwDoc("split-table-border.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // When rendering that document: std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -74,8 +73,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRTLBorderMerge) { // Given a document with an RTL table: createSwDoc("rtl-table.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // When rendering that document: std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -115,8 +113,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitTableMergedBorder) { // Given a document with a split table, first row in frame 1 has merged cells: createSwDoc("split-table-merged-border.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // When rendering that document: std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx b/sw/qa/core/objectpositioning/objectpositioning.cxx index ee2b090dba7e..565a3fe4fca6 100644 --- a/sw/qa/core/objectpositioning/objectpositioning.cxx +++ b/sw/qa/core/objectpositioning/objectpositioning.cxx @@ -57,8 +57,7 @@ CPPUNIT_TEST_FIXTURE(Test, testOverlapCrash) uno::Any(text::TextContentAnchorType_AT_CHARACTER)); // Insert a new paragraph at the start. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); // Without the accompanying fix in place, this test would have crashed. pWrtShell->SplitNode(); diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx index 79d017058095..dea8ddcc9489 100644 --- a/sw/qa/core/text/itrform2.cxx +++ b/sw/qa/core/text/itrform2.cxx @@ -207,8 +207,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCheckedCheckboxContentControlPDF) SwExportFormFieldsGuard g; // Given a file with a checked checkbox content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX); // Toggle it, so we get a checked one: SwTextContentControl* pTextContentControl = pWrtShell->CursorInsideContentControl(); diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 9aa6d279e84d..40bdcca07b5f 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -62,8 +62,7 @@ public: CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testFootnoteConnect) { createSwDoc("footnote-connect.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Jump to the start of the next page. pWrtShell->SttNxtPg(); // Remove the page break. @@ -93,9 +92,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testSemiTransparentText) xTextRange->setString(u"x"_ustr); // Render the document to a metafile. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); CPPUNIT_ASSERT(pDocShell); std::shared_ptr xMetaFile = pDocShell->GetPreviewMetaFile(); CPPUNIT_ASSERT(xMetaFile); @@ -139,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf156146) getProperty(getParagraph(1), u"ParaRightMargin"_ustr)); SwTextFrame* const pFrame(dynamic_cast( - static_cast(getSwDoc()->GetDocShell()->GetWrtShell()->GetLayout()->GetLower()) + static_cast(getSwDocShell()->GetWrtShell()->GetLayout()->GetLower()) ->FindFirstBodyContent())); CPPUNIT_ASSERT(pFrame); // this appears to be the only way to get the actual computed margins @@ -171,7 +168,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf159903) getProperty(getParagraph(1), u"ParaRightMargin"_ustr)); SwTextFrame* const pFrame(dynamic_cast( - static_cast(getSwDoc()->GetDocShell()->GetWrtShell()->GetLayout()->GetLower()) + static_cast(getSwDocShell()->GetWrtShell()->GetLayout()->GetLower()) ->FindFirstBodyContent())); CPPUNIT_ASSERT(pFrame); // this appears to be the only way to get the actual computed margins @@ -572,8 +569,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLineWidth) { // Given a document with an as-char image, width in twips not fitting into sal_uInt16: createSwDoc("line-width.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); sal_Int32 nOldLeft = pWrtShell->GetCharRect().Left(); // When moving the cursor to the right: @@ -881,7 +877,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testAsCharImageDocModelFromViewPoint) { // Given a document with an as-char image: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xFactory(mxComponent, uno::UNO_QUERY); uno::Reference xTextGraphic( xFactory->createInstance(u"com.sun.star.text.TextGraphicObject"_ustr), uno::UNO_QUERY); @@ -893,7 +888,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testAsCharImageDocModelFromViewPoint) uno::Reference xCursor(xBodyText->createTextCursor()); uno::Reference xTextContent(xTextGraphic, uno::UNO_QUERY); xBodyText->insertTextContent(xCursor, xTextContent, false); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pRootFrame = pWrtShell->GetLayout(); SwFrame* pPageFrame = pRootFrame->GetLower(); SwFrame* pBodyFrame = pPageFrame->GetLower(); @@ -926,7 +921,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRedlineDelete) // Given a document with A4 paper size, some text, redlining on, but hidden: createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); { // Set page size to A4. @@ -966,11 +961,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRedlineDelete) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf120715_CursorMoveWhenTypingSpaceAtCenteredLineEnd) { createSwDoc("tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Make a paint to force the call of AddExtraBlankWidth, that calculate width for holePortions. - pDoc->GetDocShell()->GetPreviewBitmap(); + getSwDocShell()->GetPreviewBitmap(); // Move the cursor to the last character of the document. pWrtShell->EndOfSection(); @@ -989,11 +983,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf43100_CursorMoveToSpacesOverMargin) // - alignment (left, center, right, justified), // - line count (1 line, 2 lines, blank line containing only spaces) createSwDoc("tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Make a paint to force the call of AddExtraBlankWidth, that calculate width for holePortions. - pDoc->GetDocShell()->GetPreviewBitmap(); + getSwDocShell()->GetPreviewBitmap(); // Move the cursor to the 2. line. pWrtShell->Down(/*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -1042,8 +1035,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPDF) SwExportFormFieldsGuard g; // Given a file with a content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -1090,8 +1082,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPlaceholderPDF) SwExportFormFieldsGuard g; // Given a file with a content control, in placeholder mode: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT); // When exporting to PDF: @@ -1119,8 +1110,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testCheckboxContentControlPDF) SwExportFormFieldsGuard g; // Given a file with a checkbox content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX); // When exporting to PDF: @@ -1150,8 +1140,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testDropdownContentControlPDF) SwExportFormFieldsGuard g; // Given a file with a dropdown content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST); // When exporting to PDF: @@ -1206,8 +1195,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testDateContentControlPDF) SwExportFormFieldsGuard g; // Given a file with a date content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DATE); // When exporting to PDF: @@ -1240,8 +1228,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPDFFont) SwExportFormFieldsGuard g; // Given a document with a custom 24pt font size and a content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SfxItemSetFixed aSet(pWrtShell->GetAttrPool()); SvxFontHeightItem aItem(480, 100, RES_CHRATR_FONTSIZE); aSet.Put(aItem); @@ -1273,8 +1260,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testComboContentControlPDF) SwExportFormFieldsGuard g; // Given a file with a combo box content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::COMBO_BOX); // When exporting to PDF: @@ -1305,8 +1291,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRichContentControlPDF) SwExportFormFieldsGuard g; // Given a file with a rich content control, its value set to "xxxyyy": createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -1411,8 +1396,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf41652NBSPWidth) // Measure the X position of sections after NBSPs in a legacy file (no option value set) { createSwDoc("tdf41652_legacy.fodt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump aDumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); @@ -1424,8 +1408,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf41652NBSPWidth) // Measure the X of sections after NBSPs in a file with the option enabled { createSwDoc("tdf41652_variableNBSPdisabled.fodt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump aDumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); @@ -1439,8 +1422,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf41652NBSPWidth) // Measure the X of the sections after NBSPs in a file with the option enabled { createSwDoc("tdf41652_variableNBSPenabled.fodt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump aDumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); @@ -1624,8 +1606,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf129810) createSwDoc("tdf129810.odt"); // Render the document to a metafile. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); CPPUNIT_ASSERT(xMetaFile); diff --git a/sw/qa/core/theme/ThemeTest.cxx b/sw/qa/core/theme/ThemeTest.cxx index a71ca9caad5d..7ae4e2fa2bbf 100644 --- a/sw/qa/core/theme/ThemeTest.cxx +++ b/sw/qa/core/theme/ThemeTest.cxx @@ -45,8 +45,6 @@ public: CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeColorInHeading) { createSwDoc("ThemeColorInHeading.docx"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); auto xComplexColor = getProperty>(getParagraph(1), u"CharComplexColor"_ustr); @@ -57,8 +55,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeColorInHeading) CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeColorInHeadingODT) { createSwDoc("ThemeColorInHeading.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); auto xComplexColor = getProperty>(getParagraph(1), u"CharComplexColor"_ustr); @@ -341,7 +337,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testDrawPageThemeExistsDOCX) { createSwDoc("ThemeColorInHeading.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SdrModel* pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); CPPUNIT_ASSERT(pModel); @@ -387,7 +382,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testDrawPageThemeExistsODT) { createSwDoc("ThemeColorInHeading.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SdrModel* pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); CPPUNIT_ASSERT(pModel); @@ -415,8 +409,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeChanging) { createSwDoc("ThemeColorInHeading.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SdrModel* pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); CPPUNIT_ASSERT(pModel); @@ -440,7 +433,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeChanging) // check that the theme colors are as expected CPPUNIT_ASSERT_EQUAL(u"LibreOffice"_ustr, pNewColorSet->getName()); - sw::ThemeColorChanger aChanger(pDoc->GetDocShell()); + sw::ThemeColorChanger aChanger(getSwDocShell()); aChanger.apply(pNewColorSet); } @@ -558,7 +551,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testTdf162715_customTransferable) createSwDoc("theme_foo.fodt"); auto pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); auto pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); CPPUNIT_ASSERT(pModel); @@ -570,7 +562,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testTdf162715_customTransferable) CPPUNIT_ASSERT_EQUAL(Color(0x008000), pTheme->GetColor(model::ThemeColorType::Dark2)); // Select all and check the original text in the document: - auto pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + auto pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SelAll(); CPPUNIT_ASSERT_EQUAL(u"Theme foo"_ustr, pWrtShell->GetSelText()); @@ -605,7 +597,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testTdf162715_ownTransferable) createSwDoc("theme_bar.odt"); auto pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); auto pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); CPPUNIT_ASSERT(pModel); @@ -617,7 +608,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testTdf162715_ownTransferable) CPPUNIT_ASSERT_EQUAL(Color(0x800000), pTheme->GetColor(model::ThemeColorType::Dark2)); // Select all and check the original text in the document: - auto pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + auto pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SelAll(); CPPUNIT_ASSERT_EQUAL(u"Theme bar"_ustr, pWrtShell->GetSelText()); @@ -632,7 +623,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testTdf162715_ownTransferable) createSwDoc("theme_foo.fodt"); auto pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); auto pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); CPPUNIT_ASSERT(pModel); @@ -644,7 +634,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testTdf162715_ownTransferable) CPPUNIT_ASSERT_EQUAL(Color(0x008000), pTheme->GetColor(model::ThemeColorType::Dark2)); // Select all and check the original text in the second document: - auto pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + auto pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SelAll(); CPPUNIT_ASSERT_EQUAL(u"Theme foo"_ustr, pWrtShell->GetSelText()); diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx index 5d430400faf6..beea0c986c1e 100644 --- a/sw/qa/core/txtnode/txtnode.cxx +++ b/sw/qa/core/txtnode/txtnode.cxx @@ -59,8 +59,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testBtlrCellChinese) // tbrl ("Chinese") directions. Make sure that Chinese text is handled the same way in the btlr // case as it's handled in the Latin case. createSwDoc("btlr-cell-chinese.doc"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); @@ -79,8 +78,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testSpecialInsertAfterMergedCells) createSwDoc("special-insert-after-merged-cells.fodt"); SwDoc* pDoc = getSwDoc(); SwNodeOffset const nNodes(pDoc->GetNodes().Count()); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); SwWrtShell* pWrtShell = pShell->GetWrtShell(); // go to the merged cell pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -101,8 +99,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testSpecialInsertAfterMergedCells) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor) { createSwDoc("textbox-copy-anchor.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); SwWrtShell* pWrtShell = pShell->GetWrtShell(); SwDoc aClipboard; pWrtShell->SelAll(); @@ -129,8 +126,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxNodeSplit) { createSwDoc("textbox-node-split.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); SwWrtShell* pWrtShell = pShell->GetWrtShell(); pWrtShell->SttEndDoc(/*bStart=*/false); // Without the accompanying fix in place, this would have crashed in @@ -175,7 +171,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTitleFieldInvalidate) createSwDoc("title-field-invalidate.fodt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); pTextDoc->initializeForTiledRendering({}); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); SwDoc* pDoc = pShell->GetDoc(); SwWrtShell* pWrtShell = pShell->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); @@ -209,8 +205,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testFlyAnchorUndo) { // Given a document with a fly frame, anchored after the last char of the document: createSwDoc("fly-anchor-undo.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pShell = pTextDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); SwDoc* pDoc = pShell->GetDoc(); const auto& rSpz = *pDoc->GetSpzFrameFormats(); sal_Int32 nExpected = rSpz[0]->GetAnchor().GetAnchorContentOffset(); @@ -234,8 +229,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testSplitNodeSuperscriptCopy) { // Given a document with superscript text at the end of a paragraph: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"1st"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 2, /*bBasicCall=*/false); SfxItemSetFixed aSet(pWrtShell->GetAttrPool()); @@ -271,7 +265,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testSplitNodeSuperscriptCopy) * dispatchCommand(mxComponent, ".uno:InsertField", aArgs); * * SwDoc* pDoc = getSwDoc(); - * SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + * SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); * SwPosition& rCursor = *pWrtShell->GetCursor()->GetPoint(); * SwTextNode* pTextNode = rCursor.GetNode().GetTextNode(); * std::vector aAttrs @@ -301,8 +295,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testInsertDropDownContentControlTwice) { // Given an already selected dropdown content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST); // When trying to insert an inner one, make sure that we don't crash: @@ -313,8 +306,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testCheckboxContentControlKeyboard) { // Given an already selected checkbox content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX); SwEditWin& rEditWin = pWrtShell->GetView().GetEditWin(); @@ -338,8 +330,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testDropdownContentControlKeyboard) { // Given an already selected dropdown content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST); // When checking if alt-down should open a popup: @@ -360,8 +351,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testPictureContentControlKeyboard) { // Given an already selected picture content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::PICTURE); pWrtShell->GotoObj(/*bNext=*/true, GotoObjFlags::Any); @@ -389,8 +379,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testDateContentControlKeyboard) { // Given an already selected date content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DATE); // When checking if alt-down should open a popup: @@ -412,7 +401,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testContentControlCopy) // Given a document with a content control: createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX); // When copying that content control: diff --git a/sw/qa/core/undo/undo.cxx b/sw/qa/core/undo/undo.cxx index 5c5d43212dac..0857f3c232de 100644 --- a/sw/qa/core/undo/undo.cxx +++ b/sw/qa/core/undo/undo.cxx @@ -32,8 +32,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutSave) { // Load the document and select all. createSwDoc("textbox-cut-save.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->SelAll(); @@ -58,8 +57,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutSave) CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutUndo) { createSwDoc("textbox-cut-undo.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); SwDoc* pDoc = pDocShell->GetDoc(); @@ -85,8 +83,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTableCopyRedline) { // Given a document with two table cells and redlining enabled: createSwDoc("table-copy-redline.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); // When doing select-all, copy, paste and undo: @@ -104,7 +101,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testImagePropsCreateUndoAndModifyDoc) { createSwDoc("image-as-character.odt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); css::uno::Reference xImage( pTextDoc->getGraphicObjects()->getByName(u"Image1"_ustr), css::uno::UNO_QUERY_THROW); diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index 69e136b520dd..9e27428717b0 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -50,9 +50,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf119081) { // Load a doc with a nested table in it. createSwDoc("tdf119081.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); // Enter outer A1. @@ -271,7 +269,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testLineBreakInsert) xText->insertTextContent(xCursor, xLineBreak, /*bAbsorb=*/false); // Then make sure that both the line break and its matching text attribute is inserted: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwNodeOffset nIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex(); SwTextNode* pTextNode = pDoc->GetNodes()[nIndex]->GetTextNode(); // Without the accompanying fix in place, this test would have failed with: @@ -367,7 +365,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlInsert) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // Then make sure that the text attribute is inserted: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwNodeOffset nIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex(); SwTextNode* pTextNode = pDoc->GetNodes()[nIndex]->GetTextNode(); SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL); @@ -420,7 +418,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlTextPortionEnum) { // Given a document with a content control around one or more text portions: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -465,7 +462,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlTextPortionEnum) // Also test the doc model, make sure that there is a dummy character at the start and end, so // the user can explicitly decide if they want to expand the content control or not: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); OUString aText = pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText(); // Without the accompanying fix in place, this test would have failed with: // - Expected: ^Atest^A @@ -478,7 +475,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlCheckbox) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a checkbox content control: uno::Reference xMSF(mxComponent, uno::UNO_QUERY); @@ -500,7 +496,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlCheckbox) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // Then make sure that the specified properties are set: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL); auto pTextContentControl = static_txtattr_cast(pAttr); @@ -517,7 +513,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlDropdown) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a dropdown content control: uno::Reference xMSF(mxComponent, uno::UNO_QUERY); @@ -552,7 +547,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlDropdown) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // Then make sure that the specified properties are set: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL); auto pTextContentControl = static_txtattr_cast(pAttr); @@ -595,7 +590,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlPicture) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a picture content control: uno::Reference xMSF(mxComponent, uno::UNO_QUERY); @@ -619,7 +613,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlPicture) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // Then make sure that the specified properties are set: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL); auto pTextContentControl = static_txtattr_cast(pAttr); @@ -633,7 +627,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlDate) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a date content control: uno::Reference xMSF(mxComponent, uno::UNO_QUERY); @@ -672,7 +665,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlDate) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // Then make sure that the specified properties are set: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL); auto pTextContentControl = static_txtattr_cast(pAttr); @@ -720,7 +713,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlPlainText) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // Then make sure that the text attribute is inserted: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwNodeOffset nIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex(); SwTextNode* pTextNode = pDoc->GetNodes()[nIndex]->GetTextNode(); SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL); @@ -756,7 +749,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlComboBox) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a combobox content control: uno::Reference xMSF(mxComponent, uno::UNO_QUERY); @@ -792,7 +784,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlComboBox) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // Then make sure that the specified properties are set: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL); auto pTextContentControl = static_txtattr_cast(pAttr); diff --git a/sw/qa/core/view/view.cxx b/sw/qa/core/view/view.cxx index b130827deb8d..c7eb80762a8f 100644 --- a/sw/qa/core/view/view.cxx +++ b/sw/qa/core/view/view.cxx @@ -42,7 +42,7 @@ CPPUNIT_TEST_FIXTURE(Test, testUpdateOleObjectPreviews) // Given a document with two embedded objects, both with broken native data: createSwDoc("update-ole-object-previews.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // When updating the previews of those embedded objects (right after document load, before // painting the OLE objects): diff --git a/sw/qa/extras/autocorrect/autocorrect.cxx b/sw/qa/extras/autocorrect/autocorrect.cxx index 59935d54edc2..6f57a53b52f6 100644 --- a/sw/qa/extras/autocorrect/autocorrect.cxx +++ b/sw/qa/extras/autocorrect/autocorrect.cxx @@ -341,8 +341,7 @@ CPPUNIT_TEST_FIXTURE(SwAutoCorrectTest, testFieldMark) // getString also strips it out, use GetText instead createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); // don't autocapitalize after a field mark diff --git a/sw/qa/extras/fodfexport/fodfexport.cxx b/sw/qa/extras/fodfexport/fodfexport.cxx index a24c0c6d63b0..97d9bcdfca5b 100644 --- a/sw/qa/extras/fodfexport/fodfexport.cxx +++ b/sw/qa/extras/fodfexport/fodfexport.cxx @@ -25,7 +25,7 @@ public: CPPUNIT_TEST_FIXTURE(Test, testTdf113696) { - loadFromFile(u"tdf113696.odt"); + createSwDoc("tdf113696.odt"); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); @@ -42,7 +42,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf113696) CPPUNIT_TEST_FIXTURE(Test, testTdf113696WriterImage) { - loadFromFile(u"tdf113696-writerimage.odt"); + createSwDoc("tdf113696-writerimage.odt"); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 67f183c54728..fa60bf574f66 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -172,9 +172,7 @@ void Test::testLinkedGraphicRT() // Export the document and import again for a check saveAndReload(rFilterName); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pDoc); SwNodes& aNodes = pDoc->GetNodes(); @@ -200,7 +198,7 @@ void Test::testLinkedGraphicRT() CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_uLong(864900), aGraphic.GetSizeBytes()); // Check if linked graphic is registered in LinkManager - SwEditShell* const pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell()); + SwEditShell* const pEditShell(getSwDoc()->GetEditShell()); CPPUNIT_ASSERT(pEditShell); sfx2::LinkManager& rLinkManager = pEditShell->GetLinkManager(); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), size_t(1), rLinkManager.GetLinks().size()); @@ -843,60 +841,6 @@ void Test::testSkipImages() } #endif -auto verifyNestedFieldmark(OUString const& rTestName, - uno::Reference const& xComponent) -> void -{ - SwDoc const*const pDoc(dynamic_cast(*xComponent).GetDocShell()->GetDoc()); - IDocumentMarkAccess const& rIDMA(*pDoc->getIDocumentMarkAccess()); - - // no spurious bookmarks have been created - CPPUNIT_ASSERT_EQUAL_MESSAGE(rTestName.toUtf8().getStr(), - sal_Int32(0), rIDMA.getBookmarksCount()); - - // check inner fieldmark - SwNodeIndex const node1(*pDoc->GetNodes().GetEndOfContent().StartOfSectionNode(), +2); - SwPosition const innerPos(*node1.GetNode().GetTextNode(), - node1.GetNode().GetTextNode()->GetText().indexOf(CH_TXT_ATR_FIELDSTART)); - CPPUNIT_ASSERT_EQUAL_MESSAGE(rTestName.toUtf8().getStr(), - sal_Int32(1), innerPos.GetContentIndex()); - ::sw::mark::Fieldmark *const pInner(rIDMA.getFieldmarkAt(innerPos)); - CPPUNIT_ASSERT_MESSAGE(rTestName.toUtf8().getStr(), pInner); - OUString const innerString(SwPaM(pInner->GetMarkPos(), pInner->GetOtherMarkPos()).GetText()); - CPPUNIT_ASSERT_EQUAL_MESSAGE(rTestName.toUtf8().getStr(), OUString( - OUStringChar(CH_TXT_ATR_FIELDSTART) + u" QUOTE \"foo " + OUStringChar(CH_TXTATR_NEWLINE) - + u" bar " + OUStringChar(CH_TXTATR_NEWLINE) - + u"baz\" " + OUStringChar(CH_TXT_ATR_FIELDSEP) + u"foo " + OUStringChar(CH_TXTATR_NEWLINE) - + u" bar " + OUStringChar(CH_TXTATR_NEWLINE) - + u"baz" + OUStringChar(CH_TXT_ATR_FIELDEND)), innerString); - - // check outer fieldmark - SwNodeIndex const node2(node1, -1); - SwPosition const outerPos(*node2.GetNode().GetTextNode(), - node2.GetNode().GetTextNode()->GetText().indexOf(CH_TXT_ATR_FIELDSTART)); - CPPUNIT_ASSERT_EQUAL_MESSAGE(rTestName.toUtf8().getStr(), - sal_Int32(0), outerPos.GetContentIndex()); - ::sw::mark::Fieldmark const*const pOuter(rIDMA.getFieldmarkAt(outerPos)); - CPPUNIT_ASSERT_MESSAGE(rTestName.toUtf8().getStr(), pOuter); - OUString const outerString(SwPaM(pOuter->GetMarkPos(), pOuter->GetOtherMarkPos()).GetText()); - CPPUNIT_ASSERT_EQUAL_MESSAGE(rTestName.toUtf8().getStr(), OUString( - OUStringChar(CH_TXT_ATR_FIELDSTART) + u" QUOTE \"foo " + OUStringChar(CH_TXTATR_NEWLINE) - + u" " + OUStringChar(CH_TXT_ATR_FIELDSTART) + u" QUOTE \"foo " + OUStringChar(CH_TXTATR_NEWLINE) - + u" bar " + OUStringChar(CH_TXTATR_NEWLINE) - + u"baz\" " + OUStringChar(CH_TXT_ATR_FIELDSEP) + u"foo " + OUStringChar(CH_TXTATR_NEWLINE) - + u" bar " + OUStringChar(CH_TXTATR_NEWLINE) - + u"baz" + OUStringChar(CH_TXT_ATR_FIELDEND) + OUStringChar(CH_TXTATR_NEWLINE) - + u"bar " + OUStringChar(CH_TXTATR_NEWLINE) - + u"baz\" " + OUStringChar(CH_TXT_ATR_FIELDSEP) + u"foo " + OUStringChar(CH_TXTATR_NEWLINE) - + u" foo " + OUStringChar(CH_TXTATR_NEWLINE) - + u" bar " + OUStringChar(CH_TXTATR_NEWLINE) - + u"baz" + OUStringChar(CH_TXTATR_NEWLINE) - + u"bar " + OUStringChar(CH_TXTATR_NEWLINE) - + u"baz" + OUStringChar(CH_TXT_ATR_FIELDEND)), outerString); - - // must return innermost mark - CPPUNIT_ASSERT_EQUAL(pInner, rIDMA.getInnerFieldmarkFor(innerPos)); -} - void Test::testNestedFieldmark() { // experimental config setting @@ -911,6 +855,58 @@ void Test::testNestedFieldmark() officecfg::Office::Common::Filter::Microsoft::Import::ForceImportWWFieldsAsGenericFields::set(true, pBatch); pBatch->commit(); + auto verify = [this](OUString const& rTestName) { + SwDoc* pDoc = getSwDoc(); + IDocumentMarkAccess const& rIDMA(*pDoc->getIDocumentMarkAccess()); + + // no spurious bookmarks have been created + CPPUNIT_ASSERT_EQUAL_MESSAGE(rTestName.toUtf8().getStr(), + sal_Int32(0), rIDMA.getBookmarksCount()); + + // check inner fieldmark + SwNodeIndex const node1(*pDoc->GetNodes().GetEndOfContent().StartOfSectionNode(), +2); + SwPosition const innerPos(*node1.GetNode().GetTextNode(), + node1.GetNode().GetTextNode()->GetText().indexOf(CH_TXT_ATR_FIELDSTART)); + CPPUNIT_ASSERT_EQUAL_MESSAGE(rTestName.toUtf8().getStr(), + sal_Int32(1), innerPos.GetContentIndex()); + ::sw::mark::Fieldmark *const pInner(rIDMA.getFieldmarkAt(innerPos)); + CPPUNIT_ASSERT_MESSAGE(rTestName.toUtf8().getStr(), pInner); + OUString const innerString(SwPaM(pInner->GetMarkPos(), pInner->GetOtherMarkPos()).GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE(rTestName.toUtf8().getStr(), OUString( + OUStringChar(CH_TXT_ATR_FIELDSTART) + u" QUOTE \"foo " + OUStringChar(CH_TXTATR_NEWLINE) + + u" bar " + OUStringChar(CH_TXTATR_NEWLINE) + + u"baz\" " + OUStringChar(CH_TXT_ATR_FIELDSEP) + u"foo " + OUStringChar(CH_TXTATR_NEWLINE) + + u" bar " + OUStringChar(CH_TXTATR_NEWLINE) + + u"baz" + OUStringChar(CH_TXT_ATR_FIELDEND)), innerString); + + // check outer fieldmark + SwNodeIndex const node2(node1, -1); + SwPosition const outerPos(*node2.GetNode().GetTextNode(), + node2.GetNode().GetTextNode()->GetText().indexOf(CH_TXT_ATR_FIELDSTART)); + CPPUNIT_ASSERT_EQUAL_MESSAGE(rTestName.toUtf8().getStr(), + sal_Int32(0), outerPos.GetContentIndex()); + ::sw::mark::Fieldmark const*const pOuter(rIDMA.getFieldmarkAt(outerPos)); + CPPUNIT_ASSERT_MESSAGE(rTestName.toUtf8().getStr(), pOuter); + OUString const outerString(SwPaM(pOuter->GetMarkPos(), pOuter->GetOtherMarkPos()).GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE(rTestName.toUtf8().getStr(), OUString( + OUStringChar(CH_TXT_ATR_FIELDSTART) + u" QUOTE \"foo " + OUStringChar(CH_TXTATR_NEWLINE) + + u" " + OUStringChar(CH_TXT_ATR_FIELDSTART) + u" QUOTE \"foo " + OUStringChar(CH_TXTATR_NEWLINE) + + u" bar " + OUStringChar(CH_TXTATR_NEWLINE) + + u"baz\" " + OUStringChar(CH_TXT_ATR_FIELDSEP) + u"foo " + OUStringChar(CH_TXTATR_NEWLINE) + + u" bar " + OUStringChar(CH_TXTATR_NEWLINE) + + u"baz" + OUStringChar(CH_TXT_ATR_FIELDEND) + OUStringChar(CH_TXTATR_NEWLINE) + + u"bar " + OUStringChar(CH_TXTATR_NEWLINE) + + u"baz\" " + OUStringChar(CH_TXT_ATR_FIELDSEP) + u"foo " + OUStringChar(CH_TXTATR_NEWLINE) + + u" foo " + OUStringChar(CH_TXTATR_NEWLINE) + + u" bar " + OUStringChar(CH_TXTATR_NEWLINE) + + u"baz" + OUStringChar(CH_TXTATR_NEWLINE) + + u"bar " + OUStringChar(CH_TXTATR_NEWLINE) + + u"baz" + OUStringChar(CH_TXT_ATR_FIELDEND)), outerString); + + // must return innermost mark + CPPUNIT_ASSERT_EQUAL(pInner, rIDMA.getInnerFieldmarkFor(innerPos)); + }; + std::pair const aFilterNames[] = { {"writer8", "fieldmark_QUOTE_nest.fodt"}, {"Office Open XML Text", "fieldmark_QUOTE_nest.docx"}, @@ -921,12 +917,12 @@ void Test::testNestedFieldmark() { createSwDoc(rFilterName.second.toUtf8().getStr()); - verifyNestedFieldmark(rFilterName.first + ", load", mxComponent); + verify(rFilterName.first + ", load"); // Export the document and import again saveAndReload(rFilterName.first); - verifyNestedFieldmark(rFilterName.first + " exported-reload", mxComponent); + verify(rFilterName.first + " exported-reload"); } } @@ -1790,9 +1786,7 @@ void Test::testTextFormField() saveAndReload(rFilterName); // Check the document after round trip - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); // We have two text form fields @@ -1842,9 +1836,7 @@ void Test::testCheckBoxFormField() saveAndReload(rFilterName); // Check the document after round trip - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); // We have two check box form fields @@ -1895,9 +1887,7 @@ void Test::testDropDownFormField() saveAndReload(rFilterName); // Check the document after round trip - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_Int32(2), pMarkAccess->getAllMarksCount()); @@ -1972,9 +1962,7 @@ void Test::testDateFormField() // Check the document after round trip if (rFilterName == "writer8") { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_Int32(5), pMarkAccess->getAllMarksCount()); @@ -2154,9 +2142,7 @@ void Test::testDateFormFieldCharacterFormatting() // Check the document after round trip if (rFilterName == "writer8") { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); // Check that we have the field at the right place diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 132c6e7fcbbf..8a820edc950f 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -1377,8 +1377,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testMultiParaListItem) { // Create a document with 3 list items: A, B&C and D. createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"A"_ustr); SwDoc* pDoc = pWrtShell->GetDoc(); { @@ -1514,8 +1513,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListHeading) { // Given a document with a list heading: createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"list header"_ustr); SwDoc* pDoc = pWrtShell->GetDoc(); sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); @@ -1545,8 +1543,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testPartiallyNumberedList) { // Given a document with a list, first para is numbered, second is not: createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"list header"_ustr); SwDoc* pDoc = pWrtShell->GetDoc(); sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); @@ -1584,8 +1581,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testPartiallyNumberedListHTML) { // Given a document with a list, first para is numbered, second is not: createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"list header"_ustr); SwDoc* pDoc = pWrtShell->GetDoc(); sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); @@ -1624,8 +1620,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListHeaderAndItem) { // Given a document with a list, first para is not numbered, but the second is: createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"not numbered"_ustr); SwDoc* pDoc = pWrtShell->GetDoc(); sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); @@ -2026,8 +2021,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListsHeading) { // Given a document with lh, lh, li, li, lh and lh nodes: createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"list 1, header 1"_ustr); pWrtShell->SplitNode(); pWrtShell->Insert(u"list 1, header 2"_ustr); @@ -2126,7 +2120,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testNestedBullets) // Given a documented with nested lists: createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"first"_ustr); sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos]; @@ -2162,8 +2156,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTrailingLineBreak) { // Given a document with a trailing line-break: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"test\n"_ustr); // When exporting to reqif-xhtml: @@ -2183,10 +2176,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTrailingLineBreak) ImportFromReqif(maTempFile.GetURL()); // Then make sure that line-break is not lost: - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - pDoc = pTextDoc->GetDocShell()->GetDoc(); - pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + pWrtShell = getSwDocShell()->GetWrtShell(); OUString aActual = pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText(); // Without the accompanying fix in place, this test would have failed, as the trailing // line-break was lost. @@ -2197,8 +2187,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testLeadingTab) { // Given a document with leading tabs: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"\t first"_ustr); pWrtShell->SplitNode(); pWrtShell->Insert(u"\t\t second"_ustr); @@ -2230,8 +2219,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testLeadingTabHTML) { // Given a document with leading tabs: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"\t test"_ustr); // When exporting to plain HTML, using LeadingTabWidth=2: @@ -2298,8 +2286,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTableBackground) // Given a document with two tables: first stable has a background, second table has a // background in its first row: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwInsertTableOptions aInsertTableOptions(SwInsertTableFlags::DefaultBorder, /*nRowsToRepeat=*/0); pWrtShell->InsertTable(aInsertTableOptions, /*nRows=*/1, /*nCols=*/1); @@ -2368,8 +2355,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testSectionDir) { // Given a document with a section: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"test"_ustr); pWrtShell->SelAll(); SwSectionData aSectionData(SectionType::Content, u"mysect"_ustr); @@ -2391,8 +2377,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf114769) // Create document from scratch since relative urls to filesystem can be replaced // by absolute during save/load createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"Hyperlink1"_ustr); pWrtShell->SplitNode(); pWrtShell->Insert(u"Hyperlink2"_ustr); @@ -2763,8 +2748,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_PreserveSpaces) { // Given a document with leading, trailing, and repeating intermediate spaces: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); constexpr OUString paraText = u"\t test \t more text \t"_ustr; pWrtShell->Insert(paraText); @@ -2793,8 +2777,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_PreserveSpaces) { // Given a document with leading, trailing, and repeating intermediate spaces: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); constexpr OUString paraText = u"\t test \t more text \t"_ustr; pWrtShell->Insert(paraText); diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx index 420cdb742d67..43163ce5a39a 100644 --- a/sw/qa/extras/htmlimport/htmlimport.cxx +++ b/sw/qa/extras/htmlimport/htmlimport.cxx @@ -46,10 +46,8 @@ class HtmlImportTest : public SwModelTestBase CPPUNIT_TEST_FIXTURE(HtmlImportTest, testPictureImport) { createSwWebDoc("picture.html"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); // The document contains two pictures stored as a link. - SwEditShell* const pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell()); + SwEditShell* const pEditShell(getSwDoc()->GetEditShell()); CPPUNIT_ASSERT(pEditShell); sfx2::LinkManager& rLinkManager = pEditShell->GetLinkManager(); CPPUNIT_ASSERT_EQUAL(size_t(2), rLinkManager.GetLinks().size()); @@ -65,11 +63,9 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testPictureImport) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImage) { createSwWebDoc("inlined_image.html"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); // The document contains only one embedded picture inlined in img's src attribute. - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SwEditShell* pEditShell = pDoc->GetEditShell(); CPPUNIT_ASSERT(pEditShell); @@ -103,12 +99,10 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImage) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImagesPageAndParagraph) { createSwWebDoc("PageAndParagraphFilled.html"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); // The document contains embedded pictures inlined for PageBackground and // ParagraphBackground, check for their existence after import - SwEditShell* const pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell()); + SwEditShell* const pEditShell(getSwDoc()->GetEditShell()); CPPUNIT_ASSERT(pEditShell); // images are not linked, check for zero links @@ -188,9 +182,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testListStyleType) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testMetaIsoDates) { createSwWebDoc("meta-ISO8601-dates.html"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDocShell* pDocShell(pTextDoc->GetDocShell()); + SwDocShell* pDocShell(getSwDocShell()); uno::Reference xDocProps; CPPUNIT_ASSERT(pDocShell); @@ -209,9 +201,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testMetaIsoDates) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageWidthAuto) { createSwWebDoc("image-width-auto.html"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwEditShell* const pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell()); + SwEditShell* const pEditShell(getSwDoc()->GetEditShell()); CPPUNIT_ASSERT(pEditShell); SwTextAttr const*const pAttr(pEditShell->GetCursor()->GetPointNode().GetTextNode()->GetTextAttrForCharAt(0, RES_TXTATR_FLYCNT)); CPPUNIT_ASSERT(pAttr); @@ -232,9 +222,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageLazyRead) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testChangedby) { createSwWebDoc("meta-changedby.html"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDocShell* pDocShell(pTextDoc->GetDocShell()); + SwDocShell* pDocShell(getSwDocShell()); uno::Reference xDocProps; CPPUNIT_ASSERT(pDocShell); @@ -414,9 +402,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf142781) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf122789) { createSwWebDoc("tdf122789.html"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); const auto& rFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast(1), rFormats.size()); // This failed, the image had an absolute size, not a relative one. @@ -427,8 +413,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf118579) { createSwWebDoc("tdf118579.html"); //Without the fix in place, the file fails to load - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); + CPPUNIT_ASSERT_EQUAL(1, getPages()); } CPPUNIT_TEST_FIXTURE(HtmlImportTest, testReqIfPageStyle) @@ -458,7 +443,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testAllowedRTFOLEMimeTypes) comphelper::makePropertyValue(u"AllowedRTFOLEMimeTypes"_ustr, aTypes), }; OUString aURL = createFileURL(u"allowed-rtf-ole-mime-types.xhtml"); - mxComponent = loadFromDesktop(aURL, u"com.sun.star.text.TextDocument"_ustr, aLoadProperties); + loadWithParams(aURL, aLoadProperties); uno::Reference xSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xObjects(xSupplier->getEmbeddedObjects(), uno::UNO_QUERY); diff --git a/sw/qa/extras/indexing/IndexingExportTest.cxx b/sw/qa/extras/indexing/IndexingExportTest.cxx index 56ce9794611a..f52de4a8ab31 100644 --- a/sw/qa/extras/indexing/IndexingExportTest.cxx +++ b/sw/qa/extras/indexing/IndexingExportTest.cxx @@ -48,7 +48,6 @@ void IndexingExportTest::testIndexingExport_Paragraphs() { createSwDoc("IndexingExport_VariousParagraphs.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -84,7 +83,6 @@ void IndexingExportTest::testIndexingExport_Images() { createSwDoc("IndexingExport_Images.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -107,7 +105,6 @@ void IndexingExportTest::testIndexingExport_OLE() { createSwDoc("IndexingExport_OLE.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -127,7 +124,6 @@ void IndexingExportTest::testIndexingExport_Shapes() { createSwDoc("IndexingExport_Shapes.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -167,7 +163,6 @@ void IndexingExportTest::testIndexingExport_Tables() { createSwDoc("IndexingExport_Tables.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -235,7 +230,6 @@ void IndexingExportTest::testIndexingExport_Sections() { createSwDoc("IndexingExport_Sections.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -267,7 +261,6 @@ void IndexingExportTest::testIndexingExport_Fontwork() { createSwDoc("IndexingExport_Fontwork.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -292,7 +285,6 @@ void IndexingExportTest::testIndexingExport_Header_Footer() { createSwDoc("IndexingExport_Header_Footer.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); diff --git a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx index 804a36c29b06..9e239430a0b5 100644 --- a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx +++ b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx @@ -45,7 +45,6 @@ void SearchResultLocatorTest::testSearchResultLocator() createSwDoc("IndexingExport_VariousParagraphs.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); std::vector aDataVector; @@ -73,7 +72,6 @@ void SearchResultLocatorTest::testSearchResultLocatorUsingXmlPayload() createSwDoc("IndexingExport_VariousParagraphs.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); OString payload = "" @@ -102,7 +100,6 @@ void SearchResultLocatorTest::testSearchResultLocatorUsingJsonPayload() createSwDoc("IndexingExport_VariousParagraphs.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); OString payload = "[" @@ -131,7 +128,6 @@ void SearchResultLocatorTest::testSearchResultLocatorForSdrObjects() createSwDoc("IndexingExport_Shapes.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); std::vector aDataVector; @@ -159,7 +155,6 @@ void SearchResultLocatorTest::testSearchResultLocatorForSdrObjectsUsingJsonPaylo createSwDoc("IndexingExport_Shapes.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); OString payload = "[" diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index ac340366deea..739607e7db6e 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -115,9 +115,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf156077) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes) { createSwDoc("redline_footnotes.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); + SwDoc* pDoc(getSwDoc()); SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); @@ -282,10 +280,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136588) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody) { createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwDoc* pDoc(getSwDoc()); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pLayout(pWrtShell->GetLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); pWrtShell->Insert(u"foo"_ustr); @@ -716,15 +712,13 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFlyHiddenParagraph) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFieldHideSection) { createSwDoc("field_hide_section.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/section/tab/row", 1); assertXPath(pXmlDoc, "/root/page[2]/body/section/tab/row", 1); assertXPath(pXmlDoc, "/root/page", 2); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); ::std::unique_ptr pField(pWrtShell->GetCurField()->CopyField()); SwFieldMgr manager(pWrtShell); @@ -755,8 +749,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFieldHideSection) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestI94666) { createSwDoc("i94666.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); { xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -767,7 +759,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestI94666) "portion", u"pulled off "); } - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->GotoPage(2, false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 11, /*bBasicCall=*/false); pWrtShell->SetMark(); @@ -800,8 +792,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestI94666) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272) { createSwDoc("tdf134472.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds", "height", u"843"); assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds", "bottom", u"2819"); @@ -810,8 +800,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestNestedTableMoveFwd) { createSwDoc("tabellen_test_windows_1.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // the row with the nested table should not be split but be the first row on page 2 assertXPathContent(pXmlDoc, "/root/page[1]/body/tab[1]/row[last()]/cell[1]/txt[1]", @@ -825,7 +813,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136613) { createSwDoc("tdf136613.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); //get the flys and the root frame const auto vFlyFormats = pDoc->GetFlyFrameFormats(FLYCNTTYPE_ALL, true); @@ -856,8 +843,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136613) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf88496) { createSwDoc("tdf88496.docx"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 4, table fallback "switch off repeating header" started on a new page assertXPath(pXmlDoc, "/root/page", 3); @@ -866,10 +851,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf88496) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader) { createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwDoc* pDoc(getSwDoc()); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pLayout(pWrtShell->GetLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); pWrtShell->ChangeHeaderOrFooter(u"Default Page Style", /*bHeader*/ true, /*bOn*/ true, false); @@ -1283,9 +1266,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf150606) { createSwDoc("tdf150606-1-min.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -1351,8 +1332,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025) { // Check the padding of the textbox createSwDoc("tdf137025.docx"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); @@ -1434,10 +1413,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) { createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwDoc* pDoc(getSwDoc()); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pLayout(pWrtShell->GetLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); pWrtShell->InsertFootnote(u""_ustr); @@ -2023,8 +2000,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf143239) { createSwDoc("tdf143239-1-min.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // These are unstable on macOS and Win64 builds, // so only test that they restore original values for now @@ -2109,9 +2085,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableOverlapFooterFly) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277) { createSwDoc("tdf134277.docx"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; @@ -2125,8 +2099,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116486) { createSwDoc("tdf116486.docx"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); OUString aTop = getXPath( pXmlDoc, @@ -2168,8 +2140,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf152106) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128198) { createSwDoc("tdf128198-1.docx"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pLayout = parseLayoutDump(); // the problem was that line 5 was truncated at "this " // due to the fly anchored in previous paragraph @@ -2236,10 +2206,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf106153) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys) { createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwDoc* pDoc(getSwDoc()); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pLayout(pWrtShell->GetLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); pWrtShell->Insert(u"foo"_ustr); @@ -2833,10 +2801,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys) { createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwDoc* pDoc(getSwDoc()); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pLayout(pWrtShell->GetLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); pWrtShell->Insert(u"foo"_ustr); @@ -3179,9 +3145,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineSections) { createSwDoc("redline_sections.fodt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); + SwDoc* pDoc(getSwDoc()); SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); @@ -3275,25 +3239,19 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineSections) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TDF69647_images) { createSwDoc("tdf69647_images.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of pages does not match!", 2, getPages()); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TDF69647_text) { createSwDoc("tdf69647_text.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of pages does not match!", 2, getPages()); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables) { createSwDoc("redline_table.fodt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); + SwDoc* pDoc(getSwDoc()); SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); @@ -3371,9 +3329,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144057) { createSwDoc("tdf144057.fodt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); + SwDoc* pDoc(getSwDoc()); SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -3429,9 +3385,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144057) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347) { createSwDoc("tdf144057.fodt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); + SwDoc* pDoc(getSwDoc()); SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); // enable redlining @@ -3481,9 +3435,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf155345) { createSwDoc("tdf144057.fodt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); + SwDoc* pDoc(getSwDoc()); SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); @@ -3522,15 +3474,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf155345) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf109137) { createSwDoc("tdf109137.docx"); - // FIXME: it's not possible to use 'reload' here because the validation fails with - // Error: attribute "text:start-value" has a bad value - uno::Reference xStorable(mxComponent, uno::UNO_QUERY); - uno::Sequence aDescriptor(comphelper::InitPropertySequence({ - { "FilterName", uno::Any(u"writer8"_ustr) }, - })); - xStorable->storeToURL(maTempFile.GetURL(), aDescriptor); - mxComponent->dispose(); - mxComponent = loadFromDesktop(maTempFile.GetURL(), u"com.sun.star.text.TextDocument"_ustr); + // FIXME: Error: attribute "text:start-value" has a bad value + skipValidation(); + saveAndReload(u"writer8"_ustr); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 0, the blue rectangle moved from the 1st to the 2nd page. assertXPath(pXmlDoc, "/root/page[1]/body/txt/anchored/fly/notxt", diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 64f5768eff42..3e6609931c0b 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -220,9 +220,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf148897) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineCharAttributes) { createSwDoc("redline_charatr.fodt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); + SwDoc* pDoc(getSwDoc()); SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); @@ -401,9 +399,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineCharAttributes) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineShowHideFootnotePagination) { createSwDoc("redline_footnote_pagination.fodt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); + SwDoc* pDoc(getSwDoc()); SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); @@ -517,8 +513,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150790) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129357) { createSwDoc("tdf129357.fodt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -534,8 +529,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129357) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInNumbering) { createSwDoc("tdf42748.fodt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -559,8 +553,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInNumbering) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering) { createSwDoc("tdf115523.fodt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -581,8 +574,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering2) { createSwDoc("tdf115524.fodt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -603,12 +595,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering2) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149710_RedlineNumberingEditing) { createSwDoc("tdf149710.fodt"); - SwDoc* pDoc = getSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); // Show Changes - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pLayout(pWrtShell->GetLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); @@ -618,7 +607,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149710_RedlineNumberingEditing) dispatchCommand(mxComponent, u".uno:Delete"_ustr, {}); // Dump the rendering of the first page as an XML file. - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; @@ -646,12 +635,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149710_RedlineNumberingEditing) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149709_RedlineNumberingLevel) { createSwDoc("tdf149709.fodt"); - SwDoc* pDoc = getSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); // Show Changes - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pLayout(pWrtShell->GetLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); @@ -661,7 +647,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149709_RedlineNumberingLevel) pWrtShell->SplitNode(false); // Dump the rendering of the first page as an XML file. - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; @@ -848,8 +834,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf158885_not_compound_remain) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInFootnote) { createSwDoc("tdf85610.fodt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -868,7 +853,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving) { createSwDoc("tdf42748.fodt"); SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // create a 3-element list without change tracking SwEditShell* const pEditShell(pDoc->GetEditShell()); @@ -897,7 +882,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving2) { createSwDoc("tdf42748.fodt"); SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // create a 3-element list without change tracking SwEditShell* const pEditShell(pDoc->GetEditShell()); @@ -909,7 +894,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving2) // at least 6 characters with an inner space after stripping white spaces // of the redline dispatchCommand(mxComponent, u".uno:GoToStartOfDoc"_ustr, {}); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"An Item"_ustr); // move down first list item with track changes @@ -932,7 +917,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMovingDOCX) { createSwDoc("tdf104797.docx"); SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); SwEditShell* const pEditShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pEditShell); @@ -952,11 +937,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMovingDOCX) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableCellInvalidate) { - if (mxComponent.is()) - mxComponent->dispose(); - - OUString const url(createFileURL(u"table_cell_overlap.fodt")); - // note: must set Hidden property, so that SfxFrameViewWindow_Impl::Resize() // does *not* forward initial VCL Window Resize and thereby triggers a // layout which does not happen on soffice --convert-to pdf. @@ -966,8 +946,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableCellInvalidate) }; // inline the loading because currently properties can't be passed... - mxComponent = loadFromDesktop(url, u"com.sun.star.text.TextDocument"_ustr, - comphelper::containerToSequence(aFilterOptions)); + OUString const url(createFileURL(u"table_cell_overlap.fodt")); + loadWithParams(url, comphelper::containerToSequence(aFilterOptions)); save(u"writer_pdf_Export"_ustr); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -998,8 +978,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableCellInvalidate) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145719) { createSwDoc("tdf145719.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1015,8 +994,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145719) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testChangedTableRows) { createSwDoc("changed_table_rows.fodt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1035,8 +1013,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testChangedTableRows) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf155187_TableInTextChange) { createSwDoc("table_in_text_change.fodt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1054,8 +1031,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145225_RedlineMovingWithBadInsertio { createSwDoc("tdf42748.fodt"); SwDoc* pDoc = getSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); // create a 3-element list without change tracking // (because the fixed problem depends on the own changes) @@ -1066,7 +1041,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145225_RedlineMovingWithBadInsertio CPPUNIT_ASSERT_EQUAL(static_cast(0), pEditShell->GetRedlineCount()); // Show Changes - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pLayout(pWrtShell->GetLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); @@ -1091,8 +1066,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf146964_ReappearingMovedTextInHideCh { createSwDoc("tdf54819.fodt"); SwDoc* pDoc = getSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); // enable Record Changes dispatchCommand(mxComponent, u".uno:TrackChanges"_ustr, {}); @@ -1101,7 +1074,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf146964_ReappearingMovedTextInHideCh // set Hide Changes mode dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {}); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pLayout(pWrtShell->GetLayout()); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); @@ -1124,8 +1097,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf146964_ReappearingMovedTextInHideCh CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125300) { createSwDoc("tdf125300.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1148,8 +1120,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125300) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116830) { createSwDoc("tdf116830.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1176,8 +1147,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116830) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf114163) { createSwDoc("tdf114163.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1202,8 +1172,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf131707) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122225) { createSwDoc("tdf122225.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1228,8 +1197,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122225) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125335) { createSwDoc("tdf125335.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1244,8 +1212,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125335) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134247) { createSwDoc("legend-itemorder-min.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1260,8 +1227,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134247) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf75659) { createSwDoc("tdf75659.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1278,8 +1244,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf75659) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf136816) { createSwDoc("tdf136816.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1294,8 +1259,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf136816) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126425) { createSwDoc("long_legendentry.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1328,8 +1292,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testUnusedOLEprops) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf123268) { createSwDoc("tdf123268.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1347,8 +1310,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf123268) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf133005) { createSwDoc("tdf133005.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1374,8 +1336,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf133005) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf115630) { createSwDoc("tdf115630.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1400,8 +1361,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf115630) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf108021) { createSwDoc("tdf108021.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1416,8 +1376,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf108021) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125334) { createSwDoc("tdf125334.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1433,8 +1392,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125334) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122800) { createSwDoc("tdf122800.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1449,8 +1407,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122800) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTruncatedAxisLabel) { createSwDoc("testTruncatedAxisLabel.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1468,8 +1425,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTruncatedAxisLabel) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf128996) { createSwDoc("tdf128996.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1483,8 +1439,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf128996) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126244) { createSwDoc("tdf126244.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1506,8 +1461,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126244) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf127304) { createSwDoc("tdf127304.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1527,8 +1481,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf127304) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testHorizontal_multilevel) { createSwDoc("horizontal_multilevel.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1620,8 +1573,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116256) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138194) { createSwDoc("xaxis-labelbreak.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1659,8 +1611,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf146272) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138773) { createSwDoc("tdf138773.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1678,8 +1629,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138773) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124796) { createSwDoc("tdf124796.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1697,8 +1647,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124796) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf72727) { createSwDoc("tdf72727.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1717,8 +1666,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf72727) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130969) { createSwDoc("tdf130969.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1733,8 +1681,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130969) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf40260) { createSwDoc("tdf40260.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; @@ -1752,8 +1699,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf40260) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129054) { createSwDoc("tdf129054.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1779,8 +1725,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129054) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129173) { createSwDoc("testAreaChartNumberFormat.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1795,8 +1740,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129173) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134866) { createSwDoc("tdf134866.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1811,8 +1755,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134866) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137116) { createSwDoc("tdf137116.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1832,8 +1775,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137116) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137154) { createSwDoc("tdf137154.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1853,8 +1795,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137154) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138777) { createSwDoc("outside_long_data_label.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1872,8 +1813,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138777) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130031) { createSwDoc("tdf130031.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1892,8 +1832,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130031) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130242) { createSwDoc("tdf130242.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1920,8 +1859,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130242) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134121) { createSwDoc("piechart_leaderline.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1936,8 +1874,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134121) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138018) { createSwDoc("tdf138018.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1954,8 +1891,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138018) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130380) { createSwDoc("tdf130380.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1978,8 +1914,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130380) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129095) { createSwDoc("tdf129095.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1994,8 +1929,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129095) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf132956) { createSwDoc("tdf132956.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -2011,8 +1945,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137819) { // Open the bugdoc and check if it went wrong createSwDoc("tdf137819.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // Change the anchor if the textbox to As_char uno::Reference xShapePropSet(getShape(1), uno::UNO_QUERY); @@ -2082,8 +2014,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testParagraphMarkLineHeight) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122014) { createSwDoc("tdf122014.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -2100,8 +2031,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122014) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134659) { createSwDoc("tdf134659.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -2118,8 +2048,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134659) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134235) { createSwDoc("tdf134235.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -2136,8 +2065,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134235) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134676) { createSwDoc("tdf134676.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -2154,8 +2082,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134676) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134146) { createSwDoc("tdf134146.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -2174,8 +2101,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134146) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf136061) { createSwDoc("tdf136061.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -2189,8 +2115,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf136061) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116925) { createSwDoc("tdf116925.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -2210,8 +2135,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116925) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf117028) { createSwDoc("tdf117028.docx"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -2230,8 +2154,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf117028) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf106390) { createSwDoc("tdf106390.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -2249,8 +2172,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf106390) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableExtrusion1) { createSwDoc("table-extrusion1.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -2270,8 +2192,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableExtrusion1) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableExtrusion2) { createSwDoc("table-extrusion2.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -2431,10 +2352,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf117923) { createSwDoc("tdf117923.doc"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -2459,10 +2377,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf127606) { createSwDoc("tdf117923.docx"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -2560,7 +2475,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf121509) { createSwDoc("Tdf121509.odt"); auto pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // Get all shape/frame formats auto vFrameFormats = pDoc->GetSpzFrameFormats(); @@ -2587,12 +2501,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf121509) save(u"Office Open XML Text"_ustr); // The second part: check if the reloaded doc has flys inside a fly - uno::Reference xComponent - = loadFromDesktop(maTempFile.GetURL(), u"com.sun.star.text.TextDocument"_ustr); - uno::Reference xTextDoc(xComponent, uno::UNO_QUERY); - auto pTextDoc = dynamic_cast(xTextDoc.get()); - CPPUNIT_ASSERT(pTextDoc); - auto pSecondDoc = pTextDoc->GetDocShell()->GetDoc(); + loadFromDesktop(maTempFile.GetURL(), u"com.sun.star.text.TextDocument"_ustr); + auto pSecondDoc = getSwDoc(); auto pSecondFormats = pSecondDoc->GetSpzFrameFormats(); bool bFlyInFlyFound = false; diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 4f286513106e..7fd080b043e2 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -208,10 +208,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908) { createSwDoc("tdf130088.docx"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -229,10 +226,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158333) { createSwDoc("tdf130088.docx"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -270,10 +264,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159085) { createSwDoc("tdf159085.fodt"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -292,13 +283,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158419) { createSwDoc("tdf130088.docx"); SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -334,13 +322,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf163042) { createSwDoc("tdf163042.fodt"); SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -375,10 +360,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf163060) createSwDoc("tdf163060.fodt"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -399,10 +381,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf162109) { createSwDoc("tdf162109.fodt"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -416,10 +395,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf162220) { createSwDoc("tdf162220.fodt"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -433,10 +409,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf162725) { createSwDoc("tdf162725.fodt"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -450,8 +423,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf161810) { createSwDoc("tdf161810.fodt"); // Ensure that all text portions are calculated before testing. - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -484,8 +456,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf163149) { createSwDoc("tdf163149.docx"); // Ensure that all text portions are calculated before testing. - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -534,10 +505,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf132599_always) createSwDoc("tdf132599_always.fodt"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -561,10 +529,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf132599_frames_on_same_page_no_hyphe createSwDoc("tdf132599_frames_on_same_page_no_hyphenation.fodt"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -584,10 +549,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf132599_frames_on_same_page_hyphenat createSwDoc("tdf132599_frames_on_same_page_hyphenation.fodt"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -608,10 +570,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf132599_frames_on_right_pages_no_hyp createSwDoc("tdf132599_frames_on_right_pages_no_hyphenation.fodt"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -632,10 +591,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf132599_frames_on_spread_hyphenation createSwDoc("tdf132599_frames_on_spread_hyphenation.fodt"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -652,10 +608,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf106234) { createSwDoc("tdf106234.fodt"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -904,8 +857,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf115094) CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf112290) { createSwDoc("tdf112290.docx"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); auto pXml = parseLayoutDump(); assertXPath(pXml, "/root/page/body/txt/SwParaPortion/SwLineLayout[2]", "portion", u"Xxxx Xxxx"); } @@ -978,11 +929,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf122607) CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf122607_regression) { - if (mxComponent.is()) - mxComponent->dispose(); - - OUString const url(createFileURL(u"tdf122607_leerzeile.odt")); - // note: must set Hidden property, so that SfxFrameViewWindow_Impl::Resize() // does *not* forward initial VCL Window Resize and thereby triggers a // layout which does not happen on soffice --convert-to pdf. @@ -992,14 +938,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf122607_regression) }; // inline the loading because currently properties can't be passed... - mxComponent = loadFromDesktop(url, u"com.sun.star.text.TextDocument"_ustr, - comphelper::containerToSequence(aFilterOptions)); - uno::Sequence props(comphelper::InitPropertySequence({ - { "FilterName", uno::Any(u"writer_pdf_Export"_ustr) }, - })); - utl::TempFileNamed aTempFile; - uno::Reference xStorable(mxComponent, uno::UNO_QUERY); - xStorable->storeToURL(aTempFile.GetURL(), props); + OUString const url(createFileURL(u"tdf122607_leerzeile.odt")); + loadWithParams(url, comphelper::containerToSequence(aFilterOptions)); + save(u"writer_pdf_Export"_ustr); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // somehow these 2 rows overlapped in the PDF unless CalcLayout() runs @@ -1012,17 +953,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf122607_regression) // this was 3034, causing the overlap assertXPath(pXmlDoc, "/root/page[1]/anchored/fly/tab[1]/row[2]/infos/bounds", "top", u"3218"); assertXPath(pXmlDoc, "/root/page[1]/anchored/fly/tab[1]/row[2]/infos/bounds", "height", u"164"); - - aTempFile.EnableKillingFile(); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestTdf150616) { - if (mxComponent.is()) - mxComponent->dispose(); - - OUString const url(createFileURL(u"in_056132_mod.odt")); - // note: must set Hidden property, so that SfxFrameViewWindow_Impl::Resize() // does *not* forward initial VCL Window Resize and thereby triggers a // layout which does not happen on soffice --convert-to pdf. @@ -1032,14 +966,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestTdf150616) }; // inline the loading because currently properties can't be passed... - mxComponent = loadFromDesktop(url, u"com.sun.star.text.TextDocument"_ustr, - comphelper::containerToSequence(aFilterOptions)); - uno::Sequence props(comphelper::InitPropertySequence({ - { "FilterName", uno::Any(u"writer_pdf_Export"_ustr) }, - })); - utl::TempFileNamed aTempFile; - uno::Reference xStorable(mxComponent, uno::UNO_QUERY); - xStorable->storeToURL(aTempFile.GetURL(), props); + OUString const url(createFileURL(u"in_056132_mod.odt")); + loadWithParams(url, comphelper::containerToSequence(aFilterOptions)); + save(u"writer_pdf_Export"_ustr); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); @@ -1059,15 +988,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestTdf150616) u"697"); assertXPath(pXmlDoc, "/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/infos/bounds", "top", u"8178"); - - aTempFile.EnableKillingFile(); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testBtlrCell) { createSwDoc("btlr-cell.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1147,6 +1073,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testBtlrCell) // Test that clicking "below" the second paragraph positions the cursor at the start of the // second paragraph. + SwDoc* pDoc = getSwDoc(); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); SwPosition aPosition(aCellStart); SwTwips nSecondParaLeft @@ -1284,8 +1211,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf118719) { // Insert a page break. createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Enable hide whitespace mode. SwViewOption aViewOptions(*pWrtShell->GetViewOptions()); @@ -1320,8 +1246,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testImageComment) // Load a document that has "aaa" in it, then a commented image (4th char is the as-char image, // 5th char is the comment anchor). createSwDoc("image-comment.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Look up a layout position which is on the right of the image. SwRootFrame* pRoot = pWrtShell->GetLayout(); @@ -1355,8 +1280,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testScriptField) { // Test clicking script field inside table ( tdf#141079 ) createSwDoc("tdf141079.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Look up layout position which is the first cell in the table SwRootFrame* pRoot = pWrtShell->GetLayout(); @@ -1389,8 +1313,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testCommentCursorPosition) { // Load a document that has "aaa" in it, followed by three comments. createSwDoc("endOfLineComments.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pRoot = pWrtShell->GetLayout(); CPPUNIT_ASSERT(pRoot->GetLower()->IsPageFrame()); @@ -1423,8 +1346,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testCombiningCharacterCursorPosition) { // Load a document that has "a" in it, followed by a combining acute in a separate rext span createSwDoc("tdf138592-a-acute.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pRoot = pWrtShell->GetLayout(); CPPUNIT_ASSERT(pRoot->GetLower()->IsPageFrame()); @@ -1463,8 +1385,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf64222) CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf113014) { createSwDoc("tdf113014.fodt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1483,8 +1404,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf113014) CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf130218) { createSwDoc("tdf130218.fodt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1582,9 +1502,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testShapeAllowOverlap) xDrawPageSupplier->getDrawPage()->add(xShape); // Now verify that the rectangle of the anchored objects don't overlap. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); SwFrame* pPageFrame = pLayout->GetLower(); SwFrame* pBodyFrame = pPageFrame->GetLower(); @@ -1640,9 +1558,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testShapeAllowOverlapWrap) xDrawPageSupplier->getDrawPage()->add(xShape); // Now verify that the rectangle of the anchored objects do overlap. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); SwFrame* pPageFrame = pLayout->GetLower(); SwFrame* pBodyFrame = pPageFrame->GetLower(); @@ -1744,7 +1660,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf124770) pDoc->ChgPageDesc(0, rPageDesc); // Set font to italic 20pt Liberation Serif. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SfxItemSet aTextSet(pWrtShell->GetView().GetPool(), svl::Items); SvxFontItem aFont(RES_CHRATR_FONT); @@ -1776,7 +1692,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testContinuousEndnotesInsertPageAtStart) // Insert a second page, and an endnote on the 2nd page (both the anchor and the endnote is on // the 2nd page). - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertPageBreak(); pWrtShell->InsertFootnote(u"endnote"_ustr, /*bEndNote=*/true, /*bEdit=*/false); @@ -1803,7 +1719,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testContinuousEndnotesDeletePageAtStart) // Insert a second page, and an endnote on the 2nd page (both the anchor and the endnote is on // the 2nd page). - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertPageBreak(); pWrtShell->InsertFootnote(u"endnote"_ustr, /*bEndNote=*/true, /*bEdit=*/false); @@ -1834,7 +1750,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128399) const SwRect& rRow2Rect = pRow2->getFrameArea(); Point aPoint = rRow2Rect.Center(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwPosition aPosition = *pWrtShell->GetCursor()->Start(); SwPosition aFirstRow(aPosition); SwCursorMoveState aState(CursorMoveState::NONE); @@ -1851,11 +1767,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128399) CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf156724) { - if (mxComponent.is()) - mxComponent->dispose(); - - OUString const url(createFileURL(u"fdo56797-2-min.odt")); - // note: must set Hidden property, so that SfxFrameViewWindow_Impl::Resize() // does *not* forward initial VCL Window Resize and thereby triggers a // layout which does not happen on soffice --convert-to pdf. @@ -1865,8 +1776,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf156724) }; // inline the loading because currently properties can't be passed... - mxComponent = loadFromDesktop(url, u"com.sun.star.text.TextDocument"_ustr, - comphelper::containerToSequence(aFilterOptions)); + OUString const url(createFileURL(u"fdo56797-2-min.odt")); + loadWithParams(url, comphelper::containerToSequence(aFilterOptions)); save(u"writer_pdf_Export"_ustr); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); diff --git a/sw/qa/extras/layout/layout4.cxx b/sw/qa/extras/layout/layout4.cxx index eabb5b63ff72..ca8d298c3a09 100644 --- a/sw/qa/extras/layout/layout4.cxx +++ b/sw/qa/extras/layout/layout4.cxx @@ -264,8 +264,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf105481) CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf117982) { createSwDoc("tdf117982.docx"); - SwDoc* pDocument = getSwDoc(); - SwDocShell* pShell = pDocument->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); @@ -278,8 +277,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf128959) { // no orphan/widow control in table cells createSwDoc("tdf128959.docx"); - SwDoc* pDocument = getSwDoc(); - CPPUNIT_ASSERT(pDocument); + SwDoc* pDoc = getSwDoc(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // first two lines of the paragraph in the split table cell on the first page @@ -298,7 +296,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf128959) "portion", u"amet commodo magna eros quis urna."); // Also check that the widow control for the paragraph is not turned off: - sw::TableFrameFormats& rTableFormats = *pDocument->GetTableFrameFormats(); + sw::TableFrameFormats& rTableFormats = *pDoc->GetTableFrameFormats(); SwFrameFormat* pTableFormat = rTableFormats[0]; SwTable* pTable = SwTable::FindTable(pTableFormat); const SwTableBox* pCell = pTable->GetTableBox(u"A1"_ustr); @@ -414,8 +412,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testStableAtPageAnchoredFlyPosition) // if you add a break to page 2, or append some text to page 4 (or just toggle display field names), // the page anchored frame on page 4 vanishes, as it is incorrectly moved out of the page bounds. createSwDoc("stable-at-page-anchored-fly-position.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // look up the layout position of the page-bound frame on page four SwRect aOrigRect = lcl_getVisibleFlyObjRect(pWrtShell); @@ -484,10 +481,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf137185) { // First load the sample bugdoc createSwDoc("tdf137185.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); // Get the doc shell - SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); + SwDoc* pDoc(getSwDoc()); // Get the DrawObject from page auto pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); @@ -566,8 +561,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf135035) CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf146704_EndnoteInSection) { createSwDoc("tdf146704_EndnoteInSection.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Without the fix, the endnote placed to 2. page assertXPath(pXmlDoc, "/root/page", 1); @@ -576,8 +569,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf146704_EndnoteInSection) CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf139336_ColumnsWithFootnoteDoNotOccupyEntirePage) { createSwDoc("tdf139336_ColumnsWithFootnoteDoNotOccupyEntirePage.docx"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Without the fix, it would be 5 pages, but with the fix the whole document // would fit into 1 page, but it will be 2 pages right now, because @@ -595,8 +586,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf54465_ColumnsWithFootnoteDoNotOccup // Note: Somewhy this test miscalculates the layout of the old odt file. // It will be 4 pages long, while opened in Writer it is 5 pages long. createSwDoc("tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); Scheduler::ProcessEventsToIdle(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "/root/page"); @@ -605,8 +594,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf54465_ColumnsWithFootnoteDoNotOccup xmlXPathFreeObject(pXmlObj); createSwDoc("tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt"); - pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page", 1); } @@ -979,8 +966,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf159443) { // Given a document with chart, which have a datatable createSwDoc("tdf159443.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1009,8 +995,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf159422) { // Given a document with chart, which have a datatable createSwDoc("charttable.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1045,8 +1030,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf159456) { // Given a document with chart, which have a datatable createSwDoc("charttable.odt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); // Dump the rendering of the first page as an XML file. std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx index 8bfa92b08931..71eb97fd753e 100644 --- a/sw/qa/extras/mailmerge/mailmerge.cxx +++ b/sw/qa/extras/mailmerge/mailmerge.cxx @@ -52,8 +52,6 @@ DECLARE_FILE_MAILMERGE_TEST(testMissingDefaultLineColor, "missing-default-line-c uno::Reference xPropertySet(getShape(5), uno::UNO_QUERY); // Lines do not have a line color. CPPUNIT_ASSERT( !xPropertySet->getPropertySetInfo()->hasPropertyByName( u"LineColor"_ustr )); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); uno::Reference< lang::XMultiServiceFactory > xFact( mxComponent, uno::UNO_QUERY ); uno::Reference< beans::XPropertySet > xDefaults( xFact->createInstance( u"com.sun.star.drawing.Defaults"_ustr ), uno::UNO_QUERY ); CPPUNIT_ASSERT( xDefaults.is()); @@ -196,9 +194,7 @@ DECLARE_SHELL_MAILMERGE_TEST(testTdf92623, "tdf92623.odt", "10-testing-addresses // copied marks were off by one executeMailMerge(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - IDocumentMarkAccess const *pIDMA = pTextDoc->GetDocShell()->GetDoc()->getIDocumentMarkAccess(); + IDocumentMarkAccess const *pIDMA = getSwDoc()->getIDocumentMarkAccess(); // There is just one mark... CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pIDMA->getAllMarksCount()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pIDMA->getBookmarksCount()); @@ -209,7 +205,7 @@ DECLARE_SHELL_MAILMERGE_TEST(testTdf92623, "tdf92623.odt", "10-testing-addresses SwNodeOffset src_pos = (*mark)->GetMarkPos().GetNodeIndex(); // Get the size of the document in nodes - SwDoc *doc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc *doc = getSwDoc(); SwNodeOffset size = doc->GetNodes().GetEndOfContent().GetIndex() - doc->GetNodes().GetEndOfExtras().GetIndex(); CPPUNIT_ASSERT_EQUAL( SwNodeOffset(13), size ); size -= SwNodeOffset(2); // For common start and end nodes @@ -268,9 +264,7 @@ DECLARE_SHELL_MAILMERGE_TEST_SELECTION(testTdf95292, "linked-labels.odt", "10-te // A document with two labels merged with 5 datasets should result in three pages executeMailMerge(); - SwXTextDocument* pTextDoc = dynamic_cast( mxComponent.get() ); - CPPUNIT_ASSERT( pTextDoc ); - SwWrtShell *pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell *pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT( pWrtShell->IsLabelDoc() ); CPPUNIT_ASSERT( mxSwTextDocument ); @@ -285,11 +279,8 @@ DECLARE_SHELL_MAILMERGE_TEST(test_sections_first_last, "sections_first_last.odt" // Originally we were losing the trailing section during merge executeMailMerge(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - // Get the size of the document in nodes - SwDoc *pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc *pDoc = getSwDoc(); SwNodeOffset nSize = pDoc->GetNodes().GetEndOfContent().GetIndex() - pDoc->GetNodes().GetEndOfExtras().GetIndex(); nSize -= SwNodeOffset(2); // The common start and end node CPPUNIT_ASSERT_EQUAL( SwNodeOffset(13), nSize ); @@ -436,9 +427,7 @@ DECLARE_FILE_MAILMERGE_TEST(testEmptyValuesLegacyODT, "tdf35798-legacy.odt", "5- for (int doc = 0; doc < 5; ++doc) { loadMailMergeDocument(doc); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); pDoc->RemoveInvisibleContent(); CPPUNIT_ASSERT_EQUAL(1, getPages()); for (int i = 0; i < 8; ++i) @@ -460,9 +449,7 @@ DECLARE_FILE_MAILMERGE_TEST(testEmptyValuesNewODT, "tdf35798-new.odt", "5-with-b for (int doc = 0; doc < 5; ++doc) { loadMailMergeDocument(doc); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); pDoc->RemoveInvisibleContent(); CPPUNIT_ASSERT_EQUAL(1, getPages()); int i; @@ -488,9 +475,7 @@ DECLARE_FILE_MAILMERGE_TEST(testEmptyValuesLegacyFODT, "tdf35798-legacy.fodt", " for (int doc = 0; doc < 5; ++doc) { loadMailMergeDocument(doc); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); pDoc->RemoveInvisibleContent(); CPPUNIT_ASSERT_EQUAL(1, getPages()); for (int i = 0; i < 8; ++i) @@ -512,9 +497,7 @@ DECLARE_FILE_MAILMERGE_TEST(testEmptyValuesNewFODT, "tdf35798-new.fodt", "5-with for (int doc = 0; doc < 5; ++doc) { loadMailMergeDocument(doc); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); pDoc->RemoveInvisibleContent(); CPPUNIT_ASSERT_EQUAL(1, getPages()); int i; diff --git a/sw/qa/extras/mailmerge/mailmerge2.cxx b/sw/qa/extras/mailmerge/mailmerge2.cxx index 5fcee2d48529..5cac9ee611dc 100644 --- a/sw/qa/extras/mailmerge/mailmerge2.cxx +++ b/sw/qa/extras/mailmerge/mailmerge2.cxx @@ -389,7 +389,7 @@ DECLARE_MAILMERGE_TEST(testGrabBag, "grabbagtest.docx", "onecell.xlsx", "Sheet1" SwXTextDocument *const pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pTextDoc->GetDocShell()->GetWrtShell()->GetPhyPageNum()); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), getSwDocShell()->GetWrtShell()->GetPhyPageNum()); // check grabbag uno::Reference const xModel( diff --git a/sw/qa/extras/odfexport/data/tdf163575.docx b/sw/qa/extras/odfexport/data/tdf163575.docx new file mode 100644 index 000000000000..8d6c8f17fe69 Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf163575.docx differ diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index cbb9cec9e644..09d4707a68ba 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1234,8 +1234,7 @@ CPPUNIT_TEST_FIXTURE(Test, testProtectionKey) CPPUNIT_TEST_FIXTURE(Test, testTdf128188) { loadAndReload("footnote-collect-at-end-of-section.fodt"); - SwDoc *const pDoc = dynamic_cast(*mxComponent).GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); + SwDoc* pDoc = getSwDoc(); SwFootnoteIdxs const& rFootnotes(pDoc->GetFootnoteIdxs()); // Section1 CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rFootnotes[0]->GetFootnote().GetNumber()); @@ -1828,11 +1827,7 @@ CPPUNIT_TEST_FIXTURE(Test, testBtlrFrame) // Without the accompanying fix in place, this test would have failed, as the fly frame had // mbVertical==true, but mbVertLRBT==false, even if the writing direction in the doc model was // btlr. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); + SwDoc* pDoc = getSwDoc(); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); CPPUNIT_ASSERT(pLayout); diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index e4285bdbdb73..c32c62ea4163 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -550,6 +550,12 @@ CPPUNIT_TEST_FIXTURE(Test, tdf99631) assertXPathContent(pXmlDoc2, "//config:config-item[@config:name='VisibleAreaHeight']", u"1355"); } +CPPUNIT_TEST_FIXTURE(Test, tdf163575) +{ + // crashes/assert at export time + loadAndReload("tdf163575.docx"); +} + CPPUNIT_TEST_FIXTURE(Test, tdf145871) { loadAndReload("tdf145871.odt"); @@ -1724,8 +1730,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122452) // FIXME: Error: element "text:insertion" was found where no element may occur skipValidation(); loadAndReload("tdf122452.doc"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Without the fix in place this fails with: // Expected: 1 diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 985e52e450e6..9c824c92b985 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -721,9 +721,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf89802) CPPUNIT_TEST_FIXTURE(Test, testFdo37606) { createSwDoc("fdo37606.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false); { @@ -770,9 +768,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo37606) CPPUNIT_TEST_FIXTURE(Test, testFdo37606Copy) { createSwDoc("fdo37606.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Ctrl-A pWrtShell->SelAll(); // Selects A1. pWrtShell->SelAll(); // Selects the whole table. @@ -799,9 +795,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo69862) { createSwDoc("fdo69862.odt"); // The test doc is special in that it starts with a table and it also has a footnote. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SelAll(); // Selects A1. pWrtShell->SelAll(); // Selects the whole table. @@ -819,9 +813,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo69979) { createSwDoc("fdo69979.odt"); // The test doc is special in that it starts with a table and it also has a header. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false); pWrtShell->SelAll(); // Selects A1. @@ -838,9 +830,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo69979) CPPUNIT_TEST_FIXTURE(Test, testSpellmenuRedline) { createSwDoc("spellmenu-redline.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); uno::Reference xAlt; SwSpellPopup aPopup(pWrtShell, xAlt, OUString()); Menu& rMenu = aPopup.GetMenu(); @@ -1142,9 +1132,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf152015) CPPUNIT_TEST_FIXTURE(Test, testTdf123829) { createSwDoc("tdf123829.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Compatibility: collapse cell paras should not be set", false, pDoc->getIDocumentSettingAccess().get(DocumentSettingId::COLLAPSE_EMPTY_CELL_PARA)); @@ -1162,9 +1150,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf123968) { createSwDoc("tdf123968.odt"); // The test doc is special in that it starts with a table and it also has a header. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false); pWrtShell->SelAll(); @@ -1301,10 +1287,9 @@ CPPUNIT_TEST_FIXTURE(Test, testVerticallyMergedCellBorder) { // Given a document with two cells, vertically merged, when loading the document: createSwDoc("vmerge-cell-border.odt"); - SwDoc* pDoc = getSwDoc(); // Then make sure that the first cell has a right border while the second has no right border: - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false, /*nCount=*/1); SwShellCursor* pShellCursor = pWrtShell->getShellCursor(/*bBlock=*/false); @@ -1622,9 +1607,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf161054) CPPUNIT_TEST_FIXTURE(Test, testTdf162398) { createSwDoc("tdf162398.fodt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Ctrl-A pWrtShell->SelAll(); // Selects the whole document. diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index c942d5277332..f3e3676f2c07 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -754,9 +754,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107969, "tdf107969.docx") DECLARE_OOXMLEXPORT_TEST(testOpenDocumentAsReadOnly, "open-as-read-only.docx") { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - CPPUNIT_ASSERT(pTextDoc->GetDocShell()->IsSecurityOptOpenReadOnly()); + CPPUNIT_ASSERT(getSwDocShell()->IsSecurityOptOpenReadOnly()); } DECLARE_OOXMLEXPORT_TEST(testNoDefault, "noDefault.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index f5968b005358..0b6459f9f5d2 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -370,9 +370,7 @@ DECLARE_OOXMLEXPORT_TEST(testTbrlTextbox, "tbrl-textbox.docx") DECLARE_OOXMLEXPORT_TEST(testBtlrShape, "btlr-textbox.docx") { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); const auto& rFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast(2), rFormats.size()); CPPUNIT_ASSERT_EQUAL(o3tl::narrowing(RES_DRAWFRMFMT), rFormats[0]->Which()); @@ -543,9 +541,7 @@ CPPUNIT_TEST_FIXTURE(Test, tdf123912_protectedForm) { loadAndReload("tdf123912_protectedForm.odt"); CPPUNIT_ASSERT_EQUAL(1, getPages()); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL_MESSAGE("Compatibility: Protect form", true, pDoc->getIDocumentSettingAccess().get( DocumentSettingId::PROTECT_FORM ) ); @@ -601,8 +597,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121867) { loadAndReload("tdf121867.odt"); CPPUNIT_ASSERT_EQUAL(1, getPages()); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwEditShell* pEditShell = pTextDoc->GetDocShell()->GetEditShell(); + SwEditShell* pEditShell = getSwDocShell()->GetEditShell(); CPPUNIT_ASSERT(pEditShell); // Without the accompanying fix in place, this test would have failed with // 'Expected: 3; Actual : 0', i.e. page width zoom was lost on export. diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index b5c47bee7c8d..5e17304587c3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -462,8 +462,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorder) { // Given a document with a negative border distance: createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert(u"test"_ustr); uno::Reference xPageStyle(getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index bb5151098e5d..65f78c7779d4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -77,8 +77,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCellSdtRedline) CPPUNIT_TEST_FIXTURE(Test, testTdf148956_directEndFormatting) { auto verify = [this](bool bIsExport = false) { - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // pWrtShell->EndPara(/*bSelect=*/true); dispatchCommand(mxComponent, u".uno:GotoEndOfPara"_ustr, {}); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx index 52d2e7c2b5e0..6d6462fe42b1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx @@ -610,9 +610,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf95213, "tdf95213.docx") DECLARE_OOXMLEXPORT_TEST(testTdf97371, "tdf97371.docx") { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pShape = pPage->GetObj(0); SdrObject* pTextBox = pPage->GetObj(1); @@ -962,9 +960,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf138093) } else { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), pMarkAccess->getAllMarksCount()); @@ -1062,9 +1058,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf131722) } else { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), pMarkAccess->getFieldmarksCount()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx index f7b87a1fdb8a..d05f809098bd 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx @@ -259,13 +259,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf131728) // original inline paragraph, keeping also ODF ToC/PDF bookmark support. xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); - // This was 22 (the 5 inline headings were not inline, i.e. normal paragraphs) - assertXPath(pXmlDoc, "/w:document/w:body/w:p", 17); - - // Still existing headings (duplicated by alternate content) - assertXPath(pXmlDoc, "//w:p", 27); - assertXPath(pXmlDoc, "//w:txbxContent/w:p", 10); - assertXPath(pXmlDoc, "//w:pStyle[@w:val='Heading2']", 10); + // This was 0 (lost style separators) + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:rPr/w:specVanish", 7); } CPPUNIT_TEST_FIXTURE(Test, testFdo77129) @@ -726,11 +721,8 @@ CPPUNIT_TEST_FIXTURE(Test, tdf122201_editUnprotectedText) loadAndReload("tdf122201_editUnprotectedText.odt"); CPPUNIT_ASSERT_EQUAL(1, getPages()); // get the document - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); + SwDoc* pDoc = getSwDoc(); // get two different nodes SwNodeIndex aDocEnd(pDoc->GetNodes().GetEndOfContent()); @@ -1042,7 +1034,7 @@ CPPUNIT_TEST_FIXTURE(Test, testtdf158044) CPPUNIT_TEST_FIXTURE(Test, testTdf158855) { // Given a table immediately followed by a section break - loadFromFile(u"section_break_after_table.docx"); + createSwDoc("section_break_after_table.docx"); // Check that the import doesn't produce an extra empty paragraph before a page break CPPUNIT_ASSERT_EQUAL(2, getPages()); // was 3 @@ -1061,7 +1053,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf158855) CPPUNIT_TEST_FIXTURE(Test, testTdf158971) { // Given a section break and an SDT in the following paragraph - loadFromFile(u"sdt_after_section_break.docx"); + createSwDoc("sdt_after_section_break.docx"); // Check that the import doesn't introduce unwanted character properties in the paragraph after // the section break @@ -1122,9 +1114,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf158451) DECLARE_OOXMLEXPORT_TEST(testTdf160827, "tdf160827.docx") { // it crashes at import time - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - CPPUNIT_ASSERT(pTextDoc->GetDocShell()->IsSecurityOptOpenReadOnly()); + CPPUNIT_ASSERT(getSwDocShell()->IsSecurityOptOpenReadOnly()); } CPPUNIT_TEST_FIXTURE(Test, testTdf159110) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index b40ec3abc74d..7cee3e4a714e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -722,7 +722,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf162551, "tdf162551_notLayoutInCell_charLeft_from CPPUNIT_TEST_FIXTURE(Test, testTdf159207_footerFramePrBorder) { - loadFromFile(u"tdf159207_footerFramePrBorder.docx"); // re-imports as editeng Frame/Shape + createSwDoc("tdf159207_footerFramePrBorder.docx"); // re-imports as editeng Frame/Shape // given a doc with footer paragraphs frame (with a top border, but no left border) uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); @@ -1063,7 +1063,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128460) CPPUNIT_TEST_FIXTURE(Test, testTdf131288) { // Given a document with an embedded chart - loadFromFile(u"tdf131288.docx"); + createSwDoc("tdf131288.docx"); // Edit the document and save **twice** uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index ff6d169ef39d..cee6baed8a63 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -67,10 +67,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo68787, "fdo68787.docx") DECLARE_OOXMLEXPORT_TEST(testTdf92470_footnoteRestart, "tdf92470_footnoteRestart.docx") { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT( pTextDoc ); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT( pDoc ); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Footnote doesn't restart every Page", FTNNUM_PAGE, pDoc->GetFootnoteInfo().m_eNum ); uno::Reference xPageStyle(getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), uno::UNO_QUERY); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index fa34635dd1ca..475e8be96fd7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -116,24 +116,18 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo79008) assertXPath(pXmlSettings, "/w:comments/w:comment", 1); // Read-only is set, but it is not enforced, so it should be off... - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - CPPUNIT_ASSERT(!pTextDoc->GetDocShell()->IsSecurityOptOpenReadOnly()); + CPPUNIT_ASSERT(!getSwDocShell()->IsSecurityOptOpenReadOnly()); } CPPUNIT_TEST_FIXTURE(Test, testTdf120852_readOnlyProtection) { createSwDoc("tdf120852_readOnlyProtection.docx"); // Read-only is set, so Enforcement must enable it. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - CPPUNIT_ASSERT(pTextDoc->GetDocShell()->IsSecurityOptOpenReadOnly()); + CPPUNIT_ASSERT(getSwDocShell()->IsSecurityOptOpenReadOnly()); saveAndReload(mpFilter); - pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - CPPUNIT_ASSERT(pTextDoc->GetDocShell()->IsSecurityOptOpenReadOnly()); + CPPUNIT_ASSERT(getSwDocShell()->IsSecurityOptOpenReadOnly()); xmlDocUniquePtr pXmlSettings = parseExport(u"word/settings.xml"_ustr); assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "enforcement", u"1"); @@ -146,9 +140,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf120852_readOnlyUnProtected) auto verify = [this](bool bIsExport = false) { // Readonly is not enforced, just a suggestion, // so when a section is protected, the document should enable forms protection. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - CPPUNIT_ASSERT(!pTextDoc->GetDocShell()->IsSecurityOptOpenReadOnly()); + CPPUNIT_ASSERT(!getSwDocShell()->IsSecurityOptOpenReadOnly()); uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY_THROW); uno::Reference xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY_THROW); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 9c12e39f8ba1..fbea0d4816f7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -1055,10 +1055,7 @@ CPPUNIT_TEST_FIXTURE(Test, testExportAdjustmentValue) DECLARE_OOXMLEXPORT_TEST(testTextVerticalAdjustment, "tdf36117_verticalAdjustment.docx") { //Preserve the page vertical alignment setting for .docx - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); + SwDoc* pDoc = getSwDoc(); SwPageDesc* pDesc = &pDoc->GetPageDesc( 0 ); drawing::TextVerticalAdjust nVA = pDesc->GetVerticalAdjustment(); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index fe16a2ed47d2..284cf4a1dd94 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -749,9 +749,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo53985, "fdo53985.docx") uno::Reference xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTables->getCount()); // Only 4 tables were imported. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_MESSAGE("Compatibility: Protect form", pDoc->getIDocumentSettingAccess().get( DocumentSettingId::PROTECT_FORM ) ); uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); @@ -974,9 +972,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN820509) { // M.d.yyyy date format was unhandled. createSwDoc("n820509.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), pMarkAccess->getAllMarksCount()); @@ -1022,8 +1018,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN820509) DECLARE_OOXMLEXPORT_TEST(testTdf151548_activeContentDemo, "tdf151548_activeContentDemo.docm") { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); for(auto aIter = pMarkAccess->getFieldmarksBegin(); aIter != pMarkAccess->getFieldmarksEnd(); ++aIter) { diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index efce589aadb9..4af3730aa9a2 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -116,16 +116,12 @@ CPPUNIT_TEST_FIXTURE(DocmTest, testDocmSave) CPPUNIT_TEST_FIXTURE(DocmTest, testBadDocm) { createSwDoc("bad.docm"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); // This was 'MS Word 2007 XML', broken docm files were not recognized. - CPPUNIT_ASSERT_EQUAL(u"MS Word 2007 XML VBA"_ustr, pTextDoc->GetDocShell()->GetMedium()->GetFilter()->GetName()); + CPPUNIT_ASSERT_EQUAL(u"MS Word 2007 XML VBA"_ustr, getSwDocShell()->GetMedium()->GetFilter()->GetName()); saveAndReload(mpFilter); - pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); // This was 'MS Word 2007 XML', broken docm files were not recognized. - CPPUNIT_ASSERT_EQUAL(u"MS Word 2007 XML VBA"_ustr, pTextDoc->GetDocShell()->GetMedium()->GetFilter()->GetName()); + CPPUNIT_ASSERT_EQUAL(u"MS Word 2007 XML VBA"_ustr, getSwDocShell()->GetMedium()->GetFilter()->GetName()); } CPPUNIT_TEST_FIXTURE(Test, testTdf109063) @@ -912,9 +908,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf55427_footnote2endnote) xPageStyle.set(getStyles(u"ParagraphStyles"_ustr)->getByName(u"Endnote"_ustr), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Endnote style is cyan3 color", Color(0x2BD0D2), getProperty(xPageStyle, u"CharColor"_ustr)); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); // The footnote numbering type of ARABIC will not transfer over when those footnotes are converted to endnotes. CPPUNIT_ASSERT_EQUAL_MESSAGE( "Footnote numbering type", SVX_NUM_ARABIC, pDoc->GetFootnoteInfo().m_aFormat.GetNumberingType() ); // The original document has a real endnote using ROMAN_LOWER numbering, so that setting MUST remain unchanged. diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 3c21e915c4f1..82a90719b25d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -589,9 +589,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtDateDuplicate) } else { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), pMarkAccess->getAllMarksCount()); @@ -801,9 +799,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDateFieldInShape) } else { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), pMarkAccess->getAllMarksCount()); @@ -844,9 +840,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDateFieldAtEndOfParagraph) } else { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), pMarkAccess->getAllMarksCount()); @@ -871,9 +865,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDropDownFieldEntryLimit) // In MSO, there is a limit of 25 for the items in a drop-down form field. // So we truncate the list of items to not exceed this limit. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index dd8224482a66..a8329de27e82 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -627,9 +627,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf112443) createSwDoc("tdf112443.docx"); // the position of the flying text frame should be off page // 30624 below its anchor - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SwRootFrame* pRootFrame = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); const SwRect aPageRect = pRootFrame->getFrameArea(); const SwRect aShapeRect(getShape(1)->getPosition().X, getShape(1)->getPosition().Y, @@ -814,9 +812,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121440) { createSwDoc("tdf121440.docx"); // Insert some text in front of footnote - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwRootFrame* pLayout(pWrtShell->GetLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); pWrtShell->Insert(u"test"_ustr); @@ -852,9 +848,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf127825) createSwDoc("tdf127825.docx"); // The document has a shape with Japanese-style text in it. The shape has relative size and also // has automatic height. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwRootFrame* pLayout = pWrtShell->GetLayout(); CPPUNIT_ASSERT(pLayout); @@ -954,9 +948,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf129659) CPPUNIT_TEST_FIXTURE(Test, testTdf129912) { createSwDoc("tdf129912.docx"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // Goto*FootnoteAnchor iterates the footnotes in a ring, so we need the amount of footnotes to stop the loop diff --git a/sw/qa/extras/pdf/HybridPdfTest.cxx b/sw/qa/extras/pdf/HybridPdfTest.cxx index 0c4e6061c386..840de3298474 100644 --- a/sw/qa/extras/pdf/HybridPdfTest.cxx +++ b/sw/qa/extras/pdf/HybridPdfTest.cxx @@ -47,8 +47,6 @@ void HybridPdfTest::testHybridWithAdditionalStreams() // Load PDF document with an embedded ODT document // The ODT document is embedded in "/AdditionalStreams" structure that is in the PDF trailer createSwDoc("Hybrid_AdditionalStreamsOnly.pdf"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // We can access the document text in a single paragraph that spans multiple rows // This wouldn't be possible with a PDF, so the opened document has to be ODT @@ -62,8 +60,6 @@ void HybridPdfTest::testHybridWithAdditionalStreamsAndAttachedFile() // The ODT document is embedded in "/AdditionalStreams" structure that is in the PDF trailer // and is included as an attached file conforming to the PDF specs createSwDoc("Hybrid_AdditionalStreamsAndPDFAttachedFile.pdf"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // We can access the document text in a single paragraph that spans multiple rows // This wouldn't be possible with a PDF, so the opened document has to be ODT diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index f78ee4d51fcc..6b97dca453aa 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -668,8 +668,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorder) // Given a document with a top margin and a border which has more spacing than the margin on // its 2nd page: createSwDoc(); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert(u"first"_ustr); pWrtShell->SplitNode(); @@ -694,8 +693,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorder) // Then make sure that the border distance is negative, so the first line of body text appears // on top of the page border: - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDocShell* pDocShell = pTextDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); OUString aPageStyle = pWrtShell->GetCurPageStyle(); @@ -798,7 +796,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf152784_1) CPPUNIT_TEST_FIXTURE(Test, testFloatingTableExport) { // Given a document with a floating table: - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); + createSwDoc(); // Insert a table: uno::Sequence aArgs = { comphelper::makePropertyValue(u"Rows"_ustr, static_cast(1)), diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 1a695a62110d..29e3d4201860 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -157,9 +157,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCjklist31) CPPUNIT_TEST_FIXTURE(Test, test148518) { auto verify = [this]() { - SwXTextDocument* const pTextDoc(dynamic_cast(mxComponent.get())); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* const pDoc(pTextDoc->GetDocShell()->GetDoc()); + SwDoc* const pDoc(getSwDoc()); CPPUNIT_ASSERT(pDoc->getIDocumentMarkAccess()->getFieldmarksBegin() != pDoc->getIDocumentMarkAccess()->getFieldmarksEnd()); @@ -319,8 +317,7 @@ CPPUNIT_TEST_FIXTURE(Test, test150382) CPPUNIT_TEST_FIXTURE(Test, testAnchoredAtSamePosition) { auto verify = [this](bool bIsExport = false) { - SwXTextDocument* const pTextDoc = dynamic_cast(mxComponent.get()); - SwDoc* const pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* const pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(u"foobar"_ustr, getParagraph(1)->getString()); @@ -743,9 +740,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126309) CPPUNIT_TEST_FIXTURE(Test, testTdf116358) { auto verify = [this]() { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // Insert a paragraph break diff --git a/sw/qa/extras/rtfimport/data/tdf160553.rtf b/sw/qa/extras/rtfimport/data/tdf160553.rtf new file mode 100644 index 000000000000..2e7b26db4e70 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf160553.rtf @@ -0,0 +1,20 @@ +{\rtf1 + + +\trowd \cellx6096\cellx9356 +\intbl 1\cell +\intbl 2\cell +\trowd \cellx6096\cellx9356 +\row +\pard HELLO\par + +\sect\sectd + +\trowd \cellx6096\cellx9356 +\intbl 1\cell +\intbl 2\cell +\trowd \cellx6096\cellx9356 +\row +\pard + +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 4ff36a7f7988..25a93bd2db23 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1942,6 +1942,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf152839) uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable->getCellNames().getLength()); } + +CPPUNIT_TEST_FIXTURE(Test, test160553Tdf) +{ + createSwDoc("tdf160553.rtf"); + // new section should create second page + CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + // tests should only be added to rtfIMPORT *if* they fail round-tripping in rtfEXPORT } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 77a8e53cc4c0..5fb832b66b29 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -2712,6 +2712,21 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testIMEFormattingAtEndOfParagraph) // check the content CPPUNIT_ASSERT_EQUAL(u"bab"_ustr, pShellCursor->GetPoint()->GetNode().GetTextNode()->GetText()); + + // check the actual weight format of the text + SvxWeightItem aBoldWeightItem(WEIGHT_BOLD, RES_CHRATR_WEIGHT); + SfxItemSet aSet(pXTextDocument->GetDocShell()->GetDoc()->GetAttrPool(), svl::Items); + pShellCursor->GetPoint()->GetNode().GetTextNode()->GetParaAttr(aSet, 0, 1); + SfxPoolItem const* pPoolItem = aSet.GetItem(RES_CHRATR_WEIGHT); + CPPUNIT_ASSERT(*pPoolItem != aBoldWeightItem); // b not bold + aSet.ClearItem(); + pShellCursor->GetPoint()->GetNode().GetTextNode()->GetParaAttr(aSet, 1, 2); + pPoolItem = aSet.GetItem(RES_CHRATR_WEIGHT); + CPPUNIT_ASSERT(*pPoolItem == aBoldWeightItem); // a bold + aSet.ClearItem(); + pShellCursor->GetPoint()->GetNode().GetTextNode()->GetParaAttr(aSet, 2, 3); + pPoolItem = aSet.GetItem(RES_CHRATR_WEIGHT); + CPPUNIT_ASSERT(*pPoolItem != aBoldWeightItem); // b not bold } CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testIMEFormattingAfterHeader) diff --git a/sw/qa/extras/tiledrendering2/data/format-insert-list.docx b/sw/qa/extras/tiledrendering2/data/format-insert-list.docx new file mode 100644 index 000000000000..636fde813f60 Binary files /dev/null and b/sw/qa/extras/tiledrendering2/data/format-insert-list.docx differ diff --git a/sw/qa/extras/tiledrendering2/tiledrendering2.cxx b/sw/qa/extras/tiledrendering2/tiledrendering2.cxx index fdf8efe8126e..305bb60b7694 100644 --- a/sw/qa/extras/tiledrendering2/tiledrendering2.cxx +++ b/sw/qa/extras/tiledrendering2/tiledrendering2.cxx @@ -15,6 +15,8 @@ #include #include +#include +#include #include #include #include @@ -377,6 +379,30 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSignatureState) // i.e. the doc was modified by the time the signature state was calculated. CPPUNIT_ASSERT_EQUAL(SignatureState::NOTVALIDATED, eState); } + +CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testFormatInsertStartList) +{ + // Given a document containing a list where the text has a changed font + SwXTextDocument* pXTextDocument = createDoc("format-insert-list.docx"); + CPPUNIT_ASSERT(pXTextDocument); + VclPtr pDocWindow = pXTextDocument->getDocWindow(); + SwView* pView = dynamic_cast(SfxViewShell::Current()); + assert(pView); + + // Insert a string at the beginning of a list item + pDocWindow->PostExtTextInputEvent(VclEventId::ExtTextInput, u"a"_ustr); + pDocWindow->PostExtTextInputEvent(VclEventId::EndExtTextInput, u""_ustr); + Scheduler::ProcessEventsToIdle(); + + // The inserted text should have the same font as the rest + std::unique_ptr pFontItem; + pView->GetViewFrame().GetBindings().QueryState(SID_ATTR_CHAR_FONT, pFontItem); + CPPUNIT_ASSERT(pFontItem); + CPPUNIT_ASSERT_EQUAL(u"Calibri"_ustr, pFontItem->GetFamilyName()); + // Without the accompanying fix in place, this test fails with: + // - Expected: Calibri + // - Actual : MS Sans Serif +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/txtimport/txtimport.cxx b/sw/qa/extras/txtimport/txtimport.cxx index 575b6a8d7dfd..514f05c9e704 100644 --- a/sw/qa/extras/txtimport/txtimport.cxx +++ b/sw/qa/extras/txtimport/txtimport.cxx @@ -53,10 +53,7 @@ public: CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf112191) { createSwDoc("bullets.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); + SwDoc* pDoc = getSwDoc(); // just the 5th paragraph - no bullet uno::Reference xPara(getParagraph(5)); @@ -83,10 +80,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf112191) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withoutbom) { createSwDoc("UTF8WITHOUTBOM.txt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference xPara(getParagraph(1)); @@ -96,10 +89,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withoutbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withbom) { createSwDoc("UTF8WITHBOM.txt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference xPara(getParagraph(1)); @@ -109,10 +98,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithoutbom) { createSwDoc("UTF16LEWITHOUTBOM.txt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference xPara(getParagraph(1)); @@ -122,10 +107,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithoutbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithbom) { createSwDoc("UTF16LEWITHBOM.txt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference xPara(getParagraph(1)); @@ -135,10 +116,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf92161_gb18030) { createSwDoc("GB18030.txt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference xPara(getParagraph(1)); @@ -148,10 +125,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf92161_gb18030) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithoutbom) { createSwDoc("UTF16BEWITHOUTBOM.txt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference xPara(getParagraph(1)); @@ -161,10 +134,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithoutbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithbom) { createSwDoc("UTF16BEWITHBOM.txt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference xPara(getParagraph(1)); @@ -174,8 +143,7 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf115088) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"1"_ustr); pWrtShell->SplitNode(); pWrtShell->Insert(u"1"_ustr); @@ -196,10 +164,8 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf115088) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf70423) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); constexpr sal_Int32 size = 30000; // It should be multiple of 10 constexpr sal_Int32 parts = size / 10; diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index e8c1b130b060..2e3904450545 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -106,8 +106,7 @@ std::unique_ptr SwUiWriterTest::readDOCXAutotext(std::u16string_vi void SwUiWriterTest::testRedlineFrame(char const*const file) { createSwDoc(file); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // there is exactly one frame CPPUNIT_ASSERT_EQUAL(1, getShapes()); @@ -213,9 +212,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testThreadedException) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf149595) { createSwDoc("demo91.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // all 4 shapes are on the 2nd paragraph CPPUNIT_ASSERT(pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower()->GetDrawObjs() == nullptr); @@ -322,7 +320,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testPasteTableAtFlyAnchor) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR); anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint()); @@ -380,9 +378,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCopyPastePageBreak) { { createSwDoc("pagebreak-source.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(tools::Long(5669), pWrtShell->GetLayout()->GetLower()->getFramePrintArea().Top()); pWrtShell->SelAll(); @@ -394,7 +391,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCopyPastePageBreak) createSwDoc("pagebreak-target.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); CPPUNIT_ASSERT_EQUAL(u"WithMargin"_ustr, getProperty(getParagraph(1), u"PageDescName"_ustr)); @@ -500,8 +497,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFormulaNumberWithGroupSeparator) { createSwDoc("tdf125154.odt"); dispatchCommand(mxComponent, u".uno:UpdateAll"_ustr, {}); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(true); SwField const* pField; @@ -565,7 +561,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf67238) //create a new writer document createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); //insert a 3X3 table in the newly created document SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0); @@ -657,8 +653,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf67238) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf155685) { createSwDoc("table-at-end-of-cell.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->GoNextCell(); pWrtShell->GoNextCell(); pWrtShell->GoNextCell(); @@ -676,7 +671,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf147220) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"él"_ustr); @@ -714,7 +709,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf135978) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"foobar"_ustr); pWrtShell->SplitNode(); @@ -766,7 +761,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo75110) { createSwDoc("fdo75110.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SelAll(); // The problem was that SwEditShell::DeleteSel() what this Delete() invokes took the wrong selection... @@ -779,8 +774,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo75110) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo75898) { createSwDoc("fdo75898.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SelAll(); pWrtShell->InsertRow(1, true); pWrtShell->InsertRow(1, true); @@ -820,8 +814,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testReplaceBackward) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo69893) { createSwDoc("fdo69893.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SelAll(); // A1 is empty -> selects the whole table. pWrtShell->SelAll(); // Selects the whole document. @@ -865,7 +858,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testImportRTF) // Insert "foobar" and position the cursor between "foo" and "bar". createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"foobar"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 3, /*bBasicCall=*/false); @@ -886,8 +879,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testExportRTF) { // Insert "aaabbbccc" and select "bbb". createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"aaabbbccc"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 3, /*bBasicCall=*/false); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 3, /*bBasicCall=*/false); @@ -1005,8 +997,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testDOCXAutoTextGallery) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testWatermarkDOCX) { createSwDoc("watermark.docx"); - SwDoc* const pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SfxPoolItemHolder aResult; SfxItemState eState = pDocShell->GetViewShell()->GetViewFrame().GetDispatcher()->QueryState(SID_WATERMARK, aResult); const SfxWatermarkItem* pWatermark(static_cast(aResult.getItem())); @@ -1038,8 +1029,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testWatermarkPosition) SwDoc* pDoc = getSwDoc(); SwEditShell* pEditShell = pDoc->GetEditShell(); CPPUNIT_ASSERT(pEditShell); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - rtl::Reference xModel = pDoc->GetDocShell()->GetBaseModel(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + rtl::Reference xModel = getSwDocShell()->GetBaseModel(); uno::Reference xStyleFamilies = xModel->getStyleFamilies(); // 1. Add additional page breaks @@ -1103,7 +1094,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo74981) // create a document with an input field createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwInputField aField(static_cast(pWrtShell->GetFieldType(0, SwFieldIds::Input)), u"foo"_ustr, u"bar"_ustr, 0, 0); pWrtShell->InsertField2(aField); @@ -1133,7 +1124,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf98512) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwInputFieldType *const pType(static_cast( pWrtShell->GetFieldType(0, SwFieldIds::Input))); SwInputField aField1(pType, u"foo"_ustr, u"bar"_ustr, INP_TXT, 0); @@ -1172,7 +1163,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testShapeTextboxSelect) { createSwDoc("shape-textbox.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(1); SwContact* pTextBox = static_cast(pObject->GetUserCall()); @@ -1191,7 +1182,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testShapeTextboxDelete) { createSwDoc("shape-textbox.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); pWrtShell->SelectObj(Point(), 0, pObject); @@ -1209,7 +1200,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testAnchorChangeSelection) { createSwDoc("test_anchor_as_character.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); CPPUNIT_ASSERT(pObject); @@ -1229,7 +1220,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCp1000071) { createSwDoc("cp1000071.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); CPPUNIT_ASSERT_EQUAL( SwRedlineTable::size_type( 2 ), rTable.size()); @@ -1245,7 +1236,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCp1000071) // Change the document layout to be 2 columns, and then undo. pWrtShell->SelAll(); SwSectionData section(SectionType::Content, pWrtShell->GetUniqueSectionName()); - SfxItemSet set( pDoc->GetDocShell()->GetPool(), svl::Items ); + SfxItemSet set( getSwDocShell()->GetPool(), svl::Items ); SwFormatCol col; col.Init( 2, 0, 10000 ); set.Put( col ); @@ -1304,7 +1295,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo82191) CPPUNIT_ASSERT_EQUAL(sal_Int32(1), SwTextBoxHelper::getCount(pPage)); SwDoc aClipboard; - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SdrObject* pObject = pPage->GetObj(0); // Select it, then copy and paste. pWrtShell->SelectObj(Point(), 0, pObject); @@ -1320,8 +1311,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCommentedWord) // This word is commented. <- string in document // 123456789 <- character positions createSwDoc("commented-word.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Move the cursor into the second word. pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 5, /*bBasicCall=*/false); // Select the word. @@ -1360,7 +1350,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testChineseConversionBlank) // Given createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwPaM aPaM(aIdx); @@ -1384,7 +1374,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testChineseConversionNonChineseText) // Given createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwPaM aPaM(aIdx); @@ -1409,7 +1399,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testChineseConversionTraditionalToSimplifie // Given createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwPaM aPaM(aIdx); @@ -1434,7 +1424,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testChineseConversionSimplifiedToTraditiona // Given createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwPaM aPaM(aIdx); @@ -1476,7 +1466,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo85554) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testMergeDoc) { createSwDoc("merge-change1.odt"); - SwDoc* pDoc1 = getSwDoc(); + SwDoc* pDoc = getSwDoc(); auto xDoc2Component(loadFromDesktop( createFileURL(u"merge-change2.odt"), @@ -1486,7 +1476,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testMergeDoc) CPPUNIT_ASSERT(pxDoc2Document); SwDoc* const pDoc2(pxDoc2Document->GetDocShell()->GetDoc()); - SwEditShell* const pEditShell(pDoc1->GetEditShell()); + SwEditShell* const pEditShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pEditShell); pEditShell->MergeDoc(*pDoc2); @@ -1562,7 +1552,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf148389_Left) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); pWrtShell->Insert(u"foo bar baz"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 4, /*bBasicCall=*/false); @@ -1625,7 +1615,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf148389_Right) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); pWrtShell->Insert(u"foo bar baz"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 4, /*bBasicCall=*/false); @@ -1715,8 +1705,7 @@ static void lcl_setWeight(SwWrtShell* pWrtShell, FontWeight aWeight) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo85876) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); lcl_setWeight(pWrtShell, WEIGHT_BOLD); pWrtShell->Insert(u"test"_ustr); lcl_setWeight(pWrtShell, WEIGHT_NORMAL); @@ -1744,8 +1733,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo85876) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCaretPositionMovingUp) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"after"_ustr); pWrtShell->InsertLineBreak(); pWrtShell->Up(false); @@ -1757,8 +1745,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCaretPositionMovingUp) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf93441) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"Hello"_ustr); pWrtShell->InsertLineBreak(); pWrtShell->Insert(u"Hello World"_ustr); @@ -1774,8 +1761,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf93441) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf81226) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"before"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 4, /*bBasicCall=*/false); pWrtShell->Down(false); @@ -1790,8 +1776,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf81226) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf137532) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"test"_ustr); //Select the word and change it to bold @@ -1872,8 +1857,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo87448) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTextCursorInvalidation) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); uno::Reference xPageStyle(getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), uno::UNO_QUERY); CPPUNIT_ASSERT(xPageStyle.is()); xPageStyle->setPropertyValue(u"HeaderIsOn"_ustr, uno::Any(true)); @@ -1897,7 +1881,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf68183) createSwDoc(); SwDoc* pDoc = getSwDoc(); SW_MOD()->GetModuleConfig()->SetStoreRsid(false); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert2(u"X"_ustr); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); @@ -1929,7 +1913,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf63214) //This is a crash test createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); pWrtShell->Insert(u"V"_ustr); { //limiting the lifetime of SwPaM with a nested scope @@ -1966,7 +1950,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf51741) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); SwPaM aPaM( SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1) ); @@ -2054,7 +2038,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testDeleteTableRedlines) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0); const SwTable& rTable = pWrtShell->InsertTable(TableOpt, 1, 3); uno::Reference xTable(getParagraphOrTable(1), uno::UNO_QUERY); @@ -2073,8 +2057,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testDeleteTableRedlines) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testXFlatParagraph) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); //Inserting some text in the document pWrtShell->Insert(u"This is sample text"_ustr); pWrtShell->SplitNode(); diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 097aef653a88..d6c66cb7a47b 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -58,8 +58,7 @@ protected: CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground) { createSwDoc("tdf47471_paraStyleBackground.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(u"00Background"_ustr, getProperty(getParagraph(2), u"ParaStyleName"_ustr)); @@ -128,9 +127,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdfChangeNumberingListAutoFormat) // save it to DOCX saveAndReload(u"Office Open XML Text"_ustr); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); pViewShell->Reformat(); pXmlDoc = parseLayoutDump(); // this was 220 @@ -144,8 +141,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf101534) { // Copy the first paragraph of the document. createSwDoc("tdf101534.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->EndPara(/*bSelect=*/true); dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); @@ -173,12 +169,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf101534) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testExtendedSelectAllHang) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertFootnote(u""_ustr); pWrtShell->StartOfSection(); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); SfxStringItem aLangString(SID_LANGUAGE_STATUS, u"Default_Spanish (Bolivia)"_ustr); // this looped pView->GetViewFrame().GetDispatcher()->ExecuteList(SID_LANGUAGE_STATUS, SfxCallMode::SYNCHRON, @@ -188,8 +183,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testExtendedSelectAllHang) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineMoveInsertInDelete) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u" foo"_ustr); pWrtShell->SttEndDoc(true); @@ -222,8 +216,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineMoveInsertInDelete) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineInHiddenSection) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SplitNode(); pWrtShell->Insert(u"foo"_ustr); @@ -281,7 +274,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineSplitContentNode) { createSwDoc("try2.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); SwViewOption aViewOptions(*pWrtShell->GetViewOptions()); // these are required so that IsBlank() is true @@ -321,7 +314,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137318) { createSwDoc(); SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"A"_ustr); @@ -396,8 +389,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137318) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136704) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); corr.GetSwFlags().bReplaceStyles = true; SvxSwAutoFormatFlags flags(*SwEditShell::GetAutoFormatFlags()); @@ -483,9 +475,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf134250) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf134436) { createSwDoc("tdf134436.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -615,7 +606,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136452) SwNodeOffset const nNodes(pDoc->GetNodes().Count()); - SwWrtShell* const pWrtShell(pDoc->GetDocShell()->GetWrtShell()); + SwWrtShell* const pWrtShell(getSwDocShell()->GetWrtShell()); // first deletion spanning 2 sections pWrtShell->SttEndDoc(false); @@ -659,7 +650,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136453) { createSwDoc("tdf136453.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell(pDoc->GetDocShell()->GetWrtShell()); + SwWrtShell* const pWrtShell(getSwDocShell()->GetWrtShell()); SwNodeOffset const nNodes(pDoc->GetNodes().Count()); @@ -705,7 +696,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137245) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); corr.GetSwFlags().bSetBorder = true; // sigh, it's a global... err i mean Singleton design pattern *eyeroll* @@ -788,7 +779,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf132236) SwDoc* pDoc = getSwDoc(); // select everything and delete - SwWrtShell* const pWrtShell(pDoc->GetDocShell()->GetWrtShell()); + SwWrtShell* const pWrtShell(getSwDocShell()->GetWrtShell()); pWrtShell->Down(true); pWrtShell->Down(true); pWrtShell->Down(true); @@ -807,7 +798,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf131912) { createSwDoc(); SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); @@ -956,7 +947,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140007) { createSwDoc(); SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"foo"_ustr); pWrtShell->SplitNode(); @@ -1031,7 +1022,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139982) { createSwDoc(); SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); // turn on redlining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -1082,7 +1073,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf135976) { createSwDoc(); SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"foobar"_ustr); @@ -1212,7 +1203,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf39721) CPPUNIT_ASSERT_EQUAL(u"dolor sit"_ustr, getParagraph(2)->getString()); // move down second paragraph with change tracking - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Up(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); @@ -1248,7 +1239,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf145066_bad_paragraph_deletion) CPPUNIT_ASSERT_EQUAL(3, getParagraphs()); // move down once and move up two times second paragraph with change tracking - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); dispatchCommand(mxComponent, u".uno:MoveDown"_ustr, {}); dispatchCommand(mxComponent, u".uno:MoveUp"_ustr, {}); @@ -1324,7 +1315,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf54819) pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // remove first paragraph with paragraph break - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->EndPara(/*bSelect=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); dispatchCommand(mxComponent, u".uno:Cut"_ustr, {}); @@ -1364,7 +1355,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf54819_keep_numbering_with_Undo) pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // remove heading with paragraph break - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); @@ -1401,7 +1392,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf54819_keep_numbering_with_Undo) // heading, manual test is correct // TODO: it works well, but the test fails... - // SwWrtShell* const pWrtShell2 = pDoc->GetDocShell()->GetWrtShell(); + // SwWrtShell* const pWrtShell2 = getSwDocShell()->GetWrtShell(); // CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), // getProperty(getParagraph(2), "ParaStyleName")); // CPPUNIT_ASSERT_EQUAL(OUString("Outline"), @@ -1455,7 +1446,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119571_keep_numbering_with_Undo) pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // remove only end part of the heading and the next numbered paragraph with paragraph break - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); @@ -1557,7 +1548,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119571_keep_numbering_with_Reject) pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // remove only end part of the heading and the next numbered paragraph with paragraph break - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); @@ -1611,7 +1602,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140077) createSwDoc(); SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); // hide dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {}); @@ -1649,7 +1640,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376_redline) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // need 2 paragraphs to get to the bMoveNds case pWrtShell->Insert(u"foo"_ustr); @@ -1700,7 +1691,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // need 2 paragraphs to get to the bMoveNds case pWrtShell->Insert(u"foo"_ustr); @@ -1747,7 +1738,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147414) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); pWrtShell->Insert(u"Abc"_ustr); @@ -1777,8 +1768,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147414) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147310) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // somehow bug happens only with 2 tables @@ -1835,8 +1825,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf80194_autoSubscript) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf64242_optimizeTable) { createSwDoc("tdf64242_optimizeTable.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTablesSupplier->getTextTables(), @@ -1879,8 +1868,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf64242_optimizeTable) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf45525) { createSwDoc("tdf45525.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTablesSupplier->getTextTables(), @@ -1913,8 +1901,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf45525) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126784_distributeSelectedColumns) { createSwDoc("tdf126784_distributeSelectedColumns.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTablesSupplier->getTextTables(), @@ -1941,8 +1928,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126784_distributeSelectedColumns) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf144317) { createSwDoc("tdf144317.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTablesSupplier->getTextTables(), @@ -1972,8 +1958,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf144317) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf108687_tabstop) { createSwDoc("tdf108687_tabstop.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwNodeOffset nStartIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex(); CPPUNIT_ASSERT_EQUAL(SwNodeOffset(9), nStartIndex); @@ -2007,7 +1992,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119571) IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // join paragraphs by removing the end of the first one with paragraph break - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->EndPara(/*bSelect=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); @@ -2039,7 +2024,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf144058) // join first and last but one paragraphs by removing the end of the first paragraph // with paragraph break, and by removing two tables of the selected range completely - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->Down(/*bSelect=*/true); pWrtShell->Down(/*bSelect=*/true); @@ -2080,7 +2065,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119019) { // check handling of overlapping redlines createSwDoc("tdf119019.docx"); - SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(u"Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus."_ustr, getParagraph(2)->getString()); @@ -2090,7 +2074,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119019) // delete last word of the second paragraph to remove tracked paragraph formatting // of this paragraph to track and show word deletion correctly. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); @@ -2129,7 +2113,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119824) // delete last word of the third paragraph to remove tracked paragraph formatting // of this paragraph to track and show word deletion correctly. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); @@ -2190,7 +2174,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf105413) IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // Set Heading 1 paragraph style in the 3th paragraph. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); pWrtShell->EndPara(/*bSelect=*/false); @@ -2210,7 +2194,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf105413) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817) { createSwDoc("num-parent-style.docx"); - SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(u"Heading 2"_ustr, getProperty(getParagraph(2), u"ParaStyleName"_ustr)); @@ -2228,7 +2211,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817) // set Heading 2 style of paragraph 2 to Heading 1 - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); uno::Sequence aPropertyValues = comphelper::InitPropertySequence({ @@ -2292,9 +2275,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817_round_trip) // save it to DOCX saveAndReload(u"Office Open XML Text"_ustr); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); pViewShell->Reformat(); CPPUNIT_ASSERT_EQUAL(u"Heading 2"_ustr, @@ -2313,7 +2294,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817_round_trip) // set Heading 2 style of paragraph 2 to Heading 1 - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); uno::Sequence aPropertyValues = comphelper::InitPropertySequence({ @@ -2373,7 +2354,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817_round_trip) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817_custom_outline) { createSwDoc("tdf76817.docx"); - SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(u"Heading 1"_ustr, getProperty(getParagraph(1), u"ParaStyleName"_ustr)); @@ -2400,7 +2380,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817_custom_outline) // set Heading 2 style of paragraph 2 to Heading 1 - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); uno::Sequence aPropertyValues = comphelper::InitPropertySequence({ @@ -2441,8 +2421,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButtonSmallTable) { // The floating table in the test document is too small, so we don't provide an unfloat button createSwDoc("small_floating_table.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); const SwSortedObjs* pAnchored @@ -2474,8 +2453,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButton) OString sFailureMessage = OString::Concat("Failure in the test file: ") + sTestFileName; createSwDoc(sTestFileName.getStr()); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_MESSAGE(sFailureMessage.getStr(), pWrtShell); const SwSortedObjs* pAnchored; @@ -2502,8 +2480,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButtonReadOnlyMode) { // In read only mode we don't show the unfloat button even if we have a multipage floating table createSwDoc("unfloatable_floating_table.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); pWrtShell->SetReadonlyOption(true); @@ -2537,8 +2514,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloating) // Test what happens when pushing the unfloat button createSwDoc(sTestFileName.getStr()); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_MESSAGE(sFailureMessage.getStr(), pWrtShell); SwFlyFrame* pFlyFrame; @@ -2634,7 +2610,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122893) IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // Set center-aligned paragraph with preset double line spacing in the 3th paragraph. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); pWrtShell->EndPara(/*bSelect=*/false); @@ -2679,7 +2655,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122901) // Increase paragraph borders in the 3th paragraph, similar to the default icon of the UI // "Increase Paragraph Spacing". - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); pWrtShell->Down(/*bSelect=*/false); pWrtShell->EndPara(/*bSelect=*/false); @@ -2700,7 +2676,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122942) { createSwDoc("tdf122942.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Do the moral equivalent of mouse button down, move and up. // Start creating a custom shape that overlaps with the rounded rectangle @@ -2754,12 +2730,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf132160) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137526) { createSwDoc("tdf132160.odt"); - SwDoc* pDoc = getSwDoc(); // switch on "Show changes in margin" mode dispatchCommand(mxComponent, u".uno:ShowChangesInMargin"_ustr, {}); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); // select and delete a word @@ -2779,12 +2754,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137526) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137684) { createSwDoc("tdf132160.odt"); - SwDoc* pDoc = getSwDoc(); // switch on "Show changes in margin" mode dispatchCommand(mxComponent, u".uno:ShowChangesInMargin"_ustr, {}); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); // select and delete a word letter by letter @@ -2809,12 +2783,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137684) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137503) { createSwDoc("tdf132160.odt"); - SwDoc* pDoc = getSwDoc(); // switch on "Show changes in margin" mode dispatchCommand(mxComponent, u".uno:ShowChangesInMargin"_ustr, {}); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); // select and delete the first two paragraphs @@ -2841,7 +2814,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138605) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowInsert @@ -2869,12 +2842,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138605) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138135) { createSwDoc("tdf132160.odt"); - SwDoc* pDoc = getSwDoc(); // switch on "Show changes in margin" mode dispatchCommand(mxComponent, u".uno:ShowChangesInMargin"_ustr, {}); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); // select and delete a word letter by letter by using backspace @@ -2913,12 +2885,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf52391) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137771) { createSwDoc("tdf132160.odt"); - SwDoc* pDoc = getSwDoc(); // switch on "Show changes in margin" mode dispatchCommand(mxComponent, u".uno:ShowChangesInMargin"_ustr, {}); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); // delete a word at the end of the paragraph. @@ -2931,7 +2902,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137771) CPPUNIT_ASSERT(getParagraph(1)->getString().endsWith("to be ")); // Dump the rendering of the first page as an XML file. - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); @@ -2971,7 +2942,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf142130) IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // Dump the rendering of the first page as an XML file. - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); @@ -3012,7 +2983,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf142196) IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // Dump the rendering of the first page as an XML file. - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; @@ -3057,7 +3028,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf142700) IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // Dump the rendering of the first page as an XML file. - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; @@ -3096,7 +3067,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139120) // switch on "Show changes in margin" mode dispatchCommand(mxComponent, u".uno:ShowChangesInMargin"_ustr, {}); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); // turn on red-lining and show changes @@ -3126,7 +3097,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139120) CPPUNIT_ASSERT_EQUAL(u"dolor sit amet."_ustr, getParagraph(2)->getString()); // Dump the rendering of the first page as an XML file. - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); @@ -3148,7 +3119,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testJoinParaChangesInMargin) // switch on "Show changes in margin" mode dispatchCommand(mxComponent, u".uno:ShowChangesInMargin"_ustr, {}); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); // turn on red-lining and show changes @@ -3186,7 +3157,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140757) // switch on "Show changes in margin" mode dispatchCommand(mxComponent, u".uno:ShowChangesInMargin"_ustr, {}); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); // turn on red-lining and show changes diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 6a50c1ba1260..cbd860f0aabf 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -45,8 +45,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testPlaceholderHTMLPaste) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"AAA"_ustr); pWrtShell->SplitNode(); pWrtShell->Insert(u"BBB"_ustr); @@ -60,8 +59,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testPlaceholderHTMLPaste) createSwDoc("placeholder-bold.fodt"); // select placeholder field - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 5, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); @@ -343,8 +341,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf114973) { createSwDoc("tdf114973.fodt"); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(true); dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); @@ -679,8 +676,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147126) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf148868) { createSwDoc("tdf148868.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); @@ -1019,7 +1015,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf61154) { createSwDoc("tdf61154.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->GotoNextTOXBase(); @@ -1077,7 +1073,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf100691) { createSwDoc("tdf100691.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->GotoNextTOXBase(); @@ -1154,8 +1150,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132321) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135056) { createSwDoc("tdf135056.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pWrtShell->GetTOXCount()); @@ -1230,8 +1225,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf150845) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147961) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextTablesSupplier->getTextTables(), @@ -1253,7 +1247,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147206) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // insert empty paragraph and heading text pWrtShell->SplitNode(); @@ -1321,6 +1315,50 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147206) u"HyperLinkURL"_ustr)); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf48459) +{ + createSwDoc(); + SwDoc* pDoc = getSwDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + + // insert paragraph text + pWrtShell->Insert(u"Heading and normal text"_ustr); + + // select the first word (proposed for inline heading) + pWrtShell->SttEndDoc(/*bStart=*/true); + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 7, /*bBasicCall=*/false); + + // apply styles only on the selected word -> create inline heading + uno::Sequence aPropertyValues = comphelper::InitPropertySequence({ + { "Style", uno::Any(u"Heading 1"_ustr) }, + { "FamilyName", uno::Any(u"ParagraphStyles"_ustr) }, + }); + dispatchCommand(mxComponent, u".uno:StyleApply"_ustr, aPropertyValues); + + uno::Reference xFrames = mxDesktop->getFrames(); + + // inline heading frame + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFrames->getCount()); + + pWrtShell->EndOfSection(false); + + // insert table of contents to check ToC content (containing only the inline heading) + SwTOXMgr mgr(pWrtShell); + SwTOXDescription desc{ TOX_CONTENT }; + mgr.UpdateOrInsertTOX(desc, nullptr, nullptr); + + CPPUNIT_ASSERT_EQUAL(int(3), getParagraphs()); + + // first paragraph: selected text moved to the inline heading frame + CPPUNIT_ASSERT_EQUAL(u" and normal text"_ustr, getParagraph(1)->getString()); + + // ToC title + CPPUNIT_ASSERT_EQUAL(u"Table of Contents"_ustr, getParagraph(2)->getString()); + + // ToC contains only the inline heading + CPPUNIT_ASSERT_EQUAL(u"Heading\t1"_ustr, getParagraph(3)->getString()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf144840) { createSwDoc("tdf144840.odt"); @@ -1479,8 +1517,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132187) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130094) { createSwDoc("tdf130094.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(u"First"_ustr, getParagraph(1)->getString()); CPPUNIT_ASSERT_EQUAL(u"Second"_ustr, getParagraph(2)->getString()); @@ -1520,8 +1557,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130094) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135733) { createSwDoc("tdf135733.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextTablesSupplier->getTextTables(), @@ -1606,9 +1642,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf124722) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) { createSwDoc("udindex3.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - SwView& rView(*pDoc->GetDocShell()->GetView()); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + SwView& rView(*getSwDocShell()->GetView()); // update indexes for (auto i = pWrtShell->GetTOXCount(); 0 < i;) @@ -2409,8 +2444,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf111969_lastHalfcharOfSelection) // Given a document with a selected character, // the last half of the character should also be considered to be "in the selection" createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); // move the cursor after the "o" (this is better/safer than testing cursor at end of paragraph) pWrtShell->Insert2(u"Hello!"_ustr); diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index 799012659a54..f758effa8ec5 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -96,8 +96,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96515) { // Enable hide whitespace mode. createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwViewOption aViewOptions(*pWrtShell->GetViewOptions()); aViewOptions.SetHideWhitespaceMode(true); pWrtShell->ApplyViewOptions(aViewOptions); @@ -118,7 +117,7 @@ static OUString lcl_translitTest(SwDoc& rDoc, const SwPaM& rPaM, Transliteration { utl::TransliterationWrapper aTrans(::comphelper::getProcessComponentContext(), nType); rDoc.getIDocumentContentOperations().TransliterateText(rPaM, aTrans); - //SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + //SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); return rPaM.GetMarkNode().GetTextNode()->GetText(); } @@ -126,9 +125,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf146449) { createSwDoc("tdf146449.odt"); - auto pDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pDoc); - auto pShell = pDoc->GetDocShell()->GetFEShell(); + auto pShell = getSwDocShell()->GetFEShell(); CPPUNIT_ASSERT(pShell); auto xTextBox = getShapeByName(u"Frame1"); @@ -154,7 +151,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf49033) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Insert the test text at the end of the document. pWrtShell->SttEndDoc(/*bStt=*/false); @@ -329,7 +326,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf147196) using TF = TransliterationFlags; createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Insert the test text at the end of the document. pWrtShell->SttEndDoc(/*bStt=*/false); @@ -364,7 +361,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf148148) using TF = TransliterationFlags; createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Insert(u" text"_ustr); @@ -387,7 +384,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf148148) /* Test what happens when node contains text but selection does not contain any text */ createSwDoc(); pDoc = getSwDoc(); - pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Insert(u"text "_ustr); @@ -413,7 +410,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf148148) /* Test what happens when node contains only non-word text but selection does not contain any text */ createSwDoc(); pDoc = getSwDoc(); - pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Insert(u"-1 "_ustr); @@ -436,7 +433,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf148148) createSwDoc(); pDoc = getSwDoc(); - pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Insert(u" -1"_ustr); @@ -456,7 +453,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf148148) /* Test what happens when node and selection contains only non-word text */ createSwDoc(); pDoc = getSwDoc(); - pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Insert(u" -1"_ustr); @@ -478,8 +475,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96943) { // Enable hide whitespace mode. createSwDoc("tdf96943.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwViewOption aViewOptions(*pWrtShell->GetViewOptions()); aViewOptions.SetHideWhitespaceMode(true); pWrtShell->ApplyViewOptions(aViewOptions); @@ -496,8 +492,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96536) { // Enable hide whitespace mode. createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwViewOption aViewOptions(*pWrtShell->GetViewOptions()); aViewOptions.SetHideWhitespaceMode(true); pWrtShell->ApplyViewOptions(aViewOptions); @@ -651,8 +646,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testBookmarkCollapsed) { // load document createSwDoc("collapsed_bookmark.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // save original document save(u"writer8"_ustr); @@ -869,7 +862,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNewAfterReload // load document createSwDoc("collapsed_bookmark.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // write "abc" to area marked with "testBookmark" bookmark { @@ -911,8 +903,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96961) { // Insert a page break. createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertPageBreak(); // Enable hide whitespace mode. @@ -960,12 +951,12 @@ int checkShells(const SwDocShell* pSource, const SwDocShell* pDestination) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testClassificationPaste) { createSwDoc(); - SwDocShell* pSourceShell = getSwDoc()->GetDocShell(); + SwDocShell* pSourceShell = getSwDocShell(); uno::Reference xSourceComponent = mxComponent; mxComponent.clear(); createSwDoc(); - SwDocShell* pDestinationShell = getSwDoc()->GetDocShell(); + SwDocShell* pDestinationShell = getSwDocShell(); // Not classified source, not classified destination. CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::None), @@ -993,8 +984,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testSmallCaps) // Create a document, add some characters and select them. createSwDoc(); createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert(u"text"_ustr); pWrtShell->SelAll(); @@ -1057,7 +1047,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf84695) { createSwDoc("tdf84695.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(1); SwContact* pTextBox = static_cast(pObject->GetUserCall()); @@ -1082,7 +1072,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf84695NormalChar) { createSwDoc("tdf84695.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(1); SwContact* pTextBox = static_cast(pObject->GetUserCall()); @@ -1106,7 +1096,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf84695Tab) { createSwDoc("tdf84695-tab.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); SwContact* pShape = static_cast(pObject->GetUserCall()); @@ -1211,7 +1201,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineCopyPaste) // Create the clipboard document. SwDoc aClipboard; - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Select the whole content, copy, delete the original and paste the copied content pWrtShell->SelAll(); @@ -1227,7 +1217,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf135260) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert(u"test"_ustr); @@ -1257,7 +1247,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineParam) // Create a document with minimal content. createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert(u"middle"_ustr); @@ -1310,7 +1300,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineViewAuthor) // Create a document with minimal content. createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert(u"middle"_ustr); SwView* pView = pDocShell->GetView(); @@ -1383,7 +1373,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineTimestamp) // Create a document with minimal content. createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert(u"middle"_ustr); @@ -1421,8 +1411,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testCursorWindows) { // Create a new document with one window. createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell1 = pDocShell->GetWrtShell(); // Create a second view and type something. @@ -1444,13 +1433,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testLandscape) { // Set page orientation to landscape. createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Sequence aPropertyValues( comphelper::InitPropertySequence({ { "AttributePage.Landscape", uno::Any(true) } })); dispatchCommand(mxComponent, u".uno:AttributePage"_ustr, aPropertyValues); // Assert that the document model was modified. - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); size_t nPageDesc = pWrtShell->GetCurPageDesc(); // This failed, page was still portrait. @@ -1467,7 +1455,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf95699) IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); SwDoc aClipboard; - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SelAll(); pWrtShell->Copy(aClipboard); pMarkAccess = aClipboard.getIDocumentMarkAccess(); @@ -1578,7 +1566,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf104032) SwDoc* pDoc = getSwDoc(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); SwDoc aClipboard; - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->StartOfSection(); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); pWrtShell->Copy(aClipboard); @@ -1620,9 +1608,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf104425) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf104814) { createSwDoc("tdf104814.docx"); - SwDoc* pDoc1 = getSwDoc(); + SwDoc* pDoc = getSwDoc(); - SwEditShell* const pEditShell(pDoc1->GetEditShell()); + SwEditShell* const pEditShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pEditShell); // accept all redlines @@ -1652,8 +1640,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableRemoveHasTextChangesOnly) { createSwDoc("TC-table-del-add.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // disable Record Changes @@ -1719,8 +1706,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableRemoveHasTextChangesOnly2) { createSwDoc("TC-table-del-add.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // disable Record Changes @@ -1774,8 +1760,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf147182_AcceptAllChangesInTableSelec { createSwDoc("TC-table-del-add.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // check redline count @@ -1957,9 +1942,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf107362) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf105417) { createSwDoc("tdf105417.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); CPPUNIT_ASSERT(pView); uno::Reference xHyphenator = LinguMgr::GetHyphenator(); CPPUNIT_ASSERT(xHyphenator.is()); @@ -1983,7 +1966,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf105625) { createSwDoc("tdf105625.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Ensure correct initial setting std::shared_ptr batch( comphelper::ConfigurationChanges::create()); @@ -2017,8 +2000,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf125151_protected) // Similar to testTdf105625 except this is in a protected section, // so read-only is already true when fieldmarks are considered. createSwDoc("tdf125151_protected.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Ensure correct initial setting std::shared_ptr batch( comphelper::ConfigurationChanges::create()); @@ -2036,8 +2018,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf125151_protectedB) { // Similar to testTdf105625 except this is protected with the Protect_Form compat setting createSwDoc("tdf125151_protectedB.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Ensure correct initial setting std::shared_ptr batch( comphelper::ConfigurationChanges::create()); @@ -2251,8 +2232,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf107976) { // Create a document and create two transferables. createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell& rShell = *pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell& rShell = *getSwDocShell()->GetWrtShell(); rtl::Reference pTransferable(new SwTransferable(rShell)); rtl::Reference pTransferable2(new SwTransferable(rShell)); // Now close the document. @@ -2544,8 +2524,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf142157) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf143320) { createSwDoc("tdf143320.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(1, getPages()); CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("x")); @@ -2556,8 +2535,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf143320) // Create a new document createSwDoc(); - pDoc = getSwDoc(); - pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx index c71642a452ca..3f668b9937f5 100644 --- a/sw/qa/extras/uiwriter/uiwriter5.cxx +++ b/sw/qa/extras/uiwriter/uiwriter5.cxx @@ -76,7 +76,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf139127) // switch on "Show changes in margin" mode dispatchCommand(mxComponent, u".uno:ShowChangesInMargin"_ustr, {}); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell->GetViewOptions()->IsShowChangesInMargin()); // turn on red-lining and show changes @@ -116,7 +116,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf138479) createSwDoc(); SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"Lorem"_ustr); CPPUNIT_ASSERT_EQUAL(u"Lorem"_ustr, getParagraph(1)->getString()); @@ -297,9 +297,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf126206) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf50447) { createSwDoc("tdf126206.docx"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); // bold text auto xText = getParagraph(1)->getText(); @@ -345,9 +344,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf50447) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143918) { createSwDoc("tdf126206.docx"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); // bold text auto xText = getParagraph(1)->getText(); @@ -396,7 +394,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143938) createSwDoc("tdf54819.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); // select first paragraph, add underline without change tracking pWrtShell->EndPara(/*bSelect=*/true); @@ -461,9 +459,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143938) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143939) { createSwDoc("tdf126206.docx"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); // bold text auto xText = getParagraph(1)->getText(); @@ -667,7 +664,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf144272) createSwDoc("tdf50447.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -718,8 +715,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf144272) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf101873) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // Insert some content. @@ -749,7 +745,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTextFormFieldInsertion) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); @@ -786,7 +781,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testCheckboxFormFieldInsertion) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); @@ -822,7 +816,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testCheckboxFormFieldInsertion) CPPUNIT_ASSERT_EQUAL(ODF_FORMCHECKBOX, pFieldmark->GetFieldname()); // tdf#147008 this would crash - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->StartOfSection(false); pWrtShell->SplitNode(); CPPUNIT_ASSERT_EQUAL(pFieldmark->GetMarkPos().GetNodeIndex(), @@ -835,7 +829,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDropDownFormFieldInsertion) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); @@ -876,7 +869,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testMixedFormFieldInsertion) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); @@ -1074,7 +1066,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf125310) IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); // paragraph join - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->EndPara(/*bSelect=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); @@ -1092,7 +1084,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf125310b) { createSwDoc("tdf125310b.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(u"Standard"_ustr, getProperty(getParagraph(2), u"ParaStyleName"_ustr)); @@ -1160,10 +1152,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testImageComment) // Load a document with an as-char image in it. createSwDoc("image-comment.odt"); SwDoc* pDoc = getSwDoc(); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); // Test document has "beforeafter", remove the content before the image. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStart=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 6, /*bBasicCall=*/false); pWrtShell->Delete(); @@ -1258,7 +1250,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testImageCommentAtChar) // Load a document with an at-char image in it. createSwDoc("image-comment-at-char.odt"); SwDoc* pDoc = getSwDoc(); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); // Select the image. selectShape(1); @@ -1297,7 +1289,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testImageCommentAtChar) pView->GetViewFrame().GetDispatcher()->Execute(SID_UNDO, SfxCallMode::SYNCHRON); CPPUNIT_ASSERT_EQUAL(static_cast(1), pDoc->getIDocumentMarkAccess()->getAnnotationMarksCount()); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); Point aNewAnchor = pWrtShell->GetFlyRect().TopLeft(); aNewAnchor.Move(0, 600); pWrtShell->SetFlyPos(aNewAnchor); @@ -1328,7 +1320,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTrackImageDeletion) // load a document with an image anchored to paragraph in it createSwDoc("image.odt"); SwDoc* pDoc = getSwDoc(); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); // select the image selectShape(1); @@ -1459,7 +1451,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testShapePageMove) // Load a document with 2 pages, shape on the first page. createSwDoc("shape-page-move.odt"); SwDoc* pDoc = getSwDoc(); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); // Make sure that the 2nd page is below the 1st one. pView->SetViewLayout(/*nColumns=*/1, /*bBookMode=*/false); calcLayout(); @@ -1502,7 +1494,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldInsertion) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); @@ -1539,7 +1530,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldContentOperations) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); @@ -1572,7 +1562,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldCurrentDateHandling) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); @@ -1626,7 +1615,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldCurrentDateInvalidation) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); @@ -1689,8 +1677,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testOleSaveWhileEdit) // Load a document with a Draw doc in it. createSwDoc("ole-save-while-edit.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); selectShape(1); @@ -1719,9 +1706,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf105330) createSwDoc("tdf105330.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); SfxUInt16Item aRows(SID_ATTR_TABLE_ROW, 1); SfxUInt16Item aColumns(SID_ATTR_TABLE_COLUMN, 1); pView->GetViewFrame().GetDispatcher()->ExecuteList(FN_INSERT_TABLE, SfxCallMode::SYNCHRON, @@ -2004,8 +1991,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf47979_row) // load a 2-row table, and select row 2 by clicking before it createSwDoc("select-column.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); @@ -2038,8 +2024,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf47979_column) // load a 2-row table, and select column B by clicking before them createSwDoc("select-column.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // select table column by using the middle point of the top border of column B @@ -2471,7 +2456,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150666) { // load a table with tracked insertion of an empty row createSwDoc("TC-table-rowadd.docx"); - SwDoc* pDoc = getSwDoc(); // check table count uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -2484,7 +2468,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150666) CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable->getRows()->getCount()); // select the second row (tracked table row insertion) - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); // delete it, and accept all tracked changes @@ -2511,7 +2495,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150666_regression) { // load a table with tracked insertion of an empty row createSwDoc("TC-table-rowadd.docx"); - SwDoc* pDoc = getSwDoc(); // check table count uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -2524,7 +2507,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150666_regression) CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable->getRows()->getCount()); // select the second row (tracked table row insertion) - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); // insert a new table row with track changes @@ -2605,7 +2588,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf147180) CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); // insert a character in the first cell with change tracking - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"x"_ustr); // reject all the changes, including table insertion @@ -2641,7 +2624,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf147180_empty_rows) CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); // insert a character in the first cell with change tracking - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"x"_ustr); // reject all the changes, including table insertion @@ -2791,7 +2774,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156474) // delete the text content (dummy character of the previous text change) of the newly // inserted cell, and accept tracked changes - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); dispatchCommand(mxComponent, u".uno:SwBackspace"_ustr, {}); dispatchCommand(mxComponent, u".uno:AcceptAllTrackedChanges"_ustr, {}); @@ -2839,7 +2822,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, tdf156475) dispatchCommand(mxComponent, u".uno:DeleteColumns"_ustr, {}); // go down to the empty cell - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); // Without the fix in place, this couldn't work @@ -2930,7 +2913,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156544) pDoc->getIDocumentRedlineAccess().IsRedlineOn()); // go to the empty column - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); // delete table column with enabled change tracking @@ -2988,7 +2971,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf156487) dispatchCommand(mxComponent, u".uno:DeleteColumns"_ustr, {}); // Dump the rendering of the first page as an XML file. - SwDocShell* pShell = pDoc->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); @@ -3193,10 +3176,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf128335) { // Load the bugdoc, which has 3 textboxes. createSwDoc("tdf128335.odt"); - SwDoc* pDoc = getSwDoc(); // Select the 3rd textbox. - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); selectShape(1); SwXTextDocument* pXTextDocument = dynamic_cast(mxComponent.get()); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB); @@ -3366,9 +3348,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145089_RedlineTableRowInsertionDOCX // save it to DOCX saveAndReload(u"Office Open XML Text"_ustr); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); pViewShell->Reformat(); pXmlDoc = parseLayoutDump(); @@ -3376,7 +3356,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145089_RedlineTableRowInsertionDOCX assertXPath(pXmlDoc, "//page[1]//body/tab/row", 3); // reject redlines - SwDoc* pDOCXDoc(pTextDoc->GetDocShell()->GetDoc()); + SwDoc* pDOCXDoc(getSwDoc()); SwEditShell* const pEditShell(pDOCXDoc->GetEditShell()); CPPUNIT_ASSERT(pEditShell); CPPUNIT_ASSERT_EQUAL(static_cast(2), pEditShell->GetRedlineCount()); @@ -3490,7 +3470,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf146966) // load a 4-row table, select more than 1 row and copy them // to check insertion of unnecessary empty rows createSwDoc("tdf144748.fodt"); - SwDoc* pDoc = getSwDoc(); // check table row count uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -3501,7 +3480,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf146966) CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable->getRows()->getCount()); // copy table row and paste it by Paste Special->Rows Above - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); dispatchCommand(mxComponent, u".uno:SelectTable"_ustr, {}); dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); @@ -3553,9 +3532,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145091) // save it to DOCX saveAndReload(u"Office Open XML Text"_ustr); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); pViewShell->Reformat(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -3578,7 +3555,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf128603) SwDoc* pDoc = getSwDoc(); // Select the 3rd textbox. - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); selectShape(1); SwXTextDocument* pXTextDocument = dynamic_cast(mxComponent.get()); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB); @@ -3626,7 +3603,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143904) createSwDoc("tdf143904.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwNodeOffset nIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex(); @@ -3650,7 +3627,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf90069) createSwDoc("tdf90069.docx"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwNodeOffset nIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex(); @@ -3674,7 +3651,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf109266) // transliteration with redlining createSwDoc("lorem.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwNodeOffset nIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex(); @@ -3873,8 +3850,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf123218) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf93747) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtSh = getSwDocShell()->GetWrtShell(); uno::Sequence aArgs(comphelper::InitPropertySequence( { { "Rows", uno::Any(sal_Int32(2)) }, { "Columns", uno::Any(sal_Int32(2)) } })); @@ -3962,8 +3938,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf93747) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145151) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtSh = getSwDocShell()->GetWrtShell(); uno::Sequence aArgs(comphelper::InitPropertySequence( { { "Rows", uno::Any(sal_Int32(2)) }, { "Columns", uno::Any(sal_Int32(2)) } })); diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index abee6787fbbd..c5caa395fc59 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -190,7 +190,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testLinesMoveBackwardsInSectionInTable) CPPUNIT_ASSERT_EQUAL(u"5"_ustr, pDoc->GetNodes()[nPara5Node]->GetTextNode()->GetText()); // Remove paragraph "4". - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); while (pWrtShell->GetCursor()->GetPointNode().GetIndex() < nPara4Node) pWrtShell->Down(/*bSelect=*/false); pWrtShell->EndPara(); @@ -282,8 +282,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113445) #if HAVE_MORE_FONTS // Force multiple-page view. createSwDoc("tdf113445.fodt"); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwView* pView = pDocShell->GetView(); pView->SetViewLayout(/*nColumns=*/2, /*bBookMode=*/false); calcLayout(); @@ -296,7 +295,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113445) CPPUNIT_ASSERT_GREATER(nPage1Left, nPage2Left); // Insert a new paragraph at the start of the document. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->StartOfSection(); pWrtShell->SplitNode(); pXmlDoc = parseLayoutDump(); @@ -344,7 +343,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113686) pDoc->GetNodes()[nPage2FirstNode]->GetTextNode()->GetText()); // Remove page 2. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); while (pWrtShell->GetCursor()->Start()->GetNodeIndex() < nPage1LastNode) pWrtShell->Down(/*bSelect=*/false); pWrtShell->EndPara(); @@ -458,7 +457,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testSectionInTableInTable4) pDoc->GetNodes()[nPage3FirstNode]->GetTextNode()->GetText()); // Remove page 2. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); while (pWrtShell->GetCursor()->Start()->GetNodeIndex() < nPage1LastNode) pWrtShell->Down(/*bSelect=*/false); pWrtShell->EndPara(); @@ -497,7 +496,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf112160) pDoc->GetNodes()[nA2CellNode]->GetTextNode()->GetText()); // Append a new paragraph to the end of the A2 cell. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); while (pWrtShell->GetCursor()->GetPointNode().GetIndex() < nA2CellNode) pWrtShell->Down(/*bSelect=*/false); pWrtShell->EndPara(); @@ -525,10 +524,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf114536) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testParagraphOfTextRange) { createSwDoc("paragraph-of-text-range.odt"); - SwDoc* pDoc = getSwDoc(); // Enter the table. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); CPPUNIT_ASSERT(pWrtShell->IsCursorInTable()); // Enter the section. @@ -550,7 +548,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf99689TableOfContents) { createSwDoc("tdf99689.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->GotoNextTOXBase(); const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX(); pWrtShell->UpdateTableOf(*pTOXBase); @@ -579,7 +577,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf99689TableOfFigures) { createSwDoc("tdf99689_figures.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->GotoNextTOXBase(); const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX(); pWrtShell->UpdateTableOf(*pTOXBase); @@ -606,7 +604,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf99689TableOfTables) { createSwDoc("tdf99689_tables.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->GotoNextTOXBase(); const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX(); pWrtShell->UpdateTableOf(*pTOXBase); @@ -645,8 +643,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf112448) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113790) { createSwDoc("tdf113790.docx"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Create the clipboard document. SwDoc aClipboard; aClipboard.SetClipBoard(true); @@ -670,7 +667,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157937) { createSwDoc("tdf130088.docx"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // select paragraph pWrtShell->SelPara(nullptr); @@ -758,7 +755,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157667) { createSwDoc("tdf130088.docx"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // select the first three words pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 25, /*bBasicCall=*/false); @@ -808,7 +805,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf158039) { createSwDoc("tdf130088.docx"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // select the first sentence pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 26, /*bBasicCall=*/false); @@ -875,8 +872,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108048) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113481) { createSwDoc("tdf113481-IVS.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // One backspace should completely remove the CJK ideograph variation sequence pWrtShell->EndPara(); @@ -925,7 +921,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115013) SwDBData aDBData; aDBData.sDataSource = sDataSource; aDBData.sCommand = "Sheet1"; - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwDBFieldType* pFieldType = static_cast( pWrtShell->InsertFieldType(SwDBFieldType(pDoc, sColumnName, aDBData))); @@ -938,8 +934,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115013) // Save it as DOCX & load it again saveAndReload(u"Office Open XML Text"_ustr); pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwCursorShell* pShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pShell); @@ -960,9 +955,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115065) // Source table (first one) has two rows; // destination (second one) has only one row createSwDoc("tdf115065.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); pWrtShell->GotoTable(u"Table2"_ustr); @@ -987,8 +980,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf84806_MovingMultipleTableRows) // destination (second one) has only one row createSwDoc("tdf115065.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -1048,8 +1040,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf147181_TrackedMovingOfMultipleTable // destination (second one) has only one row createSwDoc("tdf115065.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -1130,8 +1121,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157492_TrackedMovingRow) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // Create a table @@ -1211,8 +1201,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf154599_MovingColumn) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // Create a table with less columns than rows @@ -1261,8 +1250,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf155846_MovingColumn) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // Create a table @@ -1345,8 +1333,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf154771_MovingMultipleColumns) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // Create a table with less columns than rows @@ -1401,8 +1388,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf44773) // allow resizing table rows, if cursor outside the table createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // insert an empty paragraph @@ -1440,7 +1426,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf44773) Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, rCellA1Rect.Top() + nRowHeight); // double the row height Point ptTo(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, rCellA1Rect.Top() + 2 * nRowHeight); - vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + vcl::Window& rEditWin = getSwDocShell()->GetView()->GetEditWin(); Point aFrom = rEditWin.LogicToPixel(ptFrom); MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK | MouseEventModifiers::SELECT, MOUSE_LEFT); @@ -1451,9 +1437,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf44773) TrackingEvent aTEvt(aMoveEvent, TrackingEventFlags::Repeat); // drag & drop of cell border inside the document (and outside the table) // still based on the ruler code, use that to simulate dragging - pDoc->GetDocShell()->GetView()->GetVRuler().Tracking(aTEvt); + getSwDocShell()->GetView()->GetVRuler().Tracking(aTEvt); TrackingEvent aTEvt2(aMoveEvent, TrackingEventFlags::End); - pDoc->GetDocShell()->GetView()->GetVRuler().Tracking(aTEvt2); + getSwDocShell()->GetView()->GetVRuler().Tracking(aTEvt2); Scheduler::ProcessEventsToIdle(); rEditWin.CaptureMouse(); rEditWin.ReleaseMouse(); @@ -1467,8 +1453,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157833) // allow resizing table rows & columns using a minimal hit area createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // insert an empty paragraph @@ -1506,7 +1491,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157833) Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, rCellA1Rect.Top() + nRowHeight); // double the row height Point ptTo(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, rCellA1Rect.Top() + 2 * nRowHeight); - vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + vcl::Window& rEditWin = getSwDocShell()->GetView()->GetEditWin(); Point aFrom = rEditWin.LogicToPixel(ptFrom); Point aArea(aFrom.X(), aFrom.Y() + 2); MouseEvent aClickEvent(aArea, 1, MouseEventModifiers::SIMPLECLICK | MouseEventModifiers::SELECT, @@ -1518,9 +1503,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157833) TrackingEvent aTEvt(aMoveEvent, TrackingEventFlags::Repeat); // drag & drop of cell border inside the document (and outside the table) // still based on the ruler code, use that to simulate dragging - pDoc->GetDocShell()->GetView()->GetVRuler().Tracking(aTEvt); + getSwDocShell()->GetView()->GetVRuler().Tracking(aTEvt); TrackingEvent aTEvt2(aMoveEvent, TrackingEventFlags::End); - pDoc->GetDocShell()->GetView()->GetVRuler().Tracking(aTEvt2); + getSwDocShell()->GetView()->GetVRuler().Tracking(aTEvt2); Scheduler::ProcessEventsToIdle(); rEditWin.CaptureMouse(); rEditWin.ReleaseMouse(); @@ -1535,8 +1520,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf155692) // allow resizing table rows & columns using a normal hit area createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // insert an empty paragraph @@ -1574,7 +1558,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf155692) Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, rCellA1Rect.Top() + nRowHeight); // double the row height Point ptTo(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, rCellA1Rect.Top() + 2 * nRowHeight); - vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + vcl::Window& rEditWin = getSwDocShell()->GetView()->GetEditWin(); Point aFrom = rEditWin.LogicToPixel(ptFrom); Point aArea(aFrom.X(), aFrom.Y() + 5); MouseEvent aClickEvent(aArea, 1, MouseEventModifiers::SIMPLECLICK | MouseEventModifiers::SELECT, @@ -1586,9 +1570,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf155692) TrackingEvent aTEvt(aMoveEvent, TrackingEventFlags::Repeat); // drag & drop of cell border inside the document (and outside the table) // still based on the ruler code, use that to simulate dragging - pDoc->GetDocShell()->GetView()->GetVRuler().Tracking(aTEvt); + getSwDocShell()->GetView()->GetVRuler().Tracking(aTEvt); TrackingEvent aTEvt2(aMoveEvent, TrackingEventFlags::End); - pDoc->GetDocShell()->GetView()->GetVRuler().Tracking(aTEvt2); + getSwDocShell()->GetView()->GetVRuler().Tracking(aTEvt2); Scheduler::ProcessEventsToIdle(); rEditWin.CaptureMouse(); rEditWin.ReleaseMouse(); @@ -1602,8 +1586,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160842) { createSwDoc("tdf160842.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // the cursor is not in the table CPPUNIT_ASSERT(!pWrtShell->IsCursorInTable()); @@ -1625,7 +1608,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160842) auto nRowHeight = rCellA2Rect.Height(); // select center of the bottom cell Point ptFrom(rCellA2Rect.Left() + rCellA2Rect.Width() / 2, rCellA2Rect.Top() + nRowHeight / 2); - vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + vcl::Window& rEditWin = getSwDocShell()->GetView()->GetEditWin(); Point aFrom = rEditWin.LogicToPixel(ptFrom); MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); rEditWin.MouseButtonDown(aClickEvent); @@ -1639,8 +1622,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160836) { createSwDoc("tdf160842.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // set table row height by drag & drop at images cropped by the fixed row height @@ -1663,7 +1645,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160836) Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, rCellA1Rect.Top() + nRowHeight); // halve the row height Point ptTo(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, rCellA1Rect.Top() + 0.5 * nRowHeight); - vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + vcl::Window& rEditWin = getSwDocShell()->GetView()->GetEditWin(); Point aFrom = rEditWin.LogicToPixel(ptFrom); MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK | MouseEventModifiers::SELECT, MOUSE_LEFT); @@ -1674,9 +1656,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160836) TrackingEvent aTEvt(aMoveEvent, TrackingEventFlags::Repeat); // drag & drop of cell border inside the document (and outside the table) // still based on the ruler code, use that to simulate dragging - pDoc->GetDocShell()->GetView()->GetVRuler().Tracking(aTEvt); + getSwDocShell()->GetView()->GetVRuler().Tracking(aTEvt); TrackingEvent aTEvt2(aMoveEvent, TrackingEventFlags::End); - pDoc->GetDocShell()->GetView()->GetVRuler().Tracking(aTEvt2); + getSwDocShell()->GetView()->GetVRuler().Tracking(aTEvt2); Scheduler::ProcessEventsToIdle(); rEditWin.CaptureMouse(); rEditWin.ReleaseMouse(); @@ -1689,8 +1671,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161261) { createSwDoc("tdf160842.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // the cursor is not in the table CPPUNIT_ASSERT(!pWrtShell->IsCursorInTable()); @@ -1713,7 +1694,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161261) // select image by clicking on it at the center of the upper cell Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, rCellA1Rect.Top() + nRowHeight / 2); - vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + vcl::Window& rEditWin = getSwDocShell()->GetView()->GetEditWin(); Point aFrom = rEditWin.LogicToPixel(ptFrom); MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); rEditWin.MouseButtonDown(aClickEvent); @@ -1751,8 +1732,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161332) { createSwDoc("tdf160842.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // the cursor is not in the table CPPUNIT_ASSERT(!pWrtShell->IsCursorInTable()); @@ -1775,7 +1755,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161332) // select text frame by clicking on it at the right side of the upper cell Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width(), rCellA1Rect.Top() + nRowHeight / 2); - vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + vcl::Window& rEditWin = getSwDocShell()->GetView()->GetEditWin(); Point aFrom = rEditWin.LogicToPixel(ptFrom); MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); rEditWin.MouseButtonDown(aClickEvent); @@ -1812,8 +1792,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161426) { createSwDoc("tdf161426.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // the cursor is not in the table CPPUNIT_ASSERT(!pWrtShell->IsCursorInTable()); @@ -1837,7 +1816,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161426) // select text frame by clicking on it at the right side of the upper right cell Point ptFrom(rCellB1Rect.Left() + rCellB1Rect.Width(), rCellB1Rect.Top() + nRowHeight / 2); - vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + vcl::Window& rEditWin = getSwDocShell()->GetView()->GetEditWin(); Point aFrom = rEditWin.LogicToPixel(ptFrom); MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); rEditWin.MouseButtonDown(aClickEvent); @@ -1874,8 +1853,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161426_content) { createSwDoc("tdf161426.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // the cursor is not in the table CPPUNIT_ASSERT(!pWrtShell->IsCursorInTable()); @@ -1899,7 +1877,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161426_content) // select content of the B1 by clicking on the center of it Point ptFrom(rCellB1Rect.Left() + rCellB1Rect.Width() / 2, rCellB1Rect.Top() + nRowHeight / 2); - vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + vcl::Window& rEditWin = getSwDocShell()->GetView()->GetEditWin(); Point aFrom = rEditWin.LogicToPixel(ptFrom); MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); rEditWin.MouseButtonDown(aClickEvent); @@ -1967,8 +1945,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161360) { createSwDoc("tdf160842.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // the cursor is not in the table CPPUNIT_ASSERT(!pWrtShell->IsCursorInTable()); @@ -1991,7 +1968,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161360) // select image by clicking on it at the center of the upper cell Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, rCellA1Rect.Top() + nRowHeight / 2); - vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + vcl::Window& rEditWin = getSwDocShell()->GetView()->GetEditWin(); Point aFrom = rEditWin.LogicToPixel(ptFrom); MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); rEditWin.MouseButtonDown(aClickEvent); @@ -2029,11 +2006,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157533) { // load a table with objects positioned at beginning of text lines createSwDoc("tdf157533.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); - auto pShell = pDoc->GetDocShell()->GetFEShell(); + auto pShell = getSwDocShell()->GetFEShell(); CPPUNIT_ASSERT(pShell); auto xModel = mxComponent.queryThrow(); @@ -2083,9 +2058,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157533) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115132) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); std::vector vTestTableNames; @@ -2163,14 +2136,13 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testXDrawPagesSupplier) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf116403) { createSwDoc("tdf116403-considerborders.odt"); - SwDoc* pDoc = getSwDoc(); // Check that before ToX update, the tab stop position is the old one uno::Reference xParagraph = getParagraph(2, u"1\t1"_ustr); auto aTabs = getProperty>(xParagraph, u"ParaTabStops"_ustr); CPPUNIT_ASSERT_EQUAL(static_cast(1), aTabs.getLength()); CPPUNIT_ASSERT_EQUAL(static_cast(17000), aTabs[0].Position); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); const SwTOXBase* pTOX = pWrtShell->GetTOX(0); CPPUNIT_ASSERT(pTOX); pWrtShell->UpdateTableOf(*pTOX); @@ -2245,7 +2217,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf51223) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); SwNodeOffset nIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex(); pWrtShell->Insert(u"i"_ustr); @@ -2506,8 +2478,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testInconsistentBookmark) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testSpellOnlineParameter) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); const SwViewOption* pOpt = pWrtShell->GetViewOptions(); bool bSet = pOpt->IsOnlineSpell(); @@ -2526,7 +2497,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf124603) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); const SwViewOption* pOpt = pWrtShell->GetViewOptions(); uno::Sequence params = comphelper::InitPropertySequence({ { "Enable", uno::Any(true) } }); @@ -2577,7 +2548,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf45949) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); const SwViewOption* pOpt = pWrtShell->GetViewOptions(); uno::Sequence params = comphelper::InitPropertySequence({ { "Enable", uno::Any(true) } }); @@ -2630,7 +2601,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157442) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); const SwViewOption* pOpt = pWrtShell->GetViewOptions(); uno::Sequence params = comphelper::InitPropertySequence({ { "Enable", uno::Any(true) } }); @@ -2670,7 +2641,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535) { createSwDoc("tdf65535.fodt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); const SwViewOption* pOpt = pWrtShell->GetViewOptions(); uno::Sequence params = comphelper::InitPropertySequence({ { "Enable", uno::Any(true) } }); @@ -2745,7 +2716,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testRedlineAutoCorrect) dispatchCommand(mxComponent, u".uno:GoToEndOfDoc"_ustr, {}); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -2813,8 +2784,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testRedlineAutoCorrect) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testRedlineAutoCorrect2) { createSwDoc("redline-autocorrect2.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -2842,8 +2812,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testRedlineAutoCorrect2) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testEmojiAutoCorrect) { createSwDoc("redline-autocorrect3.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -2897,8 +2866,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf133589) { // Hungarian test document with right-to-left paragraph setting createSwDoc("tdf133589.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); // translitere words to Old Hungarian @@ -2994,8 +2962,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf133589) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testAutoCorr) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -3020,7 +2987,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf130274) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -3045,7 +3012,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf83260) { createSwDoc("tdf83260-1.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -3150,9 +3117,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testInsertLongDateFormat) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf129270) { createSwDoc("tdf129270.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -3209,11 +3174,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf143760WrapContourToOff) // to change a shape by dispatchCommand. createSwDoc("tdf143760_ContourToWrapOff.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); CPPUNIT_ASSERT_EQUAL(true, getProperty(getShape(1), u"SurroundContour"_ustr)); // Mark the object - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); CPPUNIT_ASSERT(pObject); @@ -3369,8 +3333,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf151828_Comment2) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf151828) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // insert a table SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0); @@ -3405,7 +3368,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf146178) createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwCursorShell* pShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pShell); SwPaM* pCursor = pShell->GetCursor(); @@ -3440,7 +3403,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf106663HeaderTextFrameGoToNextPlacem SwCursorShell* pShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pShell); SwPaM* pCursor = pShell->GetCursor(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Move the cursor into the fly frame of the document's header pWrtShell->GotoFly(u"FrameInHeader"_ustr, FLYCNTTYPE_FRM, false); @@ -3457,8 +3420,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf106663HeaderTextFrameGoToNextPlacem CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf158454) { createSwDoc("tdf158454.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index be8e6ba6625e..ad6e69661717 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -554,8 +554,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf78742) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUnoParagraph) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); //Inserting some text content in the document pWrtShell->Insert(u"This is initial text in paragraph one"_ustr); pWrtShell->SplitNode(); @@ -591,7 +590,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf72788) //Create a new empty Writer document createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwCursorShell* pShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pShell); SwPaM* pCursor = pShell->GetCursor(); @@ -657,7 +656,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf60967) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwCursorShell* pShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pShell); SwPaM* pCursor = pShell->GetCursor(); @@ -712,7 +711,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testSearchWithTransliterate) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); { SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwPaM aPaM(aIdx); @@ -753,8 +752,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testSearchWithTransliterate) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf73660) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); OUString aData1 = "First" + OUStringChar(CHAR_SOFTHYPHEN) + "Word"; OUString aData2 = "Seco" + OUStringChar(CHAR_SOFTHYPHEN) + "nd"; OUString aData3 = OUStringChar(CHAR_SOFTHYPHEN) + "Third"; @@ -812,7 +810,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf77342) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwCursorShell* pShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pShell); SwPaM* pCursor = pShell->GetCursor(); @@ -1068,7 +1066,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf63553) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwCursorShell* pShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pShell); SwPaM* pCursor = pShell->GetCursor(); @@ -1368,7 +1366,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf80663) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); //Inserting 2x2 Table sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0); @@ -1456,7 +1454,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf57197) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); //Inserting 1x1 Table sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0); @@ -1538,8 +1536,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf57197) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf131990) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(!pWrtShell->Up(false, 1, true)); CPPUNIT_ASSERT(!pWrtShell->Down(false, 1, true)); @@ -1627,8 +1624,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf97601) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf75137) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwShellCursor* pShellCursor = pWrtShell->getShellCursor(true); pWrtShell->InsertFootnote(u"This is first footnote"_ustr); SwNodeOffset firstIndex = pShellCursor->GetPointNode().GetIndex(); @@ -1646,7 +1642,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf83798) { createSwDoc("tdf83798.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->GotoNextTOXBase(); const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX(); pWrtShell->UpdateTableOf(*pTOXBase); @@ -1701,8 +1697,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf130287) { //create a new writer document createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); //insert a 1-cell table in the newly created document SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0); pWrtShell->InsertTable(TableOpt, 1, 1); @@ -1773,8 +1768,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testPropertyDefaults) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTableBackgroundColor) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0); pWrtShell->InsertTable(TableOpt, 3, 3); //Inserting Table //Checking Rows and Columns of Inserted Table @@ -1879,8 +1873,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf151605) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf90362) { createSwDoc("tdf90362.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Ensure correct initial setting std::shared_ptr batch( comphelper::ConfigurationChanges::create()); @@ -2134,7 +2127,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf86639) { createSwDoc("tdf86639.rtf"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwTextFormatColl* pColl = pDoc->FindTextFormatCollByName(u"Heading"_ustr); pWrtShell->SetTextFormatColl(pColl); OUString aExpected = pColl->GetAttrSet().GetFont().GetFamilyName(); @@ -2146,8 +2139,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf86639) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf90883TableBoxGetCoordinates) { createSwDoc("tdf90883.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Down(true); SwSelBoxes aBoxes; ::GetTableSel(*pWrtShell, aBoxes); @@ -2246,7 +2238,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testShapeAnchorUndo) { createSwDoc("draw-anchor-undo.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); tools::Rectangle aOrigLogicRect(pObject->GetLogicRect()); @@ -2277,7 +2269,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf127635) CPPUNIT_ASSERT(pXTextDocument); emulateTyping(*pXTextDocument, u"a b"); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 2, /*bBasicCall=*/false); //Select 'a' @@ -2313,8 +2305,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testDde) // Type asdf and copy it. createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"asdf"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 4, /*bBasicCall=*/false); uno::Sequence aPropertyValues; @@ -2343,7 +2334,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testDocModState) //the state should not be modified CPPUNIT_ASSERT(!(rState.IsModified())); //checking the state of the document via SfxObjectShell - SwDocShell* pShell(pDoc->GetDocShell()); + SwDocShell* pShell(getSwDocShell()); CPPUNIT_ASSERT(!(pShell->IsModified())); IdleTask::waitUntilIdleDispatched(); @@ -2385,8 +2376,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf94804) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUnicodeNotationToggle) { createSwDoc("unicodeAltX.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); OUString sOriginalDocString; OUString sDocString; OUString sExpectedString; @@ -2441,7 +2431,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf89954) { createSwDoc("tdf89954.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->EndPara(); SwXTextDocument* pXTextDocument = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pXTextDocument); @@ -2456,8 +2446,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf89954) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf89720) { createSwDoc("tdf89720.odt"); - SwDoc* pDoc = getSwDoc(); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); SwPostItMgr* pPostItMgr = pView->GetPostItMgr(); for (std::unique_ptr const& pItem : *pPostItMgr) { @@ -2472,12 +2461,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf88986) { // Create a text shell. createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); SwTextShell aShell(*pView); // Create the item set that is normally passed to the insert frame dialog. - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwFlyFrameAttrMgr aMgr(true, pWrtShell, Frmmgr_Type::TEXT, nullptr); auto xSet = aShell.CreateInsertFrameItemSet(aMgr); @@ -2488,8 +2476,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf88986) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf78150) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"foobar"_ustr); CPPUNIT_ASSERT_EQUAL(u"foobar"_ustr, getParagraph(1)->getString()); @@ -2506,8 +2493,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf78150) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf138873) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"A B C"_ustr); CPPUNIT_ASSERT_EQUAL(u"A B C"_ustr, getParagraph(1)->getString()); @@ -2542,7 +2528,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf87922) // Create an SwDrawTextInfo. createSwDoc("tdf87922.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwScriptInfo* pScriptInfo = nullptr; // Get access to the single paragraph in the document. SwNodeIndex aNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1); @@ -2631,8 +2617,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf77014) // input field has more words, it is broken up at the correct place. createSwDoc("tdf77014.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwTextFrame* pTextFrame = static_cast(pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower()); @@ -2841,8 +2826,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf117225) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf149184) { createSwDoc("simplefooter.docx"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Removing the footer for all styles pWrtShell->ChangeHeaderOrFooter(u"", false, false, false); diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 863e847f6b6b..58052fcf8146 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -140,8 +140,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146622) { createSwDoc("TC-table-del-add.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); CPPUNIT_ASSERT_MESSAGE("redlining should be on", @@ -194,8 +193,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146962) // load a 2-row table, set Hide Changes mode and delete the first row with change tracking createSwDoc("tdf116789.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // enable redlining @@ -246,8 +244,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf159026) // imported as floating tables in Writer) createSwDoc("tdf159026.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // enable redlining @@ -301,8 +298,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147347) // load a 2-row table, set Hide Changes mode and delete the table with change tracking createSwDoc("tdf116789.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // enable redlining @@ -351,9 +347,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf153819) { // copy a table before a deleted table in Hide Changes mode createSwDoc("tdf153819.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // hide changes @@ -375,8 +369,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148345) // load a 2-row table, set Hide Changes mode and delete the first row with change tracking createSwDoc("tdf116789.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // enable redlining @@ -428,9 +421,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf141391) // load a 2-row table createSwDoc("tdf116789.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // select the table, and copy it into at paragraph start of cell "A2" @@ -512,9 +503,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148791) // load a 2-row table createSwDoc("tdf116789.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // select and copy the table, and Paste As Rows Above @@ -679,8 +668,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf145584) return; } createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtSh = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtSh); pWrtSh->Insert(u"Hello World"_ustr); @@ -749,7 +737,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf140731) { createSwDoc(); SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtSh = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtSh); pWrtSh->Insert(u"Lorem"_ustr); @@ -812,8 +800,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf140731) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf116315) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtSh = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtSh); pWrtSh->Insert(u"This is a test"_ustr); @@ -845,8 +832,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf116315) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testInsertAutoTextIntoListFromParaStyle) { createSwDoc("stylewithlistandindents.fodt"); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); pWrtShell->FwdPara(); @@ -965,8 +951,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testInsertAutoTextIntoListFromParaStyle) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf144364) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtSh = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtSh); // expands autotext (via F3) @@ -990,8 +975,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146248) getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(true, getProperty(xPageStyle, u"HeaderIsOn"_ustr)); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Delete the header pWrtShell->ChangeHeaderOrFooter(u"Default Page Style", true, false, false); @@ -1009,7 +993,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf161741) // Redo of header change causes LO to crash createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); uno::Reference xPageStyle( @@ -1104,8 +1088,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf107427) xmlDocUniquePtr pLayout = parseLayoutDump(); assertXPath(pLayout, "/root/page[1]/header/tab/row", 2); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Delete the header pWrtShell->ChangeHeaderOrFooter(u"Default Page Style", true, false, false); @@ -1121,8 +1104,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf107427) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf141613) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtSh = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtSh); pWrtSh->Insert(u"Test"_ustr); @@ -1199,8 +1181,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf107494) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf133358) { createSwDoc(); - SwDoc* const pDoc = getSwDoc(); - SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtSh = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtSh); pWrtSh->Insert(u"Test"_ustr); @@ -1522,8 +1503,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf145621) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf134626) { createSwDoc("tdf134626.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(u"Apple"_ustr, getParagraph(1)->getString()); @@ -1533,8 +1513,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf134626) // Create a new document createSwDoc(); - pDoc = getSwDoc(); - pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // Without the fix in place, this test would have crashed here @@ -1561,8 +1540,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf134626) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf139566) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtSh = getSwDocShell()->GetWrtShell(); uno::Sequence aArgs(comphelper::InitPropertySequence( { { "Rows", uno::Any(sal_Int32(1)) }, { "Columns", uno::Any(sal_Int32(1)) } })); @@ -1707,8 +1685,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf39828) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146573) { createSwDoc("tdf39828.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // remove redlines, add a footnote, and change the value // of the cell with the footnote @@ -1746,8 +1723,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf157132) { createSwDoc("tdf157132.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Go to cell A2 pWrtShell->Down(/*bSelect=*/false, /*nCount=*/1); @@ -1804,7 +1780,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147938) createSwDoc("tdf147938.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->getIDocumentRedlineAccess().GetRedlineTable().size()); CPPUNIT_ASSERT_EQUAL(u"Bar\nbaz "_ustr, @@ -1859,8 +1835,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148799) // load a document with table formulas with comma delimiter, // but with a document language with default point delimiter createSwDoc("tdf148799.docx"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // check formula update @@ -1892,8 +1867,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf151993) // load a document with table formulas with comma delimiter // (with a document language with default comma delimiter) createSwDoc("tdf151993.docx"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // check formula update @@ -1920,7 +1894,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148849) // load a document with a table and an empty paragraph before the table createSwDoc("tdf148849.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // record changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -1955,7 +1929,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf150576) // load a document with a table and an empty paragraph before the table createSwDoc("tdf148849.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // record changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -2325,17 +2299,16 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf133490) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf132637_protectTrackChanges) { createSwDoc("tdf132637_protectTrackChanges.doc"); - SwDoc* pDoc = getSwDoc(); // The password should only prevent turning off track changes, not open as read-only - CPPUNIT_ASSERT(!pDoc->GetDocShell()->IsReadOnly()); + CPPUNIT_ASSERT(!getSwDocShell()->IsReadOnly()); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf127652) { createSwDoc("tdf127652.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); // get a page cursor uno::Reference xModel(mxComponent, uno::UNO_QUERY); @@ -2465,7 +2438,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf137964) { createSwDoc("tdf137964.odt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT_EQUAL(1, getShapes()); @@ -2748,7 +2721,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf128106) mxComponent = loadFromDesktop(maTempFile.GetURL()); - SwWrtShell* pWrtShell = getSwDoc()->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwDoc* const pMasterDoc(pWrtShell->GetDoc()); CPPUNIT_ASSERT_EQUAL( size_t(2), @@ -2806,12 +2779,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf128106) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf103612) { createSwGlobalDoc("DUMMY.odm"); - SwDoc* pGlobalDoc = getSwDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL( - size_t(1), - pGlobalDoc->getIDocumentLinksAdministration().GetLinkManager().GetLinks().size()); - pGlobalDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks( - false, false, nullptr, u""_ustr); + size_t(1), pDoc->getIDocumentLinksAdministration().GetLinkManager().GetLinks().size()); + pDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks(false, false, nullptr, + u""_ustr); xmlDocUniquePtr pLayout = parseLayoutDump(); @@ -2836,7 +2808,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf97899) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwCursorShell* pShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pShell); SwPaM* pCursor = pShell->GetCursor(); @@ -2939,8 +2911,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf157129) // Create a new document createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); @@ -2967,8 +2938,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf157129) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testCursorPositionAfterUndo) { createSwDoc("cursor_position_after_undo.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // switch on "Outline Folding" mode dispatchCommand(mxComponent, u".uno:ShowOutlineContentVisibilityButton"_ustr, {}); @@ -3009,8 +2979,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf73483) { // Given a document with a first paragraph having a manually set page break with page style createSwDoc("pageBreakWithPageStyle.fodt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(u"Right Page"_ustr, pWrtShell->GetCurPageStyle()); @@ -3041,8 +3010,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf73483) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf62032ApplyStyle) { createSwDoc("tdf62032_apply_style.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtSh = getSwDocShell()->GetWrtShell(); pWrtSh->Down(/*bSelect=*/false); @@ -3080,7 +3048,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf158459) createSwDoc("tdf158459_tracked_changes_across_nodes.fodt"); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); pWrtShell->FwdPara(); // Skip first paragraph pWrtShell->EndOfSection(true); // Select everything to the end diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index 8f968353bdf8..b9c55e8ecfea 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -298,8 +299,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159816) createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // Add 5 empty paragraphs @@ -335,8 +335,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159816) CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf34804) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Simulate a keyboard shortcut to SID_ATTR_CHAR_COLOR2 (which must use the shared button color) dispatchCommand(mxComponent, u".uno:FontColor"_ustr, {}); @@ -354,7 +353,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf139631) // Test to see if preceding space is cut when cutting a word with track changes (redline) on createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"New World!\""_ustr); // Assert that the string, New World!", is inserted correctly into the document @@ -413,7 +412,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf151710) CPPUNIT_ASSERT(pTextDoc); // Check that the particular setting is turned on by default - const SwViewOption* pVwOpt = pTextDoc->GetDocShell()->GetWrtShell()->GetViewOptions(); + const SwViewOption* pVwOpt = getSwDocShell()->GetWrtShell()->GetViewOptions(); CPPUNIT_ASSERT(pVwOpt); CPPUNIT_ASSERT(pVwOpt->IsEncloseWithCharactersOn()); @@ -490,8 +489,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf151710) CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159054_disableOutlineNumbering) { createSwDoc("tdf159054_disableOutlineNumbering.docx"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); const uno::Reference xPara1 = getParagraph(1, u"Heading A"_ustr); const uno::Reference xPara2 = getParagraph(2, u"Heading B"_ustr); @@ -613,8 +611,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf158375_ole_object_disable) // Load a document with a Draw doc in it. createSwDoc("ole-save-while-edit.odt"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); selectShape(1); @@ -730,8 +727,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf144752) // Undoing/redoing a replacement must select the new text createSwDoc(); SwXTextDocument* pDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); emulateTyping(*pDoc, u"Some Text"); @@ -757,9 +753,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf144752) CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_Pargraph) { createSwDoc("tdf162326.odt"); - SwXTextDocument* pDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, @@ -786,9 +780,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_Pargraph) CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_Character) { createSwDoc("tdf162326.odt"); - SwXTextDocument* pDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pDoc); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, @@ -843,6 +835,29 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf163340) CPPUNIT_ASSERT_EQUAL(u"A."_ustr, getProperty(xParaCursor, u"ListLabelString"_ustr)); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159023) +{ + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + + SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0); + pWrtShell->InsertTable(aTableOptions, /*nRows=*/2, /*nCols=*/2); + pWrtShell->MoveTable(GotoPrevTable, fnTableStart); + + dispatchCommand(mxComponent, u".uno:SelectTable"_ustr, {}); + dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); + + pWrtShell->InsertFootnote(u""_ustr); + CPPUNIT_ASSERT(pWrtShell->IsCursorInFootnote()); + + dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); + dispatchCommand(mxComponent, u".uno:GoLeft"_ustr, {}); + dispatchCommand(mxComponent, u".uno:GoLeft"_ustr, {}); + + // Without the fix in place, this test would have crashed here + CPPUNIT_ASSERT(pWrtShell->IsCursorInFootnote()); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index 0179bc60273a..67fb87671559 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -689,7 +689,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testDeleteFlyAtCharAtStart) createSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* const pWrtShell(pTextDoc->GetDocShell()->GetWrtShell()); + SwWrtShell* const pWrtShell(getSwDocShell()->GetWrtShell()); SwDoc* const pDoc(pWrtShell->GetDoc()); // insert some text @@ -737,9 +737,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSelectionInTableEnum) { createSwDoc("selection-in-table-enum.odt"); // Select the A1 cell's text. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); pWrtShell->Down(/*bSelect=*/false); pWrtShell->EndPara(/*bSelect=*/true); @@ -771,9 +769,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSelectionInTableEnumEnd) { createSwDoc("selection-in-table-enum.odt"); // Select from "Before" till the table end. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); pWrtShell->Down(/*bSelect=*/true); @@ -954,9 +950,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testPasteListener) xBroadcaster->addPasteEventListener(xListener); // Cut "DE" and then paste it. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 3, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 2, /*bBasicCall=*/false); @@ -1016,9 +1010,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testImageCommentAtChar) { // Load a document with an at-char image in it (and a comment on the image). createSwDoc("image-comment-at-char.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); // Verify that we have an annotation mark (comment with a text range) in the document. // Without the accompanying fix in place, this test would have failed, as comments lost their @@ -1046,7 +1038,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testImageCommentAtChar) // center of the page (horizontally) where the image is. On macOS, though, with the fix in // place the actual value consistently is even greater with 6283 now instead of 5892, for // whatever reason. - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); SwPostItMgr* pPostItMgr = pView->GetPostItMgr(); for (const auto& pItem : *pPostItMgr) { diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index fec8ac56a609..9ac1e8321bef 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -318,9 +318,7 @@ DECLARE_WW8EXPORT_TEST(testCp1000044, "cp1000044.doc") // It wasn't possible to fill out this form. CPPUNIT_ASSERT_EQUAL(false, bool(xStorable->isReadonly())); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL( true, pDoc->getIDocumentSettingAccess().get( DocumentSettingId::PROTECT_FORM ) ); uno::Sequence aGrabBag = getProperty< uno::Sequence >(mxComponent, u"InteropGrabBag"_ustr); @@ -676,10 +674,7 @@ DECLARE_WW8EXPORT_TEST(testTdf128605, "tdf128605.doc") DECLARE_WW8EXPORT_TEST(testTdf112535, "tdf112535.doc") { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc->GetSpzFrameFormats()); auto& rFormats = *pDoc->GetSpzFrameFormats(); @@ -729,10 +724,7 @@ DECLARE_WW8EXPORT_TEST( testTdf105570, "tdf105570.doc" ) * Table 2 has { 1, 1, 0 } * Table 3 has { 0, 1, 1 } ****/ - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwShellCursor* pShellCursor = pWrtShell->getShellCursor( false ); SwNodeIndex aIdx( pShellCursor->Start()->GetNode() ); @@ -779,9 +771,7 @@ DECLARE_WW8EXPORT_TEST(testTdf79639, "tdf79639.doc") DECLARE_WW8EXPORT_TEST(testTdf122425_2, "tdf122425_2.doc") { // This is for graphic objects in headers/footers - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SwPosFlyFrames aPosFlyFrames = pDoc->GetAllFlyFormats(nullptr, false); // There is one fly frame in the document: the text box CPPUNIT_ASSERT_EQUAL(size_t(1), aPosFlyFrames.size()); @@ -1322,10 +1312,7 @@ DECLARE_WW8EXPORT_TEST(testCommentedTable, "commented-table.doc") DECLARE_WW8EXPORT_TEST(testTextVerticalAdjustment, "tdf36117_verticalAdjustment.doc") { //Preserve the page vertical alignment setting for .doc - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); + SwDoc* pDoc = getSwDoc(); SwPageDesc* pDesc = &pDoc->GetPageDesc( 0 ); drawing::TextVerticalAdjust nVA = pDesc->GetVerticalAdjustment(); @@ -1354,10 +1341,7 @@ DECLARE_WW8EXPORT_TEST(testTextVerticalAdjustment, "tdf36117_verticalAdjustment. DECLARE_WW8EXPORT_TEST(testRES_MIRROR_GRAPH_BOTH, "tdf56321_flipImage_both.doc") { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); + SwDoc* pDoc = getSwDoc(); for (SwNodeOffset n(0); ; n++) { @@ -1511,9 +1495,7 @@ CPPUNIT_TEST_FIXTURE(Test, testClearFramePams) CPPUNIT_TEST_FIXTURE(Test, testTdf94386) { createSwDoc("tdf94386.odt"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // emulate the behavior from tdf#94386 - insert an envelope to the // document @@ -1581,10 +1563,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf99474) DECLARE_WW8EXPORT_TEST(testContinuousSectionsNoPageBreak, "continuous-sections.doc") { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); - CPPUNIT_ASSERT(pDoc); + SwDoc* pDoc = getSwDoc(); // Continuous section breaks should not add new pages CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetPageDescCnt()); diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 510b522ee432..d27f28f43dca 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -150,9 +150,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf55427_footnote2endnote) xPageStyle.set(getStyles(u"ParagraphStyles"_ustr)->getByName(u"Endnote"_ustr), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Endnote style is cyan3 color", Color(0x2BD0D2), getProperty< Color >(xPageStyle, u"CharColor"_ustr)); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); // The footnote numbering type of ARABIC will not transfer over when those footnotes are converted to endnotes. CPPUNIT_ASSERT_EQUAL_MESSAGE( "Footnote numbering type", SVX_NUM_ARABIC, pDoc->GetFootnoteInfo().m_aFormat.GetNumberingType() ); // The original document has a real endnote using ROMAN_LOWER numbering, so that setting MUST remain unchanged. @@ -537,9 +535,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf70838) loadAndReload("tdf70838.odt"); CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); tools::Rectangle aRect = pPage->GetObj(0)->GetSnapRect(); CPPUNIT_ASSERT(aRect.GetHeight() > aRect.GetWidth()); @@ -550,9 +546,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf70838b_verticalRotation) loadAndReload("tdf70838b_verticalRotation.odt"); CPPUNIT_ASSERT_EQUAL(3, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); tools::Rectangle aGroupShape = pPage->GetObj(0)->GetSnapRect(); tools::Rectangle aLine = pPage->GetObj(2)->GetSnapRect(); diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 880a3cb31701..445c9981ad1f 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -370,9 +370,7 @@ DECLARE_WW8EXPORT_TEST(testFdo53985, "fdo53985.doc") uno::Reference xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTables->getCount()); // Only 4 tables were imported. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL_MESSAGE("Compatibility: Protect form", true, pDoc->getIDocumentSettingAccess().get( DocumentSettingId::PROTECT_FORM ) ); uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index 26f0fbc6343c..957941f388ab 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -108,8 +108,7 @@ DECLARE_WW8EXPORT_TEST(testTdf117994_CRnumformatting, "tdf117994_CRnumformatting DECLARE_WW8EXPORT_TEST(testTdf151548_formFieldMacros, "tdf151548_formFieldMacros.doc") { - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); for(auto aIter = pMarkAccess->getFieldmarksBegin(); aIter != pMarkAccess->getFieldmarksEnd(); ++aIter) { @@ -494,9 +493,7 @@ CPPUNIT_TEST_FIXTURE(Test, testEmptyGroup) CPPUNIT_ASSERT_EQUAL(1, getPages()); CPPUNIT_ASSERT_EQUAL(1, getShapes()); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 9537c99e3742..6308d3a0215f 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -91,8 +91,7 @@ CPPUNIT_TEST_FIXTURE(Test, testImageLazyRead0size) createSwDoc("image-lazy-read-0size.doc"); // Load a document with a single bitmap in it: it's declared as a WMF one, but actually a TGA // bitmap. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SwNode* pNode = pDoc->GetNodes()[SwNodeOffset(6)]; SwGrfNode* pGrfNode = pNode->GetGrfNode(); CPPUNIT_ASSERT(pGrfNode); @@ -107,10 +106,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf106799) { createSwDoc("tdf106799.doc"); // Ensure that all text portions are calculated before testing. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); SwViewShell* pViewShell - = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); @@ -131,9 +128,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf106799) CPPUNIT_TEST_FIXTURE(Test, testTdf121734) { createSwDoc("tdf121734.doc"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SwPosFlyFrames aPosFlyFrames = pDoc->GetAllFlyFormats(nullptr, false); // There is only one fly frame in the document: the one with the imported floating table CPPUNIT_ASSERT_EQUAL(size_t(1), aPosFlyFrames.size()); @@ -177,8 +172,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf125281) // debug builds, reason is not known at the moment. // Load a .doc file which has an embedded .emf image. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SwNode* pNode = pDoc->GetNodes()[SwNodeOffset(6)]; CPPUNIT_ASSERT(pNode->IsGrfNode()); SwGrfNode* pGrfNode = pNode->GetGrfNode(); @@ -200,9 +194,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122425_1) createSwDoc("tdf122425_1.doc"); // This is for header text in case we use a hack for fixed-height headers // (see SwWW8ImplReader::Read_HdFtTextAsHackedFrame) - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); SwPosFlyFrames aPosFlyFrames = pDoc->GetAllFlyFormats(nullptr, false); // There are two fly frames in the document: for first page's header, and for other pages' CPPUNIT_ASSERT_EQUAL(size_t(2), aPosFlyFrames.size()); @@ -248,9 +240,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf110987) // The input document is an empty .doc, but without file name // extension. Check that it was loaded as a normal .doc document, // and not a template. - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - OUString sFilterName = pTextDoc->GetDocShell()->GetMedium()->GetFilter()->GetFilterName(); + OUString sFilterName = getSwDocShell()->GetMedium()->GetFilter()->GetFilterName(); CPPUNIT_ASSERT(sFilterName != "MS Word 97 Vorlage"); } @@ -266,10 +256,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf142003) { createSwDoc("changes-in-footnote.doc"); - SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pTextDoc); - - SwEditShell* const pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell()); + SwEditShell* const pEditShell(getSwDoc()->GetEditShell()); CPPUNIT_ASSERT(pEditShell); pEditShell->AcceptRedline(0); diff --git a/sw/qa/filter/ascii/ascii.cxx b/sw/qa/filter/ascii/ascii.cxx index bdcf1a142273..e8d651afc218 100644 --- a/sw/qa/filter/ascii/ascii.cxx +++ b/sw/qa/filter/ascii/ascii.cxx @@ -41,8 +41,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf144576_ascii) { // Given a document with a 2x2 table createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0); pWrtShell->InsertTable(aTableOptions, /*nRows=*/2, /*nCols=*/2); @@ -151,8 +150,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf144576_ascii) CPPUNIT_TEST_FIXTURE(Test, testTdf162180) { createSwDoc("tdf162180.docx"); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Select the whole table dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); diff --git a/sw/qa/filter/html/html.cxx b/sw/qa/filter/html/html.cxx index 40818a439926..f3a499a452fe 100644 --- a/sw/qa/filter/html/html.cxx +++ b/sw/qa/filter/html/html.cxx @@ -66,8 +66,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRelativeKeepAspect) createSwDoc("relative-keep-aspect.xhtml"); // Then make sure that the aspect ratio of the image is kept: - auto pTextDocument = dynamic_cast(mxComponent.get()); - SwDoc* pDoc = pTextDocument->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); const auto& rFormats = *pDoc->GetSpzFrameFormats(); const auto pFormat = rFormats[0]; const SwFormatFrameSize& rSize = pFormat->GetFrameSize(); @@ -87,8 +86,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRelativeKeepAspectImage) createSwDoc("relative-keep-aspect-image.xhtml"); // Then make sure that the aspect ratio of the image is kept: - auto pTextDocument = dynamic_cast(mxComponent.get()); - SwDoc* pDoc = pTextDocument->GetDocShell()->GetDoc(); + SwDoc* pDoc = getSwDoc(); const auto& rFormats = *pDoc->GetSpzFrameFormats(); const auto pFormat = rFormats[0]; const SwFormatFrameSize& rSize = pFormat->GetFrameSize(); @@ -136,8 +134,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTableCellFloatValueType) { // Given a document with a single table cell, its cell value is set to double: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0); pWrtShell->InsertTable(aTableOptions, 1, 1); pWrtShell->MoveTable(GotoPrevTable, fnTableStart); @@ -167,8 +164,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTableRowSpanInAllCells) { // Given a document with a 2x2 table, A1:A2 and B1:B2 is merged: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0); pWrtShell->InsertTable(aTableOptions, /*nRows=*/2, /*nCols=*/2); pWrtShell->MoveTable(GotoPrevTable, fnTableStart); @@ -200,8 +196,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCenteredTableCSSExport) { // Given a document with a centered table: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwInsertTableOptions aTableOptions(SwInsertTableFlags::NONE, 0); pWrtShell->InsertTable(aTableOptions, 1, 1); pWrtShell->MoveTable(GotoPrevTable, fnTableStart); diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx index 673947c9293c..becca79534b1 100644 --- a/sw/qa/filter/ww8/ww8.cxx +++ b/sw/qa/filter/ww8/ww8.cxx @@ -114,8 +114,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxComboBoxContentControlExport) { // Given a document with a combo box content control around a text portion: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::COMBO_BOX); // When exporting to DOCX: @@ -167,8 +166,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxContentControlDropdownEmptyDisplayText) // Given a document with a dropdown content control, the only list item has no display text // (only a value): createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST); // When saving to DOCX: @@ -185,7 +183,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxContentControlDropdownEmptyDisplayText) CPPUNIT_TEST_FIXTURE(Test, testDocxSymbolFontExport) { // Create document with symbol character and font Wingdings - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); + createSwDoc(); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); uno::Reference xCursor = xText->createTextCursor(); @@ -215,7 +213,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxFloatingTableExport) // Given a document with a floating table: createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Insert a table: SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0); pWrtShell->InsertTable(aTableOptions, 1, 1); @@ -645,7 +643,7 @@ CPPUNIT_TEST_FIXTURE(Test, tdf71749_with_footnote) { // Without the fix in place, // loading the document would hang. - loadFromFile(u"tdf71749_with_footnote.doc"); + createSwDoc("tdf71749_with_footnote.doc"); CPPUNIT_ASSERT_EQUAL(1, getPages()); } @@ -653,7 +651,7 @@ CPPUNIT_TEST_FIXTURE(Test, tdf71749_without_footnote) { // Without the fix in place, // loading the document would hang. - loadFromFile(u"tdf71749_without_footnote.doc"); + createSwDoc("tdf71749_without_footnote.doc"); CPPUNIT_ASSERT_EQUAL(1, getPages()); } } diff --git a/sw/qa/uibase/dialog/dialog.cxx b/sw/qa/uibase/dialog/dialog.cxx index 888f44614c4e..832f4c2a82e5 100644 --- a/sw/qa/uibase/dialog/dialog.cxx +++ b/sw/qa/uibase/dialog/dialog.cxx @@ -31,7 +31,6 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertSection) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a section with text: uno::Sequence aArgs = { @@ -42,7 +41,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertSection) dispatchCommand(mxComponent, u".uno:InsertSection"_ustr, aArgs); // Then make sure that we created a section that covers that text: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->EndOfSection(/*bSelect=*/true); SwCursor* pCursor = pWrtShell->GetCursor(); diff --git a/sw/qa/uibase/dochdl/dochdl.cxx b/sw/qa/uibase/dochdl/dochdl.cxx index fa62ff01a95d..d6740d84d10b 100644 --- a/sw/qa/uibase/dochdl/dochdl.cxx +++ b/sw/qa/uibase/dochdl/dochdl.cxx @@ -29,8 +29,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseDochdlTest, testSelectPasteFormat) { // Create a new document and cut a character. createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert2(u"x"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); @@ -56,8 +55,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseDochdlTest, testComplexSelection) { // Given a document where a text node has hints, but no as-char images. createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert2(u"abc"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -82,7 +80,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseDochdlTest, testComplexSelectionAtChar) // Given a document with an at-char anchored image: createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); SfxItemSet aFrameSet(pDoc->GetAttrPool(), svl::Items); SwFormatAnchor aAnchor(RndStdIds::FLY_AT_CHAR); diff --git a/sw/qa/uibase/docvw/docvw.cxx b/sw/qa/uibase/docvw/docvw.cxx index ddd2d064b6ea..bc9b45d0396a 100644 --- a/sw/qa/uibase/docvw/docvw.cxx +++ b/sw/qa/uibase/docvw/docvw.cxx @@ -33,7 +33,7 @@ CPPUNIT_TEST_FIXTURE(Test, testShiftClickOnImage) // Given a document with a fly frame: createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -52,7 +52,7 @@ CPPUNIT_TEST_FIXTURE(Test, testShiftClickOnImage) auto pFrameFormat = dynamic_cast(rSpzFormats[0]); CPPUNIT_ASSERT(pFrameFormat); SwFlyFrame* pFlyFrame = pFrameFormat->GetFrame(); - vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + vcl::Window& rEditWin = getSwDocShell()->GetView()->GetEditWin(); Point aFlyCenter = rEditWin.LogicToPixel(pFlyFrame->getFrameArea().Center()); MouseEvent aClickEvent(aFlyCenter, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT, KEY_SHIFT); rEditWin.MouseButtonDown(aClickEvent); @@ -143,7 +143,7 @@ CPPUNIT_TEST_FIXTURE(Test, testShiftDoubleClickOnImage) // Given a document with a fly frame, and an interceptor to catch the graphic dialog: createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -167,7 +167,7 @@ CPPUNIT_TEST_FIXTURE(Test, testShiftDoubleClickOnImage) auto pFrameFormat = dynamic_cast(rSpzFormats[0]); CPPUNIT_ASSERT(pFrameFormat); SwFlyFrame* pFlyFrame = pFrameFormat->GetFrame(); - vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin(); + vcl::Window& rEditWin = getSwDocShell()->GetView()->GetEditWin(); Point aFlyCenter = rEditWin.LogicToPixel(pFlyFrame->getFrameArea().Center()); MouseEvent aClickEvent(aFlyCenter, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT, KEY_SHIFT); rEditWin.MouseButtonDown(aClickEvent); diff --git a/sw/qa/uibase/fldui/fldui.cxx b/sw/qa/uibase/fldui/fldui.cxx index 230c77735b7a..28e54b52285c 100644 --- a/sw/qa/uibase/fldui/fldui.cxx +++ b/sw/qa/uibase/fldui/fldui.cxx @@ -34,7 +34,6 @@ CPPUNIT_TEST_FIXTURE(Test, testBiblioPageNumberUpdate) { // Given a document with 2 biblio fields, same properties, but different page number in the URL: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xFactory(mxComponent, uno::UNO_QUERY); uno::Reference xField( xFactory->createInstance(u"com.sun.star.text.TextField.Bibliography"_ustr), uno::UNO_QUERY); @@ -65,7 +64,7 @@ CPPUNIT_TEST_FIXTURE(Test, testBiblioPageNumberUpdate) xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false); // When changing the page number in the second field's URL: - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -98,7 +97,6 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmark) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a refmark with text: uno::Sequence aArgs = { @@ -110,7 +108,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmark) dispatchCommand(mxComponent, u".uno:InsertField"_ustr, aArgs); // Then make sure that we create a refmark that covers that text: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); std::vector aAttrs = pTextNode->GetTextAttrsAt(0, RES_TXTATR_REFMARK); // Without the accompanying fix in place, this test would have failed with: @@ -125,8 +123,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf68364InsertConditionalFieldWithTwoDots) { // Create an empty document createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // Insert a conditional field containing exactly two dots for its condition SwFieldMgr aFieldMgr(pWrtShell); @@ -145,8 +142,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkSelection) { // Given a document with a single selected word: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert2(u"myword"_ustr); pWrtShell->SelAll(); diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx index 28a31a50ed28..5e92d0b22408 100644 --- a/sw/qa/uibase/shells/shells.cxx +++ b/sw/qa/uibase/shells/shells.cxx @@ -73,7 +73,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testTdf130179) &aFrameSet, &aGrfSet, nullptr)); CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); selectShape(1); std::unique_ptr pItem; @@ -91,8 +91,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testShapeTextAlignment) #if !defined(MACOSX) && !defined(_WIN32) // Create a document with a rectangle in it. createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); Point aStartPos(1000, 1000); pWrtShell->BeginCreate(SdrObjKind::Rectangle, aStartPos); Point aMovePos(2000, 2000); @@ -100,7 +99,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testShapeTextAlignment) pWrtShell->EndCreate(SdrCreateCmd::ForceEnd); // Start shape text edit. - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); // Select the shape. selectShape(1); // Start the actual text edit. @@ -175,7 +174,6 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyUrlContextMenu) { // Given a document with a bibliography field: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xFactory(mxComponent, uno::UNO_QUERY); uno::Reference xField( xFactory->createInstance(u"com.sun.star.text.TextField.Bibliography"_ustr), uno::UNO_QUERY); @@ -194,7 +192,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyUrlContextMenu) xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false); // When selecting the field and opening the context menu: - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); SfxDispatcher* pDispatcher = pDocShell->GetViewShell()->GetViewFrame().GetDispatcher(); @@ -265,7 +263,6 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyLocalCopyContextMenu) { // Given a document with a bibliography field's local copy: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xFactory(mxComponent, uno::UNO_QUERY); uno::Reference xField( xFactory->createInstance(u"com.sun.star.text.TextField.Bibliography"_ustr), uno::UNO_QUERY); @@ -285,7 +282,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyLocalCopyContextMenu) xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false); // When selecting the field and opening the context menu: - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); SfxDispatcher* pDispatcher = pDocShell->GetViewShell()->GetViewFrame().GetDispatcher(); @@ -304,7 +301,6 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testContentControlPageBreak) { // Given a document with a content control and a cursor inside the content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -315,7 +311,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testContentControlPageBreak) uno::Reference xContentControl( xMSF->createInstance(u"com.sun.star.text.ContentControl"_ustr), uno::UNO_QUERY); xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -347,7 +343,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertTextFormField) dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); // Then make sure that it's type/name is correct: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwCursor* pCursor = pWrtShell->GetCursor(); pCursor->SttEndDoc(/*bSttDoc=*/true); sw::mark::Fieldmark* pFieldmark @@ -421,8 +417,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateFieldmarks) dispatchCommand(mxComponent, u".uno:TextFormFields"_ustr, aArgs); // Then make sure that the document text contains the new field results: - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/true); SwCursor* pCursor = pWrtShell->GetCursor(); OUString aActual = pCursor->Start()->GetNode().GetTextNode()->GetText(); @@ -471,8 +466,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testGotoMark) { // Given a document with 2 paragraphs, a bookmark on the second one: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SplitNode(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->SetBookmark(vcl::KeyCode(), u"mybookmark"_ustr); @@ -499,7 +493,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmarks) // Given a document with 2 bookmarks, first covering "B" and second covering "D": createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"ABCDE"_ustr); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -543,7 +537,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmarks) ] } } -)json"_ostr); +)json"); uno::Sequence aArgs = comphelper::containerToSequence(aArgsVec); dispatchCommand(mxComponent, u".uno:UpdateBookmarks"_ustr, aArgs); @@ -573,7 +567,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertFieldmarkReadonly) }; dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwCursor* pCursor = pWrtShell->GetCursor(); pCursor->SttEndDoc(/*bSttDoc=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -783,14 +777,13 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateRefmarks) { // Given a document with two refmarks, one is not interesting the other is a citation: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Sequence aArgs = { comphelper::makePropertyValue(u"TypeName"_ustr, uno::Any(u"SetRef"_ustr)), comphelper::makePropertyValue(u"Name"_ustr, uno::Any(u"some other old refmark"_ustr)), comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"some other old content"_ustr)), }; dispatchCommand(mxComponent, u".uno:InsertField"_ustr, aArgs); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->SplitNode(); pWrtShell->SttEndDoc(/*bStt=*/false); @@ -829,7 +822,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateRefmarks) ] } } -)json"_ostr); +)json"); aArgs = comphelper::containerToSequence(aArgsVec); dispatchCommand(mxComponent, u".uno:UpdateFields"_ustr, aArgs); @@ -855,8 +848,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateFieldmark) dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); // When updating that fieldmark to have new field command & result: - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); std::vector aArgsVec = comphelper::JsonToPropertyValues(R"json( @@ -887,7 +879,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateFieldmark) } } } -)json"_ostr); +)json"); aArgs = comphelper::containerToSequence(aArgsVec); dispatchCommand(mxComponent, u".uno:UpdateTextFormField"_ustr, aArgs); @@ -938,7 +930,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateSections) ] } } -)json"_ostr); +)json"); aArgs = comphelper::containerToSequence(aArgsVec); dispatchCommand(mxComponent, u".uno:UpdateSections"_ustr, aArgs); @@ -993,7 +985,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteFieldmarks) // i.e. the fieldmarks were not deleted. CPPUNIT_ASSERT_EQUAL(static_cast(0), pDoc->getIDocumentMarkAccess()->getAllMarksCount()); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/true); SwCursor* pCursor = pWrtShell->GetCursor(); OUString aActual = pCursor->Start()->GetNode().GetTextNode()->GetText(); @@ -1005,7 +997,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmark) // Given a document with a bookmarks, covering "BC": createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"ABCD"_ustr); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -1035,7 +1027,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmark) } } } -)json"_ostr); +)json"); uno::Sequence aArgs = comphelper::containerToSequence(aArgsVec); dispatchCommand(mxComponent, u".uno:UpdateBookmark"_ustr, aArgs); @@ -1055,7 +1047,6 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateRefmark) { // Given a document with a refmark: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Sequence aArgs = { comphelper::makePropertyValue(u"TypeName"_ustr, uno::Any(u"SetRef"_ustr)), comphelper::makePropertyValue(u"Name"_ustr, @@ -1089,12 +1080,12 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateRefmark) } } } -)json"_ostr); +)json"); aArgs = comphelper::containerToSequence(aArgsVec); dispatchCommand(mxComponent, u".uno:UpdateField"_ustr, aArgs); // Then make sure that the document text features the new content: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); // Without the accompanying fix in place, this test would have failed with: // - Expected: new content @@ -1108,7 +1099,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteBookmarks) // Given a document with 2 bookmarks, first covering "B" and second covering "D": createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->Insert(u"ABCDE"_ustr); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -1127,7 +1118,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteBookmarks) "value": "ZOTERO_BREF_" } } -)json"_ostr); +)json"); uno::Sequence aArgs = comphelper::containerToSequence(aArgsVec); dispatchCommand(mxComponent, u".uno:DeleteBookmarks"_ustr, aArgs); @@ -1164,7 +1155,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteFields) "value": "ZOTERO_ITEM CSL_CITATION" } } -)json"_ostr); +)json"); aArgs = comphelper::containerToSequence(aArgsVec); dispatchCommand(mxComponent, u".uno:DeleteFields"_ustr, aArgs); @@ -1247,7 +1238,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateSelectedField) // Given an empty doc: createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwCursorShell* pShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pShell); SwPaM* pCursor = pShell->GetCursor(); diff --git a/sw/qa/uibase/shells/textsh.cxx b/sw/qa/uibase/shells/textsh.cxx index 265ac4c7dff1..3721569977f0 100644 --- a/sw/qa/uibase/shells/textsh.cxx +++ b/sw/qa/uibase/shells/textsh.cxx @@ -56,7 +56,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDeleteSections) "value": "ZOTERO_BIBL" } } -)json"_ostr); +)json"); aArgs = comphelper::containerToSequence(aArgsVec); dispatchCommand(mxComponent, u".uno:DeleteSections"_ustr, aArgs); diff --git a/sw/qa/uibase/uiview/uiview.cxx b/sw/qa/uibase/uiview/uiview.cxx index 057287d97fcf..fe4540e64e81 100644 --- a/sw/qa/uibase/uiview/uiview.cxx +++ b/sw/qa/uibase/uiview/uiview.cxx @@ -117,10 +117,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testUpdateReplacementNosetting) CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testKeepRatio) { // Given a document with a custom KeepRatio: - OUString aURL = createFileURL(u"keep-ratio.fodt"); - - // When loading that document: - mxComponent = loadFromDesktop(aURL); + createSwDoc("keep-ratio.fodt"); // Then make sure we read the custom value: auto pXTextDocument = dynamic_cast(mxComponent.get()); @@ -236,8 +233,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testSwitchBetweenImages) // Given a document with 2 images, and an interceptor catching an UNO command that specific to // the current selection: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx index c9d49071a25b..9a3b78ec719e 100644 --- a/sw/qa/uibase/uno/uno.cxx +++ b/sw/qa/uibase/uno/uno.cxx @@ -76,7 +76,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCreateTextRangeByPixelPosition) // Given a document with 2 characters, and the pixel position of the point between them: createSwDoc(); SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert2(u"AZ"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); @@ -124,7 +124,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCreateTextRangeByPixelPositionGraphic) uno::Reference xTextContent(xTextGraphic, uno::UNO_QUERY); xBodyText->insertTextContent(xCursor, xTextContent, false); SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); SwRootFrame* pLayout = pWrtShell->GetLayout(); SwFrame* pPage = pLayout->GetLower(); @@ -175,8 +175,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCreateTextRangeByPixelPositionAtPageGr uno::Reference xCursor(xBodyText->createTextCursor()); uno::Reference xTextContent(xTextGraphic, uno::UNO_QUERY); xBodyText->insertTextContent(xCursor, xTextContent, false); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); SwRootFrame* pLayout = pWrtShell->GetLayout(); SwFrame* pPage = pLayout->GetLower(); @@ -249,8 +248,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetDocumentProperties) { // Given a document with 3 custom properties: 2 Zotero ones and one other: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwDocShell* pDocShell = pDoc->GetDocShell(); + SwDocShell* pDocShell = getSwDocShell(); uno::Reference xDPS(pDocShell->GetModel(), uno::UNO_QUERY); uno::Reference xDP = xDPS->getDocumentProperties(); @@ -323,8 +321,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetFields) { // Given a document with a refmark: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); OUString aName(u"ZOTERO_ITEM CSL_CITATION {} "_ustr); for (int i = 0; i < 5; ++i) { @@ -390,8 +387,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetTextFormField) // When stepping into the fieldmark with the cursor and getting the command value for // uno:TextFormField: - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); tools::JsonWriter aJsonWriter; @@ -455,8 +451,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetBookmark) // When stepping into the bookmark with the cursor and getting the command value for // .uno:Bookmark: - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); tools::JsonWriter aJsonWriter; @@ -489,8 +484,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetField) dispatchCommand(mxComponent, u".uno:InsertField"_ustr, aArgs); // When in the refmark with the cursor and getting the command value for .uno:Field: - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); tools::JsonWriter aJsonWriter; diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx index 467068b69afc..76449a0dd37d 100644 --- a/sw/qa/uibase/wrtsh/wrtsh.cxx +++ b/sw/qa/uibase/wrtsh/wrtsh.cxx @@ -43,10 +43,9 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertLineBreak) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a clearing break: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); std::optional oClear = SwLineBreakClear::ALL; pWrtShell->InsertLineBreak(oClear); @@ -83,7 +82,7 @@ CPPUNIT_TEST_FIXTURE(Test, testGotoContentControl) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When going to that content control in placeholder mode: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwNodeOffset nIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex(); SwTextNode* pTextNode = pDoc->GetNodes()[nIndex]->GetTextNode(); SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL); @@ -105,8 +104,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTickCheckboxContentControl) { // Given a document with a checkbox (checked) content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // The default Liberation Serif doesn't have a checkmark glyph, avoid font fallback. SwView& rView = pWrtShell->GetView(); @@ -152,10 +150,9 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertContentControl) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a content control: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT); // Then make sure that the matching text attribute is added to the document model: @@ -169,10 +166,9 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControl) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a content control: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); // The default Liberation Serif doesn't have a checkmark glyph, avoid font fallback. SwView& rView = pWrtShell->GetView(); @@ -200,7 +196,6 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDropdownContentControl) { // Given a document with a dropdown content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -231,7 +226,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDropdownContentControl) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When clicking on that content control: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL); auto pTextContentControl = static_txtattr_cast(pAttr); @@ -252,10 +247,9 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertDropdownContentControl) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a content control: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST); // Then make sure that the matching text attribute is added to the document model: @@ -276,7 +270,6 @@ CPPUNIT_TEST_FIXTURE(Test, testReplacePictureContentControl) { // Given a document with a picture content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -297,7 +290,7 @@ CPPUNIT_TEST_FIXTURE(Test, testReplacePictureContentControl) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When clicking on that content control: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->GotoObj(/*bNext=*/true, GotoObjFlags::Any); pWrtShell->EnterSelFrameMode(); const SwFrameFormat* pFlyFormat = pWrtShell->GetFlyFrameFormat(); @@ -322,10 +315,9 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertPictureContentControl) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a content control: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::PICTURE); // Then make sure that the matching text attribute is added to the document model: @@ -345,7 +337,6 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDateContentControl) { // Given a document with a date content control: createSwDoc(); - SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -362,7 +353,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDateContentControl) xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When clicking on that content control: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); SwTextAttr* pAttr = pTextNode->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL); auto pTextContentControl = static_txtattr_cast(pAttr); @@ -385,10 +376,9 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertDateContentControl) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a date content control: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DATE); // Then make sure that the matching text attribute is added to the document model: @@ -407,10 +397,9 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertPlainTextContentControl) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a plain text content control: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::PLAIN_TEXT); // Then make sure that the matching text attribute is added to the document model: @@ -436,13 +425,12 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertComboBoxContentControl) { // Given an empty document: createSwDoc(); - SwDoc* pDoc = getSwDoc(); // When inserting a combo box content control: dispatchCommand(mxComponent, u".uno:InsertComboBoxContentControl"_ustr, {}); // Then make sure that the matching text attribute is added to the document model: - SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); // Without the accompanying fix in place, this test would have failed, no content control was // inserted. diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index a95308d04153..91aace9350f9 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -341,8 +341,7 @@ void SwModelTestBase::selectShape(int number) xSelectionSupplier->select(uno::Any(getShape(number))); CPPUNIT_ASSERT(xSelectionSupplier->getSelection().hasValue()); - SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc(); - SwView* pView = pDoc->GetDocShell()->GetView(); + SwView* pView = getSwDocShell()->GetView(); // Make sure SwTextShell is replaced with SwDrawShell right now, not after 120 ms, as set in the // SwView ctor. pView->StopShellTimer(); @@ -459,7 +458,12 @@ void SwModelTestBase::createSwGlobalDoc(const char* pName) CPPUNIT_ASSERT(xServiceInfo->supportsService(u"com.sun.star.text.GlobalDocument"_ustr)); } -SwDoc* SwModelTestBase::getSwDoc() { return getSwDocShell()->GetDoc(); } +SwDoc* SwModelTestBase::getSwDoc() +{ + SwDoc* pDoc = getSwDocShell()->GetDoc(); + CPPUNIT_ASSERT(pDoc); + return pDoc; +} SwDocShell* SwModelTestBase::getSwDocShell() { diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index 8a37e74593e7..d5e25007ef13 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -397,12 +397,6 @@ interface BaseText [ StateMethod = StateInsert ; ] - FN_INSERT_HYPERLINK // status() - [ - ExecMethod = Execute ; - StateMethod = GetState; - DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; - ] SID_HYPERLINK_DIALOG [ ExecMethod = Execute ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 20a23b745338..ec808db28b46 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -3152,24 +3152,6 @@ SfxVoidItem InsertFrameInteractNoColumns FN_INSERT_FRAME_INTERACT_NOCOL GroupId = SfxGroupId::Insert; ] -SfxVoidItem InsertHyperlinkDlg FN_INSERT_HYPERLINK -() -[ - AutoUpdate = FALSE, - FastCall = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerItem; - Asynchron; - - AccelConfig = TRUE, - MenuConfig = TRUE, - ToolBoxConfig = TRUE, - GroupId = SfxGroupId::Insert; -] - SfxVoidItem InsertIndexesEntry FN_INSERT_IDX_ENTRY_DLG () [ diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 4b5aeae0450d..1a5634124777 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -237,7 +237,7 @@ void SwAccessibleParagraph::GetStates( sal_Int64& rStateSet ) assert(pFrame); if (pCaret != nullptr && sw::FrameContainsNode(*pFrame, pCaret->GetPoint()->GetNodeIndex()) && - m_nOldCaretPos != -1) + HasCursor()) { vcl::Window *pWin = GetWindow(); if( pWin && pWin->HasFocus() ) diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index cb3ff93babd0..6386b8673856 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -1394,6 +1394,45 @@ bool SwCursorShell::IsSelOnePara() const return false; } +bool SwCursorShell::IsSelStartPara() const +{ + if (m_pCurrentCursor->IsMultiSelection()) + { + return false; + } + if (m_pCurrentCursor->GetPoint()->GetContentIndex() == 0 || + m_pCurrentCursor->GetMark()->GetContentIndex() == 0) + { + return true; + } + if (GetLayout()->HasMergedParas()) + { + SwTextNode const*const pNode(m_pCurrentCursor->GetPoint()->GetNode().GetTextNode()); + if (pNode) + { + SwTextFrame const*const pFrame(static_cast( + pNode->getLayoutFrame(GetLayout()))); + if (pFrame) + { + return pFrame->MapModelToViewPos(*m_pCurrentCursor->GetPoint()) + == TextFrameIndex(0); + } + } + SwTextNode const*const pNode2(m_pCurrentCursor->GetMark()->GetNode().GetTextNode()); + if (pNode2) + { + SwTextFrame const*const pFrame(static_cast( + pNode2->getLayoutFrame(GetLayout()))); + if (pFrame) + { + return pFrame->MapModelToViewPos(*m_pCurrentCursor->GetMark()) + == TextFrameIndex(0); + } + } + } + return false; +} + bool SwCursorShell::IsSttPara() const { if (GetLayout()->HasMergedParas()) @@ -1922,6 +1961,7 @@ class SwNotifyAccAboutInvalidTextSelections void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) { + Point nOldPos = m_pCurrentCursor->GetPtPos(); CurrShell aCurr( this ); ClearUpCursors(); @@ -2421,6 +2461,10 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) GetOut()->SetSettings( aSettings ); } + // Do not notify the cursor if the position didn't change + Point nNewPos = m_pCurrentCursor->GetPtPos(); + m_bIsCursorPosChanged = nOldPos != nNewPos; + if( m_bSVCursorVis ) m_pVisibleCursor->Show(); // show again @@ -2428,6 +2472,7 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) sendLOKCursorUpdates(); getIDocumentMarkAccess()->NotifyCursorUpdate(*this); + m_bIsCursorPosChanged = false; // reset to default } void SwCursorShell::sendLOKCursorUpdates() @@ -3346,6 +3391,7 @@ SwCursorShell::SwCursorShell( SwCursorShell& rShell, vcl::Window *pInitWin ) m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd = m_bGCAttr = m_bIgnoreReadonly = m_bSelTableCells = m_bBasicHideCursor = m_bOverwriteCursor = false; + m_bIsCursorPosChanged = false; m_bSendAccessibleCursorEvents = true; m_bCallChgLnk = m_bHasFocus = m_bAutoUpdateCells = true; m_bSVCursorVis = true; @@ -3395,6 +3441,7 @@ SwCursorShell::SwCursorShell( SwDoc& rDoc, vcl::Window *pInitWin, m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd = m_bGCAttr = m_bIgnoreReadonly = m_bSelTableCells = m_bBasicHideCursor = m_bOverwriteCursor = false; + m_bIsCursorPosChanged = false; m_bSendAccessibleCursorEvents = true; m_bCallChgLnk = m_bHasFocus = m_bAutoUpdateCells = true; m_bSVCursorVis = true; diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index bccb0d510e98..9230666f2e71 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -1140,7 +1140,10 @@ void GoStartSection( SwPosition * pPos ) SwNodes& rNodes = pPos->GetNodes(); sal_uInt16 nLevel = SwNodes::GetSectionLevel( pPos->GetNode() ); if( pPos->GetNode() < *rNodes.GetEndOfContent().StartOfSectionNode() ) + { + assert(nLevel > 0); nLevel--; + } do { SwNodes::GoStartOfSection( &pPos->nNode ); } while( nLevel-- ); // already on a ContentNode @@ -1161,7 +1164,10 @@ void GoEndSection( SwPosition * pPos ) SwNodes& rNodes = pPos->GetNodes(); sal_uInt16 nLevel = SwNodes::GetSectionLevel( pPos->GetNode() ); if( pPos->GetNode() < *rNodes.GetEndOfContent().StartOfSectionNode() ) + { + assert(nLevel > 0); nLevel--; + } do { SwNodes::GoEndOfSection( &pPos->nNode ); } while( nLevel-- ); // now on an EndNode, thus to the previous ContentNode diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index c3f534d31b4b..25de24892a8d 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -247,7 +247,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell) LOK_CALLBACK_INVALIDATE_VIEW_CURSOR); } } - else + else if (m_pCursorShell->m_bIsCursorPosChanged || m_pCursorShell->IsTableMode()) { SfxLokHelper::notifyUpdatePerViewId(m_pCursorShell->GetSfxViewShell(), SfxViewShell::Current(), m_pCursorShell->GetSfxViewShell(), LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR); diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index d6b05b84c99d..03bcee46f1bf 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -1554,10 +1554,10 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId ) switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) ) { case POOLGRP_CHARFMT: - pNewFormat = m_rDoc.MakeCharFormat_(aNm, pDeriveFormat, false, true); + pNewFormat = m_rDoc.MakeCharFormat_(aNm, pDeriveFormat, true); break; case POOLGRP_FRAMEFMT: - pNewFormat = m_rDoc.MakeFrameFormat_(aNm, pDeriveFormat, false, true); + pNewFormat = m_rDoc.MakeFrameFormat_(aNm, pDeriveFormat, true); break; default: break; diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index bb1ef4788b84..0c48355c6417 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -836,7 +836,7 @@ SwFrameFormat *SwDoc::MakeFrameFormat(const OUString &rFormatName, SwFormat *SwDoc::MakeFrameFormat_(const OUString &rFormatName, SwFormat *pDerivedFrom, - bool /*bBroadcast*/, bool bAuto) + bool bAuto) { SwFrameFormat *pFrameFormat = dynamic_cast(pDerivedFrom); pFrameFormat = MakeFrameFormat( rFormatName, pFrameFormat, bAuto ); @@ -862,7 +862,7 @@ SwCharFormat *SwDoc::MakeCharFormat( const OUString &rFormatName, SwFormat *SwDoc::MakeCharFormat_(const OUString &rFormatName, SwFormat *pDerivedFrom, - bool /*bBroadcast*/, bool /*bAuto*/) + bool /*bAuto*/) { SwCharFormat *pCharFormat = dynamic_cast(pDerivedFrom); pCharFormat = MakeCharFormat( rFormatName, pCharFormat ); @@ -891,7 +891,7 @@ SwTextFormatColl* SwDoc::MakeTextFormatColl( const OUString &rFormatName, SwFormat *SwDoc::MakeTextFormatColl_(const OUString &rFormatName, SwFormat *pDerivedFrom, - bool /*bBroadcast*/, bool /*bAuto*/) + bool /*bAuto*/) { SwTextFormatColl *pTextFormatColl = dynamic_cast(pDerivedFrom); pTextFormatColl = MakeTextFormatColl( rFormatName, pTextFormatColl ); @@ -1149,7 +1149,7 @@ SwFormat* SwDoc::CopyFormat( const SwFormat& rFormat, // Create the format and copy the attributes // #i40550# - SwFormat* pNewFormat = (this->*fnCopyFormat)( rFormat.GetName(), pParent, false, true ); + SwFormat* pNewFormat = (this->*fnCopyFormat)( rFormat.GetName(), pParent, true ); pNewFormat->SetAuto( rFormat.IsAuto() ); pNewFormat->CopyAttrs( rFormat ); // copy the attributes @@ -1290,7 +1290,7 @@ void SwDoc::CopyFormatArr( const SwFormatsBase& rSourceArr, MakeCondTextFormatColl( pSrc->GetName(), static_cast(&rDfltFormat) ); else // #i40550# - (this->*fnCopyFormat)( pSrc->GetName(), &rDfltFormat, false, true ); + (this->*fnCopyFormat)( pSrc->GetName(), &rDfltFormat, true ); } } diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index a415c7247d5c..ed1a6ab64335 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -2670,10 +2670,12 @@ OUString SwDoc::GetUniqueNumRuleName( const OUString* pChkStr, bool bAutoNum ) c if( nullptr != pNumRule ) { const OUString sNm = pNumRule->GetName(); - if( sNm.startsWith( aName ) ) + std::u16string_view aSuffix; + if( sNm.startsWith( aName, &aSuffix ) && aSuffix.size() > 0 ) { // Determine Number and set the Flag - nNum = o3tl::narrowing(o3tl::toInt32(sNm.subView( nNmLen ))); + nNum = o3tl::narrowing(o3tl::toInt32(aSuffix)); + assert(nNum > 0); if( nNum-- && nNum < mpNumRuleTable->size() ) pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 )); } diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index c8563facbd85..7ea91125b876 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -107,20 +107,12 @@ SwExtTextInput::~SwExtTextInput() } else { - // 1. Insert text at start position with EMPTYEXPAND to use correct formatting - // ABC - // 2. Then remove old (not tracked) content - // ABC - - sal_Int32 nLenghtOfOldString = nEndCnt - nSttCnt; + pTNd->EraseText( rPtPos, nEndCnt - nSttCnt ); if( m_bInsText ) { - rPtPos.SetContent(nSttCnt); - rDoc.getIDocumentContentOperations().InsertString( *this, sText, SwInsertFlags::EMPTYEXPAND ); + rDoc.getIDocumentContentOperations().InsertString(*this, sText); } - - pTNd->EraseText( rPtPos, nLenghtOfOldString ); } if (!bWasIME) { @@ -202,8 +194,7 @@ void SwExtTextInput::SetInputData( const CommandExtTextInputData& rData ) pTNd->EraseText( aIdx, nEndCnt - nSttCnt ); } - // NOHINTEXPAND so we can use correct formatting in destructor when we finish composing - pTNd->InsertText( rNewStr, aIdx, SwInsertFlags::NOHINTEXPAND ); + pTNd->InsertText(rNewStr, aIdx); if( !HasMark() ) SetMark(); } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 677fa0f75784..f9cb6efbee63 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -470,12 +470,6 @@ void SwSection::Notify(SfxHint const& rHint) break; case RES_FTN_AT_TXTEND: - if( pNew && pOld ) - { - bUpdateFootnote = true; - } - break; - case RES_END_AT_TXTEND: if( pNew && pOld ) { @@ -760,8 +754,6 @@ void SwSectionFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) case RES_FTN_AT_TXTEND: case RES_END_AT_TXTEND: - GetNotifier().Broadcast(sw::LegacyModifyHint(pOld, pNew)); - return; case RES_PROTECT: case RES_EDIT_IN_READONLY: // edit in readonly sections // Pass through these Messages until the End of the tree! diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 43b08d1086f5..bc14b129e81d 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -569,7 +569,7 @@ uno::Reference lcl_FindParagraphClassificationField(const rtl: uno::Reference xField(xServiceInfo, uno::UNO_QUERY); if (lcl_IsParagraphClassificationField(xModel, xField, sKey)) { - xTextField = xField; + xTextField = std::move(xField); break; } } diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index fa3192d284b6..4751da68dd47 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -657,11 +657,7 @@ OUString SwValueFieldType::GetInputOrDateTime( const OUString& rInput, const dou SvNumberFormatter* pFormatter = m_pDoc->GetNumberFormatter(); const SvNumberformat* pEntry = pFormatter->GetEntry(nFormat); if (pEntry && (pEntry->GetType() & SvNumFormatType::DATETIME)) - { - OUString aEdit; - pFormatter->GetInputLineString( rVal, nFormat, aEdit); - return aEdit; - } + return pFormatter->GetInputLineString( rVal, nFormat ); } return rInput; } diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 05b968737cc3..3f6afd46e5ef 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1618,7 +1618,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, { if (SwSectionFrame *const pSection = pLay->FindSctFrame()) { - if (pSection && pSection->ContainsAny() == pFrame) + if (pSection->ContainsAny() == pFrame) { // tdf#146258 section PrtArea depends on paragraph upper margin pSection->InvalidatePrt(); } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index f18503ff07a7..c853a772542d 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -6400,19 +6400,19 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin // #i16816# tagged pdf support SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *_pViewShell->GetOut() ); - static vcl::DeleteOnDeinit shadowMaskObj( + static tools::DeleteOnDeinit shadowMaskObj( vcl::bitmap::loadFromName(BMP_PAGE_SHADOW_MASK, ImageLoadFlags::IgnoreDarkTheme | ImageLoadFlags::IgnoreScalingFactor)); drawinglayer::primitive2d::DiscreteShadow& shadowMask = *shadowMaskObj.get(); - static vcl::DeleteOnDeinit< BitmapEx > aPageTopRightShadowObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageBottomRightShadowObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageBottomLeftShadowObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageBottomShadowBaseObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageRightShadowBaseObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageTopShadowBaseObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageTopLeftShadowObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageLeftShadowBaseObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageTopRightShadowObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageBottomRightShadowObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageBottomLeftShadowObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageBottomShadowBaseObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageRightShadowBaseObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageTopShadowBaseObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageTopLeftShadowObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageLeftShadowBaseObj {}; BitmapEx& aPageTopRightShadow = *aPageTopRightShadowObj.get(); BitmapEx& aPageBottomRightShadow = *aPageBottomRightShadowObj.get(); BitmapEx& aPageBottomLeftShadow = *aPageBottomLeftShadowObj.get(); diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 1b9dcf6d0579..cdd52ee951fa 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -224,6 +224,7 @@ SwBidiPortion::SwBidiPortion(TextFrameIndex const nEnd, sal_uInt8 nLv) SwTwips SwBidiPortion::CalcSpacing( tools::Long nSpaceAdd, const SwTextSizeInfo& rInf ) const { + nSpaceAdd = nSpaceAdd > LONG_MAX/2 ? LONG_MAX/2 - nSpaceAdd : nSpaceAdd; return HasTabulator() ? 0 : sal_Int32(GetSpaceCnt(rInf)) * nSpaceAdd / SPACING_PRECISION_FACTOR; } @@ -510,6 +511,7 @@ void SwDoubleLinePortion::CalcBlanks( SwTextFormatInfo &rInf ) SwTwips SwDoubleLinePortion::CalcSpacing( tools::Long nSpaceAdd, const SwTextSizeInfo & ) const { + nSpaceAdd = nSpaceAdd > LONG_MAX/2 ? LONG_MAX/2 - nSpaceAdd : nSpaceAdd; return HasTabulator() ? 0 : sal_Int32(GetSpaceCnt()) * nSpaceAdd / SPACING_PRECISION_FACTOR; } diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index e9407b7af9d7..3ae9456e62d8 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -72,7 +72,6 @@ constexpr Color gWaveCol(COL_GRAY); tools::Long SwFntObj::s_nPixWidth; MapMode* SwFntObj::s_pPixMap = nullptr; -static vcl::DeleteOnDeinit< VclPtr > s_pFntObjPixOut {}; void SwFntCache::Flush( ) { @@ -992,6 +991,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) Point aTextOriginPos( rInf.GetPos() ); if( !bPrt ) { + static tools::DeleteOnDeinit< VclPtr > s_pFntObjPixOut {}; if( rInf.GetpOut() != *s_pFntObjPixOut.get() || rInf.GetOut().GetMapMode() != *s_pPixMap ) { *s_pPixMap = rInf.GetOut().GetMapMode(); diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 70773c3bdbd3..9387752df234 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -1691,12 +1691,8 @@ sal_Int32 SwXFootnotes::getCount() { SolarMutexGuard aGuard; sal_Int32 nCount = 0; - auto& rIdxs = GetDoc().GetFootnoteIdxs(); - const size_t nFootnoteCnt = rIdxs.size(); - SwTextFootnote* pTextFootnote; - for( size_t n = 0; n < nFootnoteCnt; ++n ) + for (const SwTextFootnote* pTextFootnote : GetDoc().GetFootnoteIdxs()) { - pTextFootnote = rIdxs[n]; const SwFormatFootnote& rFootnote = pTextFootnote->GetFootnote(); if ( rFootnote.IsEndNote() != m_bEndnote ) continue; @@ -1707,38 +1703,28 @@ sal_Int32 SwXFootnotes::getCount() uno::Any SwXFootnotes::getByIndex(sal_Int32 nIndex) { + if (nIndex < 0) + throw IndexOutOfBoundsException(); return uno::Any(uno::Reference< XFootnote >(getFootnoteByIndex(nIndex))); } rtl::Reference SwXFootnotes::getFootnoteByIndex(sal_Int32 nIndex) { SolarMutexGuard aGuard; - rtl::Reference xRef; sal_Int32 nCount = 0; auto& rDoc = GetDoc(); - auto& rIdxs = rDoc.GetFootnoteIdxs(); - const size_t nFootnoteCnt = rIdxs.size(); - SwTextFootnote* pTextFootnote; - for( size_t n = 0; n < nFootnoteCnt; ++n ) + for (const SwTextFootnote* pTextFootnote : rDoc.GetFootnoteIdxs()) { - pTextFootnote = rIdxs[n]; const SwFormatFootnote& rFootnote = pTextFootnote->GetFootnote(); if ( rFootnote.IsEndNote() != m_bEndnote ) continue; if(nCount == nIndex) - { - xRef = SwXFootnote::CreateXFootnote(rDoc, - &const_cast(rFootnote)); - break; - } + return SwXFootnote::CreateXFootnote(rDoc, &const_cast(rFootnote)); nCount++; } - if(!xRef.is()) - throw IndexOutOfBoundsException(); - - return xRef; + throw IndexOutOfBoundsException(); } uno::Type SAL_CALL SwXFootnotes::getElementType() @@ -1789,56 +1775,36 @@ sal_Int32 SwXReferenceMarks::getCount() uno::Any SwXReferenceMarks::getByIndex(sal_Int32 nIndex) { - SolarMutexGuard aGuard; - uno::Any aRet; - uno::Reference< XTextContent > xRef; if(0 <= nIndex && nIndex < SAL_MAX_UINT16) { + SolarMutexGuard aGuard; auto& rDoc = GetDoc(); - SwFormatRefMark *const pMark = const_cast( - rDoc.GetRefMark(o3tl::narrowing(nIndex))); - if(pMark) - { - xRef = SwXReferenceMark::CreateXReferenceMark(rDoc, pMark); - aRet <<= xRef; - } + if (auto* const pMark = const_cast(rDoc.GetRefMark(nIndex))) + return uno::Any( + uno::Reference(SwXReferenceMark::CreateXReferenceMark(rDoc, pMark))); } - if(!xRef.is()) - throw IndexOutOfBoundsException(); - return aRet; + throw IndexOutOfBoundsException(); } uno::Any SwXReferenceMarks::getByName(const OUString& rName) { SolarMutexGuard aGuard; - uno::Any aRet; - auto& rDoc = GetDoc(); - SwFormatRefMark *const pMark = - const_cast(rDoc.GetRefMark(rName)); - if(!pMark) - throw NoSuchElementException(); + if (auto* const pMark = const_cast(rDoc.GetRefMark(rName))) + return uno::Any( + uno::Reference(SwXReferenceMark::CreateXReferenceMark(rDoc, pMark))); - uno::Reference const xRef = - SwXReferenceMark::CreateXReferenceMark(rDoc, pMark); - aRet <<= xRef; - - return aRet; + throw NoSuchElementException(); } uno::Sequence< OUString > SwXReferenceMarks::getElementNames() { SolarMutexGuard aGuard; - uno::Sequence aRet; std::vector aStrings; - const sal_uInt16 nCount = GetDoc().GetRefMarks(&aStrings); - aRet.realloc(nCount); - OUString* pNames = aRet.getArray(); - for(sal_uInt16 i = 0; i < nCount; i++) - pNames[i] = aStrings[i]; + GetDoc().GetRefMarks(&aStrings); - return aRet; + return comphelper::containerToSequence(aStrings); } sal_Bool SwXReferenceMarks::hasByName(const OUString& rName) diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index a2a5e95ccf41..9cac516808e5 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -152,7 +152,7 @@ public: virtual ~BaseFrameProperties_Impl(); void SetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any& rVal); - bool GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any*& pAny ); + const uno::Any* GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId); bool FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet &rFromSet, bool& rSizeFound); virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) = 0; @@ -167,9 +167,11 @@ void BaseFrameProperties_Impl::SetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, m_aAnyMap.SetValue( nWID, nMemberId, rVal ); } -bool BaseFrameProperties_Impl::GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any*& rpAny) +const uno::Any* BaseFrameProperties_Impl::GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId) { - return m_aAnyMap.FillValue( nWID, nMemberId, rpAny ); + const uno::Any* pAny = nullptr; + m_aAnyMap.FillValue(nWID, nMemberId, pAny); + return pAny; } bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet& rFromSet, bool& rSizeFound) @@ -184,27 +186,23 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI bool bRet = true; // always add an anchor to the set SwFormatAnchor aAnchor ( rFromSet.Get ( RES_ANCHOR ) ); - { - const ::uno::Any* pAnchorType; - if(GetProperty(RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, pAnchorType)) - bRet &= static_cast(aAnchor).PutValue(*pAnchorType, MID_ANCHOR_ANCHORTYPE); - const ::uno::Any* pAnchorPgNo; - if(GetProperty(RES_ANCHOR, MID_ANCHOR_PAGENUM, pAnchorPgNo)) - bRet &= static_cast(aAnchor).PutValue(*pAnchorPgNo, MID_ANCHOR_PAGENUM); - } + if (const uno::Any* pAnchorType = GetProperty(RES_ANCHOR, MID_ANCHOR_ANCHORTYPE)) + bRet &= aAnchor.PutValue(*pAnchorType, MID_ANCHOR_ANCHORTYPE); + if (const uno::Any* pAnchorPgNo = GetProperty(RES_ANCHOR, MID_ANCHOR_PAGENUM)) + bRet &= aAnchor.PutValue(*pAnchorPgNo, MID_ANCHOR_PAGENUM); rToSet.Put(aAnchor); // check for SvxBrushItem (RES_BACKGROUND) properties - const ::uno::Any* pCol = nullptr; GetProperty(RES_BACKGROUND, MID_BACK_COLOR, pCol ); - const ::uno::Any* pRGBCol = nullptr; GetProperty(RES_BACKGROUND, MID_BACK_COLOR_R_G_B, pRGBCol ); - const ::uno::Any* pColTrans = nullptr; GetProperty(RES_BACKGROUND, MID_BACK_COLOR_TRANSPARENCY, pColTrans); - const ::uno::Any* pTrans = nullptr; GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT, pTrans ); - const ::uno::Any* pGrLoc = nullptr; GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION, pGrLoc ); - const ::uno::Any* pGraphic = nullptr; GetProperty(RES_BACKGROUND, MID_GRAPHIC, pGraphic ); - const ::uno::Any* pGrFilter = nullptr; GetProperty(RES_BACKGROUND, MID_GRAPHIC_FILTER, pGrFilter ); - const ::uno::Any* pGraphicURL = nullptr; GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL, pGraphicURL ); - const ::uno::Any* pGrTransparency = nullptr; GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENCY, pGrTransparency ); + const uno::Any* pCol = GetProperty(RES_BACKGROUND, MID_BACK_COLOR); + const uno::Any* pRGBCol = GetProperty(RES_BACKGROUND, MID_BACK_COLOR_R_G_B); + const uno::Any* pColTrans = GetProperty(RES_BACKGROUND, MID_BACK_COLOR_TRANSPARENCY); + const uno::Any* pTrans = GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT); + const uno::Any* pGrLoc = GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION); + const uno::Any* pGraphic = GetProperty(RES_BACKGROUND, MID_GRAPHIC); + const uno::Any* pGrFilter = GetProperty(RES_BACKGROUND, MID_GRAPHIC_FILTER); + const uno::Any* pGraphicURL = GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL); + const uno::Any* pGrTransparency = GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENCY); const bool bSvxBrushItemPropertiesUsed( pCol || pTrans || @@ -217,39 +215,39 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI pRGBCol); // check for FillStyle properties in the range XATTR_FILL_FIRST, XATTR_FILL_LAST - const uno::Any* pXFillStyleItem = nullptr; GetProperty(XATTR_FILLSTYLE, 0, pXFillStyleItem); - const uno::Any* pXFillColorItem = nullptr; GetProperty(XATTR_FILLCOLOR, 0, pXFillColorItem); + const uno::Any* pXFillStyleItem = GetProperty(XATTR_FILLSTYLE, 0); + const uno::Any* pXFillColorItem = GetProperty(XATTR_FILLCOLOR, 0); // XFillGradientItem: two possible slots supported in UNO API - const uno::Any* pXFillGradientItem = nullptr; GetProperty(XATTR_FILLGRADIENT, MID_FILLGRADIENT, pXFillGradientItem); - const uno::Any* pXFillGradientNameItem = nullptr; GetProperty(XATTR_FILLGRADIENT, MID_NAME, pXFillGradientNameItem); + const uno::Any* pXFillGradientItem = GetProperty(XATTR_FILLGRADIENT, MID_FILLGRADIENT); + const uno::Any* pXFillGradientNameItem = GetProperty(XATTR_FILLGRADIENT, MID_NAME); // XFillHatchItem: two possible slots supported in UNO API - const uno::Any* pXFillHatchItem = nullptr; GetProperty(XATTR_FILLHATCH, MID_FILLHATCH, pXFillHatchItem); - const uno::Any* pXFillHatchNameItem = nullptr; GetProperty(XATTR_FILLHATCH, MID_NAME, pXFillHatchNameItem); + const uno::Any* pXFillHatchItem = GetProperty(XATTR_FILLHATCH, MID_FILLHATCH); + const uno::Any* pXFillHatchNameItem = GetProperty(XATTR_FILLHATCH, MID_NAME); // XFillBitmapItem: three possible slots supported in UNO API - const uno::Any* pXFillBitmapItem = nullptr; GetProperty(XATTR_FILLBITMAP, MID_BITMAP, pXFillBitmapItem); - const uno::Any* pXFillBitmapNameItem = nullptr; GetProperty(XATTR_FILLBITMAP, MID_NAME, pXFillBitmapNameItem); + const uno::Any* pXFillBitmapItem = GetProperty(XATTR_FILLBITMAP, MID_BITMAP); + const uno::Any* pXFillBitmapNameItem = GetProperty(XATTR_FILLBITMAP, MID_NAME); - const uno::Any* pXFillTransparenceItem = nullptr; GetProperty(XATTR_FILLTRANSPARENCE, 0, pXFillTransparenceItem); - const uno::Any* pXGradientStepCountItem = nullptr; GetProperty(XATTR_GRADIENTSTEPCOUNT, 0, pXGradientStepCountItem); - const uno::Any* pXFillBmpPosItem = nullptr; GetProperty(XATTR_FILLBMP_POS, 0, pXFillBmpPosItem); - const uno::Any* pXFillBmpSizeXItem = nullptr; GetProperty(XATTR_FILLBMP_SIZEX, 0, pXFillBmpSizeXItem); - const uno::Any* pXFillBmpSizeYItem = nullptr; GetProperty(XATTR_FILLBMP_SIZEY, 0, pXFillBmpSizeYItem); + const uno::Any* pXFillTransparenceItem = GetProperty(XATTR_FILLTRANSPARENCE, 0); + const uno::Any* pXGradientStepCountItem = GetProperty(XATTR_GRADIENTSTEPCOUNT, 0); + const uno::Any* pXFillBmpPosItem = GetProperty(XATTR_FILLBMP_POS, 0); + const uno::Any* pXFillBmpSizeXItem = GetProperty(XATTR_FILLBMP_SIZEX, 0); + const uno::Any* pXFillBmpSizeYItem = GetProperty(XATTR_FILLBMP_SIZEY, 0); // XFillFloatTransparenceItem: two possible slots supported in UNO API - const uno::Any* pXFillFloatTransparenceItem = nullptr; GetProperty(XATTR_FILLFLOATTRANSPARENCE, MID_FILLGRADIENT, pXFillFloatTransparenceItem); - const uno::Any* pXFillFloatTransparenceNameItem = nullptr; GetProperty(XATTR_FILLFLOATTRANSPARENCE, MID_NAME, pXFillFloatTransparenceNameItem); + const uno::Any* pXFillFloatTransparenceItem = GetProperty(XATTR_FILLFLOATTRANSPARENCE, MID_FILLGRADIENT); + const uno::Any* pXFillFloatTransparenceNameItem = GetProperty(XATTR_FILLFLOATTRANSPARENCE, MID_NAME); - const uno::Any* pXSecondaryFillColorItem = nullptr; GetProperty(XATTR_SECONDARYFILLCOLOR, 0, pXSecondaryFillColorItem); - const uno::Any* pXFillBmpSizeLogItem = nullptr; GetProperty(XATTR_FILLBMP_SIZELOG, 0, pXFillBmpSizeLogItem); - const uno::Any* pXFillBmpTileOffsetXItem = nullptr; GetProperty(XATTR_FILLBMP_TILEOFFSETX, 0, pXFillBmpTileOffsetXItem); - const uno::Any* pXFillBmpTileOffsetYItem = nullptr; GetProperty(XATTR_FILLBMP_TILEOFFSETY, 0, pXFillBmpTileOffsetYItem); - const uno::Any* pXFillBmpPosOffsetXItem = nullptr; GetProperty(XATTR_FILLBMP_POSOFFSETX, 0, pXFillBmpPosOffsetXItem); - const uno::Any* pXFillBmpPosOffsetYItem = nullptr; GetProperty(XATTR_FILLBMP_POSOFFSETY, 0, pXFillBmpPosOffsetYItem); - const uno::Any* pXFillBackgroundItem = nullptr; GetProperty(XATTR_FILLBACKGROUND, 0, pXFillBackgroundItem); - const uno::Any* pOwnAttrFillBmpItem = nullptr; GetProperty(OWN_ATTR_FILLBMP_MODE, 0, pOwnAttrFillBmpItem); + const uno::Any* pXSecondaryFillColorItem = GetProperty(XATTR_SECONDARYFILLCOLOR, 0); + const uno::Any* pXFillBmpSizeLogItem = GetProperty(XATTR_FILLBMP_SIZELOG, 0); + const uno::Any* pXFillBmpTileOffsetXItem = GetProperty(XATTR_FILLBMP_TILEOFFSETX, 0); + const uno::Any* pXFillBmpTileOffsetYItem = GetProperty(XATTR_FILLBMP_TILEOFFSETY, 0); + const uno::Any* pXFillBmpPosOffsetXItem = GetProperty(XATTR_FILLBMP_POSOFFSETX, 0); + const uno::Any* pXFillBmpPosOffsetYItem = GetProperty(XATTR_FILLBMP_POSOFFSETY, 0); + const uno::Any* pXFillBackgroundItem = GetProperty(XATTR_FILLBACKGROUND, 0); + const uno::Any* pOwnAttrFillBmpItem = GetProperty(OWN_ATTR_FILLBMP_MODE, 0); // tdf#91140: ignore SOLID fill style for determining if fill style is used // but there is a Graphic @@ -294,49 +292,49 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI if(pCol) { - bRet &= static_cast(aBrush).PutValue(*pCol,MID_BACK_COLOR ); + bRet &= aBrush.PutValue(*pCol, MID_BACK_COLOR); } if(pColTrans) { - bRet &= static_cast(aBrush).PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY); + bRet &= aBrush.PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY); } if(pRGBCol) { - bRet &= static_cast(aBrush).PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B); + bRet &= aBrush.PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B); } if(pTrans) { // don't overwrite transparency with a non-transparence flag if(!pColTrans || Any2Bool( *pTrans )) - bRet &= static_cast(aBrush).PutValue(*pTrans, MID_GRAPHIC_TRANSPARENT); + bRet &= aBrush.PutValue(*pTrans, MID_GRAPHIC_TRANSPARENT); } if (pGraphic) { - bRet &= static_cast(aBrush).PutValue(*pGraphic, MID_GRAPHIC); + bRet &= aBrush.PutValue(*pGraphic, MID_GRAPHIC); } if (pGraphicURL) { - bRet &= static_cast(aBrush).PutValue(*pGraphicURL, MID_GRAPHIC_URL); + bRet &= aBrush.PutValue(*pGraphicURL, MID_GRAPHIC_URL); } if(pGrFilter) { - bRet &= static_cast(aBrush).PutValue(*pGrFilter, MID_GRAPHIC_FILTER); + bRet &= aBrush.PutValue(*pGrFilter, MID_GRAPHIC_FILTER); } if(pGrLoc) { - bRet &= static_cast(aBrush).PutValue(*pGrLoc, MID_GRAPHIC_POSITION); + bRet &= aBrush.PutValue(*pGrLoc, MID_GRAPHIC_POSITION); } if(pGrTransparency) { - bRet &= static_cast(aBrush).PutValue(*pGrTransparency, MID_GRAPHIC_TRANSPARENCY); + bRet &= aBrush.PutValue(*pGrTransparency, MID_GRAPHIC_TRANSPARENCY); } setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet); @@ -621,262 +619,215 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI } } { - const ::uno::Any* pCont = nullptr; - GetProperty(RES_PROTECT, MID_PROTECT_CONTENT, pCont ); - const ::uno::Any* pPos = nullptr; - GetProperty(RES_PROTECT,MID_PROTECT_POSITION, pPos ); - const ::uno::Any* pName = nullptr; - GetProperty(RES_PROTECT, MID_PROTECT_SIZE, pName ); + const uno::Any* pCont = GetProperty(RES_PROTECT, MID_PROTECT_CONTENT); + const uno::Any* pPos = GetProperty(RES_PROTECT, MID_PROTECT_POSITION); + const uno::Any* pName = GetProperty(RES_PROTECT, MID_PROTECT_SIZE); if(pCont||pPos||pName) { SvxProtectItem aProt ( rFromSet.Get ( RES_PROTECT ) ); if(pCont) - bRet &= static_cast(aProt).PutValue(*pCont, MID_PROTECT_CONTENT); + bRet &= aProt.PutValue(*pCont, MID_PROTECT_CONTENT); if(pPos ) - bRet &= static_cast(aProt).PutValue(*pPos, MID_PROTECT_POSITION); + bRet &= aProt.PutValue(*pPos, MID_PROTECT_POSITION); if(pName) - bRet &= static_cast(aProt).PutValue(*pName, MID_PROTECT_SIZE); + bRet &= aProt.PutValue(*pName, MID_PROTECT_SIZE); rToSet.Put(aProt); } } { - const ::uno::Any* pHori = nullptr; - GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, pHori ); - const ::uno::Any* pHoriP = nullptr; - GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_POSITION|CONVERT_TWIPS, pHoriP ); - const ::uno::Any* pHoriR = nullptr; - GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_RELATION, pHoriR ); - const ::uno::Any* pPageT = nullptr; - GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_PAGETOGGLE, pPageT); + const uno::Any* pHori = GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_ORIENT); + const uno::Any* pHoriP = GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_POSITION|CONVERT_TWIPS); + const uno::Any* pHoriR = GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_RELATION); + const uno::Any* pPageT = GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_PAGETOGGLE); if(pHori||pHoriP||pHoriR||pPageT) { SwFormatHoriOrient aOrient ( rFromSet.Get ( RES_HORI_ORIENT ) ); if(pHori ) - bRet &= static_cast(aOrient).PutValue(*pHori, MID_HORIORIENT_ORIENT); + bRet &= aOrient.PutValue(*pHori, MID_HORIORIENT_ORIENT); if(pHoriP) - bRet &= static_cast(aOrient).PutValue(*pHoriP, MID_HORIORIENT_POSITION|CONVERT_TWIPS); + bRet &= aOrient.PutValue(*pHoriP, MID_HORIORIENT_POSITION | CONVERT_TWIPS); if(pHoriR) - bRet &= static_cast(aOrient).PutValue(*pHoriR, MID_HORIORIENT_RELATION); + bRet &= aOrient.PutValue(*pHoriR, MID_HORIORIENT_RELATION); if(pPageT) - bRet &= static_cast(aOrient).PutValue(*pPageT, MID_HORIORIENT_PAGETOGGLE); + bRet &= aOrient.PutValue(*pPageT, MID_HORIORIENT_PAGETOGGLE); rToSet.Put(aOrient); } } { - const ::uno::Any* pVert = nullptr; - GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, pVert); - const ::uno::Any* pVertP = nullptr; - GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_POSITION|CONVERT_TWIPS, pVertP ); - const ::uno::Any* pVertR = nullptr; - GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_RELATION, pVertR ); + const uno::Any* pVert = GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_ORIENT); + const uno::Any* pVertP = GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_POSITION|CONVERT_TWIPS); + const uno::Any* pVertR = GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_RELATION); if(pVert||pVertP||pVertR) { SwFormatVertOrient aOrient ( rFromSet.Get ( RES_VERT_ORIENT ) ); if(pVert ) - bRet &= static_cast(aOrient).PutValue(*pVert, MID_VERTORIENT_ORIENT); + bRet &= aOrient.PutValue(*pVert, MID_VERTORIENT_ORIENT); if(pVertP) - bRet &= static_cast(aOrient).PutValue(*pVertP, MID_VERTORIENT_POSITION|CONVERT_TWIPS); + bRet &= aOrient.PutValue(*pVertP, MID_VERTORIENT_POSITION | CONVERT_TWIPS); if(pVertR) - bRet &= static_cast(aOrient).PutValue(*pVertR, MID_VERTORIENT_RELATION); + bRet &= aOrient.PutValue(*pVertR, MID_VERTORIENT_RELATION); rToSet.Put(aOrient); } } { - const ::uno::Any* pURL = nullptr; - GetProperty(RES_URL, MID_URL_URL, pURL ); - const ::uno::Any* pTarget = nullptr; - GetProperty(RES_URL, MID_URL_TARGET, pTarget ); - const ::uno::Any* pHyLNm = nullptr; - GetProperty(RES_URL, MID_URL_HYPERLINKNAME, pHyLNm ); - const ::uno::Any* pHySMp = nullptr; - GetProperty(RES_URL, MID_URL_SERVERMAP, pHySMp ); + const uno::Any* pURL = GetProperty(RES_URL, MID_URL_URL); + const uno::Any* pTarget = GetProperty(RES_URL, MID_URL_TARGET); + const uno::Any* pHyLNm = GetProperty(RES_URL, MID_URL_HYPERLINKNAME); + const uno::Any* pHySMp = GetProperty(RES_URL, MID_URL_SERVERMAP); if(pURL||pTarget||pHyLNm||pHySMp) { SwFormatURL aURL ( rFromSet.Get ( RES_URL ) ); if(pURL) - bRet &= static_cast(aURL).PutValue(*pURL, MID_URL_URL); + bRet &= aURL.PutValue(*pURL, MID_URL_URL); if(pTarget) - bRet &= static_cast(aURL).PutValue(*pTarget, MID_URL_TARGET); + bRet &= aURL.PutValue(*pTarget, MID_URL_TARGET); if(pHyLNm) - bRet &= static_cast(aURL).PutValue(*pHyLNm, MID_URL_HYPERLINKNAME ); + bRet &= aURL.PutValue(*pHyLNm, MID_URL_HYPERLINKNAME); if(pHySMp) - bRet &= static_cast(aURL).PutValue(*pHySMp, MID_URL_SERVERMAP); + bRet &= aURL.PutValue(*pHySMp, MID_URL_SERVERMAP); rToSet.Put(aURL); } } - const ::uno::Any* pL = nullptr; - GetProperty(RES_LR_SPACE, MID_L_MARGIN|CONVERT_TWIPS, pL ); - const ::uno::Any* pR = nullptr; - GetProperty(RES_LR_SPACE, MID_R_MARGIN|CONVERT_TWIPS, pR ); + const uno::Any* pL = GetProperty(RES_LR_SPACE, MID_L_MARGIN | CONVERT_TWIPS); + const uno::Any* pR = GetProperty(RES_LR_SPACE, MID_R_MARGIN | CONVERT_TWIPS); if(pL||pR) { SvxLRSpaceItem aLR ( rFromSet.Get ( RES_LR_SPACE ) ); if(pL) - bRet &= static_cast(aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS); + bRet &= aLR.PutValue(*pL, MID_L_MARGIN | CONVERT_TWIPS); if(pR) - bRet &= static_cast(aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS); + bRet &= aLR.PutValue(*pR, MID_R_MARGIN | CONVERT_TWIPS); rToSet.Put(aLR); } - const ::uno::Any* pT = nullptr; - GetProperty(RES_UL_SPACE, MID_UP_MARGIN|CONVERT_TWIPS, pT ); - const ::uno::Any* pB = nullptr; - GetProperty(RES_UL_SPACE, MID_LO_MARGIN|CONVERT_TWIPS, pB ); + const uno::Any* pT = GetProperty(RES_UL_SPACE, MID_UP_MARGIN | CONVERT_TWIPS); + const uno::Any* pB = GetProperty(RES_UL_SPACE, MID_LO_MARGIN | CONVERT_TWIPS); if(pT||pB) { SvxULSpaceItem aTB ( rFromSet.Get ( RES_UL_SPACE ) ); if(pT) - bRet &= static_cast(aTB).PutValue(*pT, MID_UP_MARGIN|CONVERT_TWIPS); + bRet &= aTB.PutValue(*pT, MID_UP_MARGIN | CONVERT_TWIPS); if(pB) - bRet &= static_cast(aTB).PutValue(*pB, MID_LO_MARGIN|CONVERT_TWIPS); + bRet &= aTB.PutValue(*pB, MID_LO_MARGIN | CONVERT_TWIPS); rToSet.Put(aTB); } - const ::uno::Any* pOp; - if(GetProperty(RES_OPAQUE, 0, pOp)) + if (const uno::Any* pOp = GetProperty(RES_OPAQUE, 0)) { SvxOpaqueItem aOp ( rFromSet.Get ( RES_OPAQUE ) ); - bRet &= static_cast(aOp).PutValue(*pOp, 0); + bRet &= aOp.PutValue(*pOp, 0); rToSet.Put(aOp); } - const ::uno::Any* pPrt; - if(GetProperty(RES_PRINT, 0, pPrt)) + if (const uno::Any* pPrt = GetProperty(RES_PRINT, 0)) { SvxPrintItem aPrt ( rFromSet.Get ( RES_PRINT ) ); - bRet &= static_cast(aPrt).PutValue(*pPrt, 0); + bRet &= aPrt.PutValue(*pPrt, 0); rToSet.Put(aPrt); } - const ::uno::Any* pSh; - if(GetProperty(RES_SHADOW, CONVERT_TWIPS, pSh)) + if (const uno::Any* pSh = GetProperty(RES_SHADOW, CONVERT_TWIPS)) { SvxShadowItem aSh ( rFromSet.Get ( RES_SHADOW ) ); - bRet &= static_cast(aSh).PutValue(*pSh, CONVERT_TWIPS); + bRet &= aSh.PutValue(*pSh, CONVERT_TWIPS); rToSet.Put(aSh); } - const ::uno::Any* pShTr; - if(GetProperty(RES_SHADOW, MID_SHADOW_TRANSPARENCE, pShTr) && rToSet.HasItem(RES_SHADOW)) + if (const uno::Any* pShTr = GetProperty(RES_SHADOW, MID_SHADOW_TRANSPARENCE); + pShTr && rToSet.HasItem(RES_SHADOW)) { SvxShadowItem aSh(rToSet.Get(RES_SHADOW)); bRet &= aSh.PutValue(*pShTr, MID_SHADOW_TRANSPARENCE); rToSet.Put(aSh); } - const ::uno::Any* pSur = nullptr; - GetProperty(RES_SURROUND, MID_SURROUND_SURROUNDTYPE, pSur); - const ::uno::Any* pSurCont = nullptr; - GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurCont); - const ::uno::Any* pSurAnch = nullptr; - GetProperty(RES_SURROUND, MID_SURROUND_ANCHORONLY, pSurAnch); + const uno::Any* pSur = GetProperty(RES_SURROUND, MID_SURROUND_SURROUNDTYPE); + const uno::Any* pSurAnch = GetProperty(RES_SURROUND, MID_SURROUND_ANCHORONLY); if(pSur || pSurAnch) { SwFormatSurround aSrnd ( rFromSet.Get ( RES_SURROUND ) ); if(pSur) - bRet &= static_cast(aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE); - if(pSurCont) - bRet &= static_cast(aSrnd).PutValue(*pSurCont, MID_SURROUND_CONTOUR); + bRet &= aSrnd.PutValue(*pSur, MID_SURROUND_SURROUNDTYPE); + if (const uno::Any* pSurCont = GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR)) + bRet &= aSrnd.PutValue(*pSurCont, MID_SURROUND_CONTOUR); if(pSurAnch) - bRet &= static_cast(aSrnd).PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY); + bRet &= aSrnd.PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY); rToSet.Put(aSrnd); } - const ::uno::Any* pLeft = nullptr; - GetProperty(RES_BOX, LEFT_BORDER |CONVERT_TWIPS, pLeft ); - const ::uno::Any* pRight = nullptr; - GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER , pRight ); - const ::uno::Any* pTop = nullptr; - GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER , pTop ); - const ::uno::Any* pBottom = nullptr; - GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER, pBottom); - const ::uno::Any* pDistance = nullptr; - GetProperty(RES_BOX, CONVERT_TWIPS|BORDER_DISTANCE, pDistance); - const ::uno::Any* pLeftDistance = nullptr; - GetProperty(RES_BOX, CONVERT_TWIPS|LEFT_BORDER_DISTANCE, pLeftDistance); - const ::uno::Any* pRightDistance = nullptr; - GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE, pRightDistance); - const ::uno::Any* pTopDistance = nullptr; - GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER_DISTANCE, pTopDistance); - const ::uno::Any* pBottomDistance = nullptr; - GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE, pBottomDistance); - const ::uno::Any* pLineStyle = nullptr; - GetProperty(RES_BOX, LINE_STYLE, pLineStyle); - const ::uno::Any* pLineWidth = nullptr; - GetProperty(RES_BOX, LINE_WIDTH, pLineWidth); + const uno::Any* pLeft = GetProperty(RES_BOX, LEFT_BORDER | CONVERT_TWIPS); + const uno::Any* pRight = GetProperty(RES_BOX, CONVERT_TWIPS | RIGHT_BORDER); + const uno::Any* pTop = GetProperty(RES_BOX, CONVERT_TWIPS | TOP_BORDER); + const uno::Any* pBottom = GetProperty(RES_BOX, CONVERT_TWIPS | BOTTOM_BORDER); + const uno::Any* pDistance = GetProperty(RES_BOX, CONVERT_TWIPS | BORDER_DISTANCE); + const uno::Any* pLeftDistance = GetProperty(RES_BOX, CONVERT_TWIPS | LEFT_BORDER_DISTANCE); + const uno::Any* pRightDistance = GetProperty(RES_BOX, CONVERT_TWIPS | RIGHT_BORDER_DISTANCE); + const uno::Any* pTopDistance = GetProperty(RES_BOX, CONVERT_TWIPS | TOP_BORDER_DISTANCE); + const uno::Any* pBottomDistance = GetProperty(RES_BOX, CONVERT_TWIPS | BOTTOM_BORDER_DISTANCE); + const uno::Any* pLineStyle = GetProperty(RES_BOX, LINE_STYLE); + const uno::Any* pLineWidth = GetProperty(RES_BOX, LINE_WIDTH); if( pLeft || pRight || pTop || pBottom || pDistance || pLeftDistance || pRightDistance || pTopDistance || pBottomDistance || pLineStyle || pLineWidth ) { SvxBoxItem aBox ( rFromSet.Get ( RES_BOX ) ); if( pLeft ) - bRet &= static_cast(aBox).PutValue(*pLeft, CONVERT_TWIPS|LEFT_BORDER ); + bRet &= aBox.PutValue(*pLeft, CONVERT_TWIPS | LEFT_BORDER); if( pRight ) - bRet &= static_cast(aBox).PutValue(*pRight, CONVERT_TWIPS|RIGHT_BORDER ); + bRet &= aBox.PutValue(*pRight, CONVERT_TWIPS | RIGHT_BORDER); if( pTop ) - bRet &= static_cast(aBox).PutValue(*pTop, CONVERT_TWIPS|TOP_BORDER); + bRet &= aBox.PutValue(*pTop, CONVERT_TWIPS | TOP_BORDER); if( pBottom ) - bRet &= static_cast(aBox).PutValue(*pBottom, CONVERT_TWIPS|BOTTOM_BORDER); + bRet &= aBox.PutValue(*pBottom, CONVERT_TWIPS | BOTTOM_BORDER); if( pDistance ) - bRet &= static_cast(aBox).PutValue(*pDistance, CONVERT_TWIPS|BORDER_DISTANCE); + bRet &= aBox.PutValue(*pDistance, CONVERT_TWIPS | BORDER_DISTANCE); if( pLeftDistance ) - bRet &= static_cast(aBox).PutValue(*pLeftDistance, CONVERT_TWIPS|LEFT_BORDER_DISTANCE); + bRet &= aBox.PutValue(*pLeftDistance, CONVERT_TWIPS | LEFT_BORDER_DISTANCE); if( pRightDistance ) - bRet &= static_cast(aBox).PutValue(*pRightDistance, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE); + bRet &= aBox.PutValue(*pRightDistance, CONVERT_TWIPS | RIGHT_BORDER_DISTANCE); if( pTopDistance ) - bRet &= static_cast(aBox).PutValue(*pTopDistance, CONVERT_TWIPS|TOP_BORDER_DISTANCE); + bRet &= aBox.PutValue(*pTopDistance, CONVERT_TWIPS | TOP_BORDER_DISTANCE); if( pBottomDistance ) - bRet &= static_cast(aBox).PutValue(*pBottomDistance, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE); + bRet &= aBox.PutValue(*pBottomDistance, CONVERT_TWIPS | BOTTOM_BORDER_DISTANCE); if( pLineStyle ) - bRet &= static_cast(aBox).PutValue(*pLineStyle, LINE_STYLE); + bRet &= aBox.PutValue(*pLineStyle, LINE_STYLE); if( pLineWidth ) - bRet &= static_cast(aBox).PutValue(*pLineWidth, LINE_WIDTH|CONVERT_TWIPS); + bRet &= aBox.PutValue(*pLineWidth, LINE_WIDTH | CONVERT_TWIPS); rToSet.Put(aBox); } { - const ::uno::Any* pRelH = nullptr; - GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_HEIGHT, pRelH); - const ::uno::Any* pRelHRelation = nullptr; - GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_HEIGHT_RELATION, pRelHRelation); - const ::uno::Any* pRelW = nullptr; - GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_WIDTH, pRelW); - const ::uno::Any* pRelWRelation = nullptr; - GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_WIDTH_RELATION, pRelWRelation); - const ::uno::Any* pSyncWidth = nullptr; - GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT, pSyncWidth); - const ::uno::Any* pSyncHeight = nullptr; - GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH, pSyncHeight); - const ::uno::Any* pWidth = nullptr; - GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS, pWidth); - const ::uno::Any* pHeight = nullptr; - GetProperty(RES_FRM_SIZE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS, pHeight); - const ::uno::Any* pSize = nullptr; - GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE|CONVERT_TWIPS, pSize); - const ::uno::Any* pSizeType = nullptr; - GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE_TYPE, pSizeType); - const ::uno::Any* pWidthType = nullptr; - GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH_TYPE, pWidthType); + const uno::Any* pRelH = GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_HEIGHT); + const uno::Any* pRelHRelation = GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_HEIGHT_RELATION); + const uno::Any* pRelW = GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_WIDTH); + const uno::Any* pRelWRelation = GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_WIDTH_RELATION); + const uno::Any* pSyncWidth = GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT); + const uno::Any* pSyncHeight = GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH); + const uno::Any* pWidth = GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH | CONVERT_TWIPS); + const uno::Any* pHeight = GetProperty(RES_FRM_SIZE, MID_FRMSIZE_HEIGHT | CONVERT_TWIPS); + const uno::Any* pSize = GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE | CONVERT_TWIPS); + const uno::Any* pSizeType = GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE_TYPE); + const uno::Any* pWidthType = GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH_TYPE); if( pWidth || pHeight ||pRelH || pRelHRelation || pRelW || pRelWRelation || pSize ||pSizeType || pWidthType ||pSyncWidth || pSyncHeight ) { rSizeFound = true; SwFormatFrameSize aFrameSz ( rFromSet.Get ( RES_FRM_SIZE ) ); if(pWidth) - bRet &= static_cast(aFrameSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH|CONVERT_TWIPS); + bRet &= aFrameSz.PutValue(*pWidth, MID_FRMSIZE_WIDTH | CONVERT_TWIPS); if(pHeight) - bRet &= static_cast(aFrameSz).PutValue(*pHeight, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS); + bRet &= aFrameSz.PutValue(*pHeight, MID_FRMSIZE_HEIGHT | CONVERT_TWIPS); if(pRelH ) - bRet &= static_cast(aFrameSz).PutValue(*pRelH, MID_FRMSIZE_REL_HEIGHT); + bRet &= aFrameSz.PutValue(*pRelH, MID_FRMSIZE_REL_HEIGHT); if (pRelHRelation) bRet &= aFrameSz.PutValue(*pRelHRelation, MID_FRMSIZE_REL_HEIGHT_RELATION); if(pRelW ) - bRet &= static_cast(aFrameSz).PutValue(*pRelW, MID_FRMSIZE_REL_WIDTH); + bRet &= aFrameSz.PutValue(*pRelW, MID_FRMSIZE_REL_WIDTH); if (pRelWRelation) bRet &= aFrameSz.PutValue(*pRelWRelation, MID_FRMSIZE_REL_WIDTH_RELATION); if(pSyncWidth) - bRet &= static_cast(aFrameSz).PutValue(*pSyncWidth, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT); + bRet &= aFrameSz.PutValue(*pSyncWidth, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT); if(pSyncHeight) - bRet &= static_cast(aFrameSz).PutValue(*pSyncHeight, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH); + bRet &= aFrameSz.PutValue(*pSyncHeight, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH); if(pSize) - bRet &= static_cast(aFrameSz).PutValue(*pSize, MID_FRMSIZE_SIZE|CONVERT_TWIPS); + bRet &= aFrameSz.PutValue(*pSize, MID_FRMSIZE_SIZE | CONVERT_TWIPS); if(pSizeType) - bRet &= static_cast(aFrameSz).PutValue(*pSizeType, MID_FRMSIZE_SIZE_TYPE); + bRet &= aFrameSz.PutValue(*pSizeType, MID_FRMSIZE_SIZE_TYPE); if(pWidthType) - bRet &= static_cast(aFrameSz).PutValue(*pWidthType, MID_FRMSIZE_WIDTH_TYPE); + bRet &= aFrameSz.PutValue(*pWidthType, MID_FRMSIZE_WIDTH_TYPE); if(!aFrameSz.GetWidth()) aFrameSz.SetWidth(MINFLY); if(!aFrameSz.GetHeight()) @@ -893,21 +844,17 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI aSize.Height = constTwips_1cm; ::uno::Any aSizeVal; aSizeVal <<= aSize; - static_cast(aFrameSz).PutValue(aSizeVal, MID_FRMSIZE_SIZE|CONVERT_TWIPS); + aFrameSz.PutValue(aSizeVal, MID_FRMSIZE_SIZE | CONVERT_TWIPS); rToSet.Put(aFrameSz); } } - const ::uno::Any* pFrameDirection = nullptr; - GetProperty(RES_FRAMEDIR, 0, pFrameDirection); - if(pFrameDirection) + if (const uno::Any* pFrameDirection = GetProperty(RES_FRAMEDIR, 0)) { SvxFrameDirectionItem aAttr(SvxFrameDirection::Horizontal_LR_TB, RES_FRAMEDIR); aAttr.PutValue(*pFrameDirection, 0); rToSet.Put(aAttr); } - const ::uno::Any* pUnknown = nullptr; - GetProperty(RES_UNKNOWNATR_CONTAINER, 0, pUnknown); - if(pUnknown) + if (const uno::Any* pUnknown = GetProperty(RES_UNKNOWNATR_CONTAINER, 0)) { SvXMLAttrContainerItem aAttr(RES_UNKNOWNATR_CONTAINER); aAttr.PutValue(*pUnknown, 0); @@ -915,25 +862,16 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI } // #i18732# - const ::uno::Any* pFollowTextFlow = nullptr; - GetProperty(RES_FOLLOW_TEXT_FLOW, MID_FOLLOW_TEXT_FLOW, pFollowTextFlow); - - if (pFollowTextFlow) + if (const uno::Any* pFollowTextFlow = GetProperty(RES_FOLLOW_TEXT_FLOW, MID_FOLLOW_TEXT_FLOW)) { SwFormatFollowTextFlow aFormatFollowTextFlow; - if( pFollowTextFlow ) - { - aFormatFollowTextFlow.PutValue(*pFollowTextFlow, MID_FOLLOW_TEXT_FLOW); - } - + aFormatFollowTextFlow.PutValue(*pFollowTextFlow, MID_FOLLOW_TEXT_FLOW); rToSet.Put(aFormatFollowTextFlow); } // #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS - const ::uno::Any* pWrapInfluenceOnObjPos = nullptr; - GetProperty(RES_WRAP_INFLUENCE_ON_OBJPOS, MID_WRAP_INFLUENCE, pWrapInfluenceOnObjPos); - const ::uno::Any* pAllowOverlap = nullptr; - GetProperty(RES_WRAP_INFLUENCE_ON_OBJPOS, MID_ALLOW_OVERLAP, pAllowOverlap); + const uno::Any* pWrapInfluenceOnObjPos = GetProperty(RES_WRAP_INFLUENCE_ON_OBJPOS, MID_WRAP_INFLUENCE); + const uno::Any* pAllowOverlap = GetProperty(RES_WRAP_INFLUENCE_ON_OBJPOS, MID_ALLOW_OVERLAP); if ( pWrapInfluenceOnObjPos || pAllowOverlap ) { SwFormatWrapInfluenceOnObjPos aFormatWrapInfluenceOnObjPos; @@ -944,38 +882,28 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI rToSet.Put(aFormatWrapInfluenceOnObjPos); } + if (const uno::Any* pTextVertAdjust = GetProperty(RES_TEXT_VERT_ADJUST, 0)) { - const ::uno::Any* pTextVertAdjust = nullptr; - GetProperty(RES_TEXT_VERT_ADJUST, 0, pTextVertAdjust); - if ( pTextVertAdjust ) - { - SdrTextVertAdjustItem aTextVertAdjust( rFromSet.Get ( RES_TEXT_VERT_ADJUST ) ); - bRet &= static_cast(aTextVertAdjust).PutValue(*pTextVertAdjust, 0); - rToSet.Put(aTextVertAdjust); - } + SdrTextVertAdjustItem aTextVertAdjust(rFromSet.Get(RES_TEXT_VERT_ADJUST)); + bRet &= aTextVertAdjust.PutValue(*pTextVertAdjust, 0); + rToSet.Put(aTextVertAdjust); } - const ::uno::Any* pDecorative = nullptr; - GetProperty(RES_DECORATIVE, 0, pDecorative); - if (pDecorative) + if (const uno::Any* pDecorative = GetProperty(RES_DECORATIVE, 0)) { SfxBoolItem item(RES_DECORATIVE); bRet &= item.PutValue(*pDecorative, 0); rToSet.Put(item); } - const ::uno::Any* pFlySplit = nullptr; - GetProperty(RES_FLY_SPLIT, 0, pFlySplit); - if (pFlySplit) + if (const uno::Any* pFlySplit = GetProperty(RES_FLY_SPLIT, 0)) { SwFormatFlySplit aSplit(true); bRet &= aSplit.PutValue(*pFlySplit, 0); rToSet.Put(aSplit); } - const ::uno::Any* pWrapTextAtFlyStart = nullptr; - GetProperty(RES_WRAP_TEXT_AT_FLY_START, 0, pWrapTextAtFlyStart); - if (pWrapTextAtFlyStart) + if (const uno::Any* pWrapTextAtFlyStart = GetProperty(RES_WRAP_TEXT_AT_FLY_START, 0)) { SwFormatWrapTextAtFlyStart aWrapTextAtFlyStart(true); bRet &= aWrapTextAtFlyStart.PutValue(*pWrapTextAtFlyStart, 0); @@ -993,6 +921,7 @@ public: SwFrameProperties_Impl(); bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override; + void FillCol(SfxItemSet& rToSet, const SfxItemSet& rFromSet); }; } @@ -1002,12 +931,12 @@ SwFrameProperties_Impl::SwFrameProperties_Impl(): { } -static void lcl_FillCol ( SfxItemSet &rToSet, const ::SfxItemSet &rFromSet, const ::uno::Any *pAny) +void SwFrameProperties_Impl::FillCol(SfxItemSet& rToSet, const SfxItemSet& rFromSet) { - if ( pAny ) + if (const uno::Any* pColumns = GetProperty(RES_COL, MID_COLUMNS)) { SwFormatCol aCol ( rFromSet.Get ( RES_COL ) ); - static_cast(aCol).PutValue( *pAny, MID_COLUMNS); + aCol.PutValue(*pColumns, MID_COLUMNS); rToSet.Put(aCol); } } @@ -1015,11 +944,10 @@ static void lcl_FillCol ( SfxItemSet &rToSet, const ::SfxItemSet &rFromSet, cons bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItemSet&, bool& rSizeFound) { // Properties for all frames - const ::uno::Any *pStyleName; SwDocStyleSheet* pStyle = nullptr; bool bRet; - if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) ) + if (const uno::Any* pStyleName = GetProperty(FN_UNO_FRAME_STYLE_NAME, 0)) { OUString sStyle; *pStyleName >>= sStyle; @@ -1028,23 +956,20 @@ bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItem SfxStyleFamily::Frame)); } - const ::uno::Any* pColumns = nullptr; - GetProperty (RES_COL, MID_COLUMNS, pColumns); if ( pStyle ) { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *pStyle ) ); const ::SfxItemSet *pItemSet = &xStyle->GetItemSet(); bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); - lcl_FillCol ( rSet, *pItemSet, pColumns ); + FillCol(rSet, *pItemSet); } else { const ::SfxItemSet *pItemSet = &pDoc->getIDocumentStylePoolAccess().GetFrameFormatFromPool( RES_POOLFRM_FRAME )->GetAttrSet(); bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); - lcl_FillCol ( rSet, *pItemSet, pColumns ); + FillCol(rSet, *pItemSet); } - const ::uno::Any* pEdit; - if(GetProperty(RES_EDIT_IN_READONLY, 0, pEdit)) + if (const uno::Any* pEdit = GetProperty(RES_EDIT_IN_READONLY, 0)) { SwFormatEditInReadonly item(RES_EDIT_IN_READONLY); item.PutValue(*pEdit, 0); @@ -1061,6 +986,7 @@ public: SwGraphicProperties_Impl(); virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override; + bool FillMirror(SfxItemSet& rToSet, const SfxItemSet& rFromSet); }; } @@ -1070,19 +996,24 @@ SwGraphicProperties_Impl::SwGraphicProperties_Impl( ) : { } -static void lcl_FillMirror ( SfxItemSet &rToSet, const ::SfxItemSet &rFromSet, const ::uno::Any *pHEvenMirror, const ::uno::Any *pHOddMirror, const ::uno::Any *pVMirror, bool &rRet ) +bool SwGraphicProperties_Impl::FillMirror (SfxItemSet &rToSet, const SfxItemSet &rFromSet) { + const uno::Any* pHEvenMirror = GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_EVEN_PAGES); + const uno::Any* pHOddMirror = GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_ODD_PAGES); + const uno::Any* pVMirror = GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_VERT); + bool bRet = true; if(pHEvenMirror || pHOddMirror || pVMirror ) { SwMirrorGrf aMirror ( rFromSet.Get ( RES_GRFATR_MIRRORGRF ) ); if(pHEvenMirror) - rRet &= static_cast(aMirror).PutValue(*pHEvenMirror, MID_MIRROR_HORZ_EVEN_PAGES); + bRet &= aMirror.PutValue(*pHEvenMirror, MID_MIRROR_HORZ_EVEN_PAGES); if(pHOddMirror) - rRet &= static_cast(aMirror).PutValue(*pHOddMirror, MID_MIRROR_HORZ_ODD_PAGES); + bRet &= aMirror.PutValue(*pHOddMirror, MID_MIRROR_HORZ_ODD_PAGES); if(pVMirror) - rRet &= static_cast(aMirror).PutValue(*pVMirror, MID_MIRROR_VERT); + bRet &= aMirror.PutValue(*pVMirror, MID_MIRROR_VERT); rToSet.Put(aMirror); } + return bRet; } bool SwGraphicProperties_Impl::AnyToItemSet( @@ -1093,10 +1024,9 @@ bool SwGraphicProperties_Impl::AnyToItemSet( { // Properties for all frames bool bRet; - const ::uno::Any *pStyleName; SwDocStyleSheet* pStyle = nullptr; - if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) ) + if (const uno::Any* pStyleName = GetProperty(FN_UNO_FRAME_STYLE_NAME, 0)) { OUString sStyle; *pStyleName >>= sStyle; @@ -1105,25 +1035,18 @@ bool SwGraphicProperties_Impl::AnyToItemSet( SfxStyleFamily::Frame)); } - const ::uno::Any* pHEvenMirror = nullptr; - const ::uno::Any* pHOddMirror = nullptr; - const ::uno::Any* pVMirror = nullptr; - GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_EVEN_PAGES, pHEvenMirror); - GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_ODD_PAGES, pHOddMirror); - GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_VERT, pVMirror); - if ( pStyle ) { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet(*pStyle) ); const ::SfxItemSet *pItemSet = &xStyle->GetItemSet(); bRet = FillBaseProperties(rFrameSet, *pItemSet, rSizeFound); - lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet ); + bRet &= FillMirror(rGrSet, *pItemSet); } else { const ::SfxItemSet *pItemSet = &pDoc->getIDocumentStylePoolAccess().GetFrameFormatFromPool( RES_POOLFRM_GRAPHIC )->GetAttrSet(); bRet = FillBaseProperties(rFrameSet, *pItemSet, rSizeFound); - lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet ); + bRet &= FillMirror(rGrSet, *pItemSet); } static const ::sal_uInt16 nIDs[] = @@ -1139,15 +1062,13 @@ bool SwGraphicProperties_Impl::AnyToItemSet( RES_GRFATR_INVERT, RES_GRFATR_TRANSPARENCY, RES_GRFATR_DRAWMODE, - 0 }; - const ::uno::Any* pAny; - for(sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++) + for (auto nID : nIDs) { - sal_uInt8 nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0; - if(GetProperty(nIDs[nIndex], nMId, pAny )) + sal_uInt8 nMId = RES_GRFATR_CROPGRF == nID ? CONVERT_TWIPS : 0; + if (const uno::Any* pAny = GetProperty(nID, nMId)) { - std::unique_ptr pItem(::GetDfltAttr( nIDs[nIndex] )->Clone()); + std::unique_ptr pItem(::GetDfltAttr(nID)->Clone()); bRet &= pItem->PutValue(*pAny, nMId ); rGrSet.Put(std::move(pItem)); } @@ -1171,11 +1092,10 @@ public: bool SwOLEProperties_Impl::AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) { - const ::uno::Any* pTemp; - if(!GetProperty(FN_UNO_CLSID, 0, pTemp) && !GetProperty(FN_UNO_STREAM_NAME, 0, pTemp) - && !GetProperty(FN_EMBEDDED_OBJECT, 0, pTemp) - && !GetProperty(FN_UNO_VISIBLE_AREA_WIDTH, 0, pTemp) - && !GetProperty(FN_UNO_VISIBLE_AREA_HEIGHT, 0, pTemp) ) + if(!GetProperty(FN_UNO_CLSID, 0) && !GetProperty(FN_UNO_STREAM_NAME, 0) + && !GetProperty(FN_EMBEDDED_OBJECT, 0) + && !GetProperty(FN_UNO_VISIBLE_AREA_WIDTH, 0) + && !GetProperty(FN_UNO_VISIBLE_AREA_HEIGHT, 0) ) return false; SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrameSet, rSet, rSizeFound); @@ -2343,11 +2263,10 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) throw uno::RuntimeException(); if(WID_LAYOUT_SIZE != pEntry->nWID) // there is no LayoutSize in a descriptor { - const uno::Any* pAny = nullptr; - if (!m_pProps->GetProperty(pEntry->nWID, nMemberId, pAny)) - aAny = mxStyleData->getPropertyValue( rPropertyName ); - else if ( pAny ) + if (const uno::Any* pAny = m_pProps->GetProperty(pEntry->nWID, nMemberId)) aAny = *pAny; + else + aAny = mxStyleData->getPropertyValue( rPropertyName ); } } else @@ -2811,9 +2730,8 @@ void SwXFrame::attachToRange(uno::Reference const& xTextRange, } } - const ::uno::Any* pStyle; SwFrameFormat *pParentFrameFormat = nullptr; - if (m_pProps->GetProperty(FN_UNO_FRAME_STYLE_NAME, 0, pStyle)) + if (const uno::Any* pStyle = m_pProps->GetProperty(FN_UNO_FRAME_STYLE_NAME, 0)) pParentFrameFormat = lcl_GetFrameFormat( *pStyle, pDoc ); SwFlyFrameFormat* pFormat = nullptr; @@ -2873,8 +2791,7 @@ void SwXFrame::attachToRange(uno::Reference const& xTextRange, Graphic aGraphic; // Read graphic URL from the descriptor, if it has any. - const ::uno::Any* pGraphicURL; - if (m_pProps->GetProperty(FN_UNO_GRAPHIC_URL, 0, pGraphicURL)) + if (const uno::Any* pGraphicURL = m_pProps->GetProperty(FN_UNO_GRAPHIC_URL, 0)) { OUString sGraphicURL; uno::Reference xBitmap; @@ -2888,9 +2805,7 @@ void SwXFrame::attachToRange(uno::Reference const& xTextRange, } } - const ::uno::Any* pGraphicAny; - const bool bHasGraphic = m_pProps->GetProperty(FN_UNO_GRAPHIC, 0, pGraphicAny); - if (bHasGraphic) + if (const uno::Any* pGraphicAny = m_pProps->GetProperty(FN_UNO_GRAPHIC, 0)) { uno::Reference xGraphic; (*pGraphicAny) >>= xGraphic; @@ -2898,8 +2813,7 @@ void SwXFrame::attachToRange(uno::Reference const& xTextRange, } OUString sFilterName; - const uno::Any* pFilterAny; - if (m_pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilterAny)) + if (const uno::Any* pFilterAny = m_pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0)) { (*pFilterAny) >>= sFilterName; } @@ -2919,30 +2833,23 @@ void SwXFrame::attachToRange(uno::Reference const& xTextRange, pDoc->SetFlyName(*pFormat, m_sName); } - const ::uno::Any* pSurroundContour; - if (m_pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurroundContour)) + if (const uno::Any* pSurroundContour = m_pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR)) setPropertyValue(UNO_NAME_SURROUND_CONTOUR, *pSurroundContour); - const ::uno::Any* pContourOutside; - if (m_pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUROUTSIDE, pContourOutside)) + if (const uno::Any* pContourOutside = m_pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUROUTSIDE)) setPropertyValue(UNO_NAME_CONTOUR_OUTSIDE, *pContourOutside); - const ::uno::Any* pContourPoly; - if (m_pProps->GetProperty(FN_PARAM_CONTOUR_PP, 0, pContourPoly)) + if (const ::uno::Any* pContourPoly = m_pProps->GetProperty(FN_PARAM_CONTOUR_PP, 0)) setPropertyValue(UNO_NAME_CONTOUR_POLY_POLYGON, *pContourPoly); - const ::uno::Any* pPixelContour; - if (m_pProps->GetProperty(FN_UNO_IS_PIXEL_CONTOUR, 0, pPixelContour)) + if (const uno::Any* pPixelContour = m_pProps->GetProperty(FN_UNO_IS_PIXEL_CONTOUR, 0)) setPropertyValue(UNO_NAME_IS_PIXEL_CONTOUR, *pPixelContour); - const ::uno::Any* pAutoContour; - if (m_pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0, pAutoContour)) + if (const uno::Any* pAutoContour = m_pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0)) setPropertyValue(UNO_NAME_IS_AUTOMATIC_CONTOUR, *pAutoContour); } else { - const ::uno::Any* pCLSID = nullptr; - const ::uno::Any* pStreamName = nullptr; - const ::uno::Any* pEmbeddedObject = nullptr; - if (!m_pProps->GetProperty(FN_UNO_CLSID, 0, pCLSID) - && !m_pProps->GetProperty(FN_UNO_STREAM_NAME, 0, pStreamName) - && !m_pProps->GetProperty(FN_EMBEDDED_OBJECT, 0, pEmbeddedObject)) + const uno::Any* pCLSID = m_pProps->GetProperty(FN_UNO_CLSID, 0); + const uno::Any* pStreamName = m_pProps->GetProperty(FN_UNO_STREAM_NAME, 0); + const uno::Any* pEmbeddedObject = m_pProps->GetProperty(FN_EMBEDDED_OBJECT, 0); + if (!pCLSID && !pStreamName && !pEmbeddedObject) { throw uno::RuntimeException(); } @@ -3109,28 +3016,23 @@ void SwXFrame::attachToRange(uno::Reference const& xTextRange, } if( pFormat && pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) GetOrCreateSdrObject(*pFormat); - const ::uno::Any* pOrder; - if (m_pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder)) + if (const uno::Any* pOrder = m_pProps->GetProperty(FN_UNO_Z_ORDER, 0)) setPropertyValue(UNO_NAME_Z_ORDER, *pOrder); - const ::uno::Any* pReplacement; - if (m_pProps->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC, 0, pReplacement)) + if (const uno::Any* pReplacement = m_pProps->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC, 0)) setPropertyValue(UNO_NAME_GRAPHIC, *pReplacement); // new attribute Title - const ::uno::Any* pTitle; - if (m_pProps->GetProperty(FN_UNO_TITLE, 0, pTitle)) + if (const uno::Any* pTitle = m_pProps->GetProperty(FN_UNO_TITLE, 0)) { setPropertyValue(UNO_NAME_TITLE, *pTitle); } // new attribute Description - const ::uno::Any* pDescription; - if (m_pProps->GetProperty(FN_UNO_DESCRIPTION, 0, pDescription)) + if (const uno::Any* pDescription = m_pProps->GetProperty(FN_UNO_DESCRIPTION, 0)) { setPropertyValue(UNO_NAME_DESCRIPTION, *pDescription); } // For grabbag - const uno::Any* pFrameIntropgrabbagItem; - if (m_pProps->GetProperty(RES_FRMATR_GRABBAG, 0, pFrameIntropgrabbagItem)) + if (const uno::Any* pFrameIntropgrabbagItem = m_pProps->GetProperty(RES_FRMATR_GRABBAG, 0)) { setPropertyValue(UNO_NAME_FRAME_INTEROP_GRAB_BAG, *pFrameIntropgrabbagItem); } diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 2326dd007361..3d3f52d60516 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1757,7 +1757,7 @@ public: SwTableProperties_Impl(); void SetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& aVal); - bool GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& rpAny); + const uno::Any* GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId); void AddItemToSet(SfxItemSet& rSet, std::function()> aItemFactory, sal_uInt16 nWhich, std::initializer_list vMember, bool bAddTwips = false); void ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc); @@ -1773,9 +1773,11 @@ void SwTableProperties_Impl::SetProperty(sal_uInt16 nWhichId, sal_uInt16 nMember m_aAnyMap.SetValue(nWhichId, nMemberId, rVal); } -bool SwTableProperties_Impl::GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& rpAny ) +const uno::Any* SwTableProperties_Impl::GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId) { - return m_aAnyMap.FillValue(nWhichId, nMemberId, rpAny); + const uno::Any* pAny = nullptr; + m_aAnyMap.FillValue(nWhichId, nMemberId, pAny); + return pAny; } void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet, @@ -1785,9 +1787,7 @@ void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet, std::vector< std::pair > vMemberAndAny; for(sal_uInt16 nMember : vMember) { - const uno::Any* pAny = nullptr; - GetProperty(nWhich, nMember, pAny); - if(pAny) + if (const uno::Any* pAny = GetProperty(nWhich, nMember)) vMemberAndAny.emplace_back(nMember, pAny); } if(!vMemberAndAny.empty()) @@ -1808,9 +1808,8 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc) RES_KEEP, RES_KEEP, RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT> aSet(rDoc.GetAttrPool()); - const uno::Any* pRepHead; const SwFrameFormat &rFrameFormat = *rTable.GetFrameFormat(); - if(GetProperty(FN_TABLE_HEADLINE_REPEAT, 0xff, pRepHead )) + if (const uno::Any* pRepHead = GetProperty(FN_TABLE_HEADLINE_REPEAT, 0xff)) { bool bVal(pRepHead->get()); const_cast(rTable).SetRowsToRepeat( bVal ? 1 : 0 ); // TODO: MULTIHEADER @@ -1824,8 +1823,10 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc) MID_GRAPHIC_FILTER }); bool bPutBreak = true; - const uno::Any* pPage; - if(GetProperty(FN_UNO_PAGE_STYLE, 0, pPage) || GetProperty(RES_PAGEDESC, 0xff, pPage)) + const uno::Any* pPage = GetProperty(FN_UNO_PAGE_STYLE, 0); + if (!pPage) + pPage = GetProperty(RES_PAGEDESC, 0xff); + if (pPage) { OUString sPageStyle = pPage->get(); if(!sPageStyle.isEmpty()) @@ -1835,8 +1836,7 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc) if(pDesc) { SwFormatPageDesc aDesc(pDesc); - const uno::Any* pPgNo; - if(GetProperty(RES_PAGEDESC, MID_PAGEDESC_PAGENUMOFFSET, pPgNo)) + if (const uno::Any* pPgNo = GetProperty(RES_PAGEDESC, MID_PAGEDESC_PAGENUMOFFSET)) { aDesc.SetNumOffset(pPgNo->get()); } @@ -1853,23 +1853,19 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc) AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr(rFrameFormat.GetKeep().Clone()); }, RES_KEEP, {0}); AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr(rFrameFormat.GetHoriOrient().Clone()); }, RES_HORI_ORIENT, {MID_HORIORIENT_ORIENT}, true); - const uno::Any* pSzRel(nullptr); - GetProperty(FN_TABLE_IS_RELATIVE_WIDTH, 0xff, pSzRel); - const uno::Any* pRelWidth(nullptr); - GetProperty(FN_TABLE_RELATIVE_WIDTH, 0xff, pRelWidth); - const uno::Any* pWidth(nullptr); - GetProperty(FN_TABLE_WIDTH, 0xff, pWidth); + const uno::Any* pSzRel = GetProperty(FN_TABLE_IS_RELATIVE_WIDTH, 0xff); + const uno::Any* pRelWidth = GetProperty(FN_TABLE_RELATIVE_WIDTH, 0xff); - bool bPutSize = pWidth != nullptr; + bool bPutSize = false; SwFormatFrameSize aSz(SwFrameSize::Variable); - if(pWidth) + if (const uno::Any* pWidth = GetProperty(FN_TABLE_WIDTH, 0xff)) { aSz.PutValue(*pWidth, MID_FRMSIZE_WIDTH); bPutSize = true; } if(pSzRel && pSzRel->get() && pRelWidth) { - aSz.PutValue(*pRelWidth, MID_FRMSIZE_REL_WIDTH|CONVERT_TWIPS); + aSz.PutValue(*pRelWidth, MID_FRMSIZE_REL_WIDTH|CONVERT_TWIPS); // CONVERT_TWIPS here??? bPutSize = true; } if(bPutSize) @@ -1884,8 +1880,7 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc) AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr(rFrameFormat.GetULSpace().Clone()); }, RES_UL_SPACE, { MID_UP_MARGIN|CONVERT_TWIPS, MID_LO_MARGIN|CONVERT_TWIPS }); - const::uno::Any* pSplit(nullptr); - if(GetProperty(RES_LAYOUT_SPLIT, 0, pSplit)) + if (const ::uno::Any* pSplit = GetProperty(RES_LAYOUT_SPLIT, 0)) { SwFormatLayoutSplit aSp(pSplit->get()); aSet.Put(aSp); @@ -2123,8 +2118,7 @@ SwXTextTable::attach(const uno::Reference & xTextRange) } OUString tableName; - if (const::uno::Any* pName; - m_pImpl->m_pTableProps->GetProperty(FN_UNO_TABLE_NAME, 0, pName)) + if (const uno::Any* pName = m_pImpl->m_pTableProps->GetProperty(FN_UNO_TABLE_NAME, 0)) { tableName = pName->get(); } @@ -2965,11 +2959,10 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) } else if (m_pImpl->IsDescriptor()) { - const uno::Any* pAny = nullptr; - if (!m_pImpl->m_pTableProps->GetProperty(pEntry->nWID, pEntry->nMemberId, pAny)) - throw lang::IllegalArgumentException(); - else if(pAny) + if (const uno::Any* pAny = m_pImpl->m_pTableProps->GetProperty(pEntry->nWID, pEntry->nMemberId)) aRet = *pAny; + else + throw lang::IllegalArgumentException(); } else throw uno::RuntimeException(); diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index b363d1a42fa6..35bf15bdc48c 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -250,6 +250,7 @@ void SwPagePreviewLayout::ApplyNewZoomAtViewShell( sal_uInt8 _aNewZoom ) */ void SwPagePreviewLayout::ReInit() { + mbPrintEmptyPages = mrParentViewShell.getIDocumentDeviceAccess().getPrintData().IsPrintEmptyPages(); // check environment and parameters { bool bLayoutSettingsValid = mbLayoutInfoValid && mbLayoutSizesValid; diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index ee06ea0179d7..dccebd31546f 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -89,7 +89,12 @@ bool SwViewShell::sbLstAct = false; ShellResource *SwViewShell::spShellRes = nullptr; -vcl::DeleteOnDeinit> SwViewShell::spCareDialog {}; + +static tools::DeleteOnDeinit>& getCareDialog() +{ + static tools::DeleteOnDeinit> spCareDialog {}; ///< Avoid this window. + return spCareDialog; +} static bool bInSizeNotify = false; @@ -2731,11 +2736,20 @@ ShellResource* SwViewShell::GetShellRes() return spShellRes; } +//static void SwViewShell::SetCareDialog(const std::shared_ptr& rNew) { + auto& spCareDialog = getCareDialog(); (*spCareDialog.get()) = rNew; } +//static +weld::Window* SwViewShell::GetCareDialog(SwViewShell const & rVSh) +{ + auto& spCareDialog = getCareDialog(); + return (*spCareDialog.get()) ? spCareDialog.get()->get() : CareChildWin(rVSh); +} + sal_uInt16 SwViewShell::GetPageCount() const { return GetLayout() ? GetLayout()->GetPageNum() : 1; diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 21fbc71a836f..38bee88aaa93 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -694,7 +694,11 @@ static void OutHTML_SwFormat( SwHTMLWriter& rWrt, const SwFormat& rFormat, if( bNumbered ) { - if( !rWrt.m_aBulletGrfs[nBulletGrfLvl].isEmpty() ) + // disable PVS False positive 557 "Array underrun is possible" + // we know here that nBulletGrfLvl < 10 + // we're in the case bInNumberBulletList && bNumbered + // so we retrieved nLvl which comes from SwHTMLNumRuleInfo::GetLevel() + if( !rWrt.m_aBulletGrfs[nBulletGrfLvl].isEmpty() ) //-V557 bNumbered = false; else nBulletGrfLvl = 255; diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 42db807771f9..9d90df1842e2 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -311,7 +311,7 @@ void SwHTMLWriter::OutForm( bool bTag_On, const SwStartNode *pStartNd ) { // A form should be opened in the table/area which isn't completely // inside the table. Then we must also now open the form. - xNewFormComps = xCurrentFormComps; + xNewFormComps = std::move(xCurrentFormComps); } } @@ -329,7 +329,7 @@ void SwHTMLWriter::OutForm( bool bTag_On, const SwStartNode *pStartNd ) //!!!nWarn = 1; // Control will be assigned to wrong form } - mxFormComps = xNewFormComps; + mxFormComps = std::move(xNewFormComps); OutForm( true, mxFormComps ); uno::Reference< beans::XPropertySet > xTmp; diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 3b7e2f887886..b4a277ec5df4 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -1462,7 +1462,7 @@ TypedWhichId SwHTMLWriter::GetLangWhichIdFromScript( sal_uInt16 nWhichId = RES_CHRATR_CJK_LANGUAGE; break; case CSS1_OUTMODE_CTL: - nWhichId = RES_CHRATR_CJK_LANGUAGE; + nWhichId = RES_CHRATR_CTL_LANGUAGE; break; default: nWhichId = RES_CHRATR_LANGUAGE; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 9ff7da04e015..de5deb897463 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3643,6 +3643,12 @@ void DocxAttributeOutput::WriteCollectedRunProperties() } m_aTextEffectsGrabBag.clear(); m_aTextFillGrabBag.clear(); + + if ( m_bParaInlineHeading ) + { + m_pSerializer->singleElementNS(XML_w, XML_specVanish); + m_bParaInlineHeading = false; + } } void DocxAttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData ) @@ -4127,8 +4133,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData) m_pSerializer->startElementNS(XML_w, XML_rPr); // Output the redline item set - if (pChangesSet) - m_rExport.OutputItemSet( *pChangesSet, false, true, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF ); + m_rExport.OutputItemSet( *pChangesSet, false, true, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF ); m_pSerializer->endElementNS( XML_w, XML_rPr ); @@ -10196,6 +10201,8 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem) { // Handled already in StartParagraph(). } + else if (rGrabBagElement.first == "ParaInlineHeading") + m_bParaInlineHeading = true; else SAL_WARN("sw.ww8", "DocxAttributeOutput::ParaGrabBag: unhandled grab bag property " << rGrabBagElement.first ); } @@ -10351,7 +10358,8 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, const FSHelperPtr m_bParaBeforeAutoSpacing(false), m_bParaAfterAutoSpacing(false), m_nParaBeforeSpacing(0), - m_nParaAfterSpacing(0) + m_nParaAfterSpacing(0), + m_bParaInlineHeading(false) , m_nStateOfFlyFrame( FLY_NOT_PROCESSED ) { m_nHyperLinkCount.push_back(0); diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index c6626051f332..02b8190ad31d 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -1073,6 +1073,8 @@ private: bool m_bParaBeforeAutoSpacing,m_bParaAfterAutoSpacing; // store hardcoded value which was set during import. sal_Int32 m_nParaBeforeSpacing,m_nParaAfterSpacing; + // flag inline heading + bool m_bParaInlineHeading; SdtBlockHelper m_aParagraphSdt; SdtBlockHelper m_aRunSdt; diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index c1066d355569..69707aa46c24 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2208,8 +2208,10 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) m_pTextBxs = mrWrt.m_pTextBxs.get(); } - for( ; i--; pSdrObjs = mrWrt.m_pSdrObjs.get(), m_pTextBxs = mrWrt.m_pTextBxs.get() ) + while (i > 0) { + --i; + // "dummy char" (or any Count ?) - why? Only Microsoft knows it. GetStream().WriteChar( i ); @@ -2308,6 +2310,9 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) CloseContainer(); // ESCHER_SpContainer } CloseContainer(); // ESCHER_DgContainer + + pSdrObjs = mrWrt.m_pSdrObjs.get(); + m_pTextBxs = mrWrt.m_pTextBxs.get(); } } diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index c67a7b691cc0..b4451803bb28 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -179,6 +179,34 @@ lcl_getLinkChainName(const uno::Reference& rPropertySet, return sLinkChainName; } +static bool lcl_IsInlineHeading(const ww8::Frame &rFrame) +{ + const SwFrameFormat& rFrameFormat = rFrame.GetFrameFormat(); + + uno::Reference xShape; + const SdrObject* pSdrObj = rFrameFormat.FindRealSdrObject(); + if (pSdrObj) + xShape.set(const_cast(pSdrObj)->getUnoShape(), uno::UNO_QUERY); + uno::Reference xPropertySet(xShape, uno::UNO_QUERY); + uno::Reference xPropSetInfo; + if (xPropertySet.is()) + xPropSetInfo = xPropertySet->getPropertySetInfo(); + + if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(u"FrameInteropGrabBag"_ustr)) + { + uno::Sequence propList; + xPropertySet->getPropertyValue(u"FrameInteropGrabBag"_ustr) >>= propList; + auto pProp = std::find_if(std::cbegin(propList), std::cend(propList), + [](const beans::PropertyValue& rProp) { + return rProp.Name == "FrameInlineHeading"; + }); + if (pProp != std::cend(propList)) + return true; + } + + return false; +} + MSWordAttrIter::MSWordAttrIter( MSWordExportBase& rExport ) : m_pOld( rExport.m_pChpIter ), m_rExport( rExport ) { @@ -724,7 +752,7 @@ bool SwWW8AttrIter::IsAnchorLinkedToThisNode( SwNodeOffset nNodePos ) return nNodePos == maFlyIter->GetPosition().GetNodeIndex(); } -bool SwWW8AttrIter::HasFlysAt(sal_Int32 nSwPos) const +bool SwWW8AttrIter::HasFlysAt(sal_Int32 nSwPos, const ww8::Frame** pInlineHeading) const { for (const auto& rFly : maFlyFrames) { @@ -732,7 +760,16 @@ bool SwWW8AttrIter::HasFlysAt(sal_Int32 nSwPos) const const sal_Int32 nPos = rAnchor.GetContentIndex(); if (nPos == nSwPos) { - return true; + if ( pInlineHeading ) + { + if ( lcl_IsInlineHeading(rFly) ) + { + *pInlineHeading = &rFly; + return true; + } + } + else + return true; } } @@ -836,6 +873,10 @@ FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos) // Should not write watermark object in the main body text } } + else if ( lcl_IsInlineHeading(*maFlyIter) ) + { + // Should not write inline heading again + } else { // This is not a watermark object - write normally @@ -2306,6 +2347,21 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) { SAL_INFO( "sw.ww8", "" ); + SwWW8AttrIter aWatermarkAttrIter( *this, rNode ); + + // export inline heading + const ww8::Frame* pInlineHeading; + if (aWatermarkAttrIter.HasFlysAt(0, &pInlineHeading)) + { + if (pInlineHeading->GetContent()->IsTextNode()) + { + SwTextNode *pTextNode = + const_cast(pInlineHeading->GetContent()->GetTextNode()); + if (pTextNode) + OutputTextNode(*pTextNode); + } + } + ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo( m_pTableInfo->getTableNodeInfo( &rNode ) ); //For i120928,identify the last node @@ -2320,7 +2376,6 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) // In order to make sure watermark is stored in 'header.xml', check nTextTyp. // if it is document.xml, don't write the tags (watermark should be only in the 'header') - SwWW8AttrIter aWatermarkAttrIter( *this, rNode ); if (( TXT_HDFT != m_nTextTyp) && aWatermarkAttrIter.IsWatermarkFrame()) { return; diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index cf0e047dd9c2..5019c8c5f329 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2106,11 +2106,11 @@ static sal_uInt16 lcl_TCFlags(SwDoc &rDoc, const SwTableBox * pBox, sal_Int32 nR 0, static_cast(pCNd)->GetText().getLength()); if ( const SvxCharRotateItem * pRotate = aCoreSet.GetItemIfSet(RES_CHRATR_ROTATE)) { - if(pRotate && pRotate->GetValue() == 900_deg10) + if(pRotate->GetValue() == 900_deg10) { nFlags = nFlags | 0x0004 | 0x0008; } - else if(pRotate && pRotate->GetValue() == 2700_deg10 ) + else if(pRotate->GetValue() == 2700_deg10 ) { nFlags = nFlags | 0x0004 | 0x0010; } diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index fb90c8a464e1..a4e85ebc7c1b 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -1576,7 +1576,7 @@ public: const SwRedlineData* GetParagraphLevelRedline( ); const SwRedlineData* GetRunLevelRedline( sal_Int32 nPos ); FlyProcessingState OutFlys(sal_Int32 nSwPos); - bool HasFlysAt(sal_Int32 nSwPos) const; + bool HasFlysAt(sal_Int32 nSwPos, const ww8::Frame** pInlineHeading = nullptr) const; sal_Int32 WhereNext() const { return m_nCurrentSwPos; } sal_uInt16 GetScript() const { return mnScript; } diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 7ac03cd85787..354f32ac4f86 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2586,7 +2586,7 @@ bool SwMSConvertControls::InsertControl( xControlShape->setControl( xControlModel ); if (pShape) - *pShape = xShape; + *pShape = std::move(xShape); return true; } diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 76b62fe426f5..8bd58ca29baf 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1926,7 +1926,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox( // default num format? if( const SwTableBoxNumFormat* pNumFormat = pBoxFormat2->GetItemIfSet( RES_BOXATR_FORMAT, false ) ) { - if (pNumFormat && (pNumFormat->GetValue() % SV_COUNTRY_LANGUAGE_OFFSET) == 0) + if ((pNumFormat->GetValue() % SV_COUNTRY_LANGUAGE_OFFSET) == 0) { // only one text node? SwNodeIndex aNodeIndex( *(pCell->GetStartNode()), 1 ); @@ -1980,8 +1980,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox( const SwDoc* pDoc = m_pBoxFormat->GetDoc(); const SvNumberFormatter* pNumberFormatter = pDoc ? pDoc->GetNumberFormatter() : nullptr; - if( pNumFormat != nullptr && pNumberFormatter && - !pNumberFormatter->GetEntry( pNumFormat->GetValue() )->IsTextFormat() ) + if( pNumberFormatter && !pNumberFormatter->GetEntry( pNumFormat->GetValue() )->IsTextFormat() ) m_pBoxFormat->ResetFormatAttr( RES_BOXATR_FORMAT ); } } diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx index e980467eb0a5..e767456266e1 100644 --- a/sw/source/ui/chrdlg/break.cxx +++ b/sw/source/ui/chrdlg/break.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -61,6 +62,7 @@ void SwBreakDlg::rememberResult() IMPL_LINK_NOARG(SwBreakDlg, ToggleHdl, weld::Toggleable&, void) { CheckEnable(); + UpdateImage(); } IMPL_LINK_NOARG(SwBreakDlg, ChangeHdl, weld::ComboBox&, void) @@ -68,6 +70,11 @@ IMPL_LINK_NOARG(SwBreakDlg, ChangeHdl, weld::ComboBox&, void) CheckEnable(); } +IMPL_LINK_NOARG(SwBreakDlg, LineClearHdl, weld::ComboBox&, void) +{ + UpdateImage(); +} + // Handler for Change Page Number IMPL_LINK(SwBreakDlg, PageNumHdl, weld::Toggleable&, rBox, void) { @@ -137,6 +144,7 @@ SwBreakDlg::SwBreakDlg(weld::Window *pParent, SwWrtShell &rS) , m_xPageNumBox(m_xBuilder->weld_check_button(u"pagenumcb"_ustr)) , m_xPageNumEdit(m_xBuilder->weld_spin_button(u"pagenumsb"_ustr)) , m_xOkBtn(m_xBuilder->weld_button(u"ok"_ustr)) + , m_xTypeImage(m_xBuilder->weld_image(u"imType"_ustr)) , m_rSh(rS) , m_nKind(0) , m_bHtmlMode(0 != ::GetHtmlMode(rS.GetView().GetDocShell())) @@ -146,6 +154,7 @@ SwBreakDlg::SwBreakDlg(weld::Window *pParent, SwWrtShell &rS) m_xLineBtn->connect_toggled(aLk); m_xColumnBtn->connect_toggled(aLk); m_xPageCollBox->connect_changed(LINK(this, SwBreakDlg, ChangeHdl)); + m_xLineClearBox->connect_changed(LINK(this, SwBreakDlg, LineClearHdl)); m_xOkBtn->connect_clicked(LINK(this, SwBreakDlg, OkHdl)); m_xPageNumBox->connect_toggled(LINK(this, SwBreakDlg, PageNumHdl)); @@ -172,6 +181,7 @@ SwBreakDlg::SwBreakDlg(weld::Window *pParent, SwWrtShell &rS) ::InsertStringSorted(u""_ustr, aFormatName, *m_xPageCollBox, 1); CheckEnable(); m_xPageNumEdit->set_text(OUString()); + UpdateImage(); } void SwBreakDlg::CheckEnable() @@ -210,4 +220,32 @@ void SwBreakDlg::CheckEnable() m_xPageNumEdit->set_sensitive(bEnable); } +void SwBreakDlg::UpdateImage() +{ + if (m_xLineBtn->get_active()) + { + switch (m_xLineClearBox->get_active()) + { + case 0: + m_xTypeImage->set_from_icon_name(RID_BMP_LINEBREAK_NONE); + break; + case 1: + m_xTypeImage->set_from_icon_name(RID_BMP_LINEBREAK_LEFT); + break; + case 2: + m_xTypeImage->set_from_icon_name(RID_BMP_LINEBREAK_RIGHT); + break; + case 3: + m_xTypeImage->set_from_icon_name(RID_BMP_LINEBREAK_FULL); + break; + } + } + else if (m_xColumnBtn->get_active()) + m_xTypeImage->set_from_icon_name(RID_BMP_COLBREAK); + else if (m_xPageBtn->get_active()) + m_xTypeImage->set_from_icon_name(RID_BMP_PAGEBREAK); + else + m_xTypeImage->set_from_icon_name(""); //clear +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx index b07890d4b337..d877eb538b1a 100644 --- a/sw/source/ui/dbui/mmdocselectpage.cxx +++ b/sw/source/ui/dbui/mmdocselectpage.cxx @@ -140,7 +140,7 @@ IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, weld::Button&, rButton, void) std::shared_ptr pFlt = aIter.First(); while( pFlt ) { - if( pFlt && pFlt->IsAllowedAsTemplate() ) + if( pFlt->IsAllowedAsTemplate() ) { const OUString sWild = pFlt->GetWildcard().getGlob(); xFP->appendFilter( pFlt->GetUIName(), sWild ); diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 32bc1f8d4cae..74d650ccf341 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -379,6 +379,12 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) if (pOpt) { *pOpt = *pAddPrinterAttr; + SwPagePreview* pPagePreview = dynamic_cast( SfxViewShell::Current()); + if( pPagePreview !=nullptr ) + { + pPagePreview->GetViewShell()->getIDocumentDeviceAccess().setPrintData(*pOpt); + pPagePreview->PrintSettingsChanged(); + } } } diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index a6f5bf0728bd..0beb039d01d0 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -567,7 +567,7 @@ void SwDocShell::Execute(SfxRequest& rReq) while( pFlt ) { // --> OD #i117339# - if( pFlt && pFlt->IsAllowedAsTemplate() && + if( pFlt->IsAllowedAsTemplate() && ( pFlt->GetUserData() == "CXML" || pFlt->GetUserData() == "CXMLV" ) ) { diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index d6be439d4259..e81ccb9aff8d 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -85,6 +85,10 @@ #include #include #include +#include +#include +#include +#include using namespace ::com::sun::star; @@ -1170,6 +1174,71 @@ void SwDocShell::Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidde } } +#define MAX_CHAR_IN_INLINE_HEADING 75 +bool SwDocShell::MakeInlineHeading(SwWrtShell *pSh, SwTextFormatColl* pColl, const sal_uInt16 nMode) +{ + // insert an inline heading frame, if only MAX_CHAR_IN_INLINE_HEADING or less + // characters are selected beginning of a single paragraph, but not the full paragraph + // TODO extend it for multiple selections + if ( pSh->IsSelOnePara() && !pSh->IsSelFullPara() && pSh->IsSelStartPara() && + GetView()->GetSelectionText().getLength() < MAX_CHAR_IN_INLINE_HEADING && + 0 < GetView()->GetSelectionText().getLength() ) + { + SwTextFormatColl *pLocal = pColl? pColl: (*GetDoc()->GetTextFormatColls())[0]; + + // put inside a single Undo + SwRewriter aRewriter; + aRewriter.AddRule(UndoArg1, pLocal->GetName()); + GetWrtShell()->StartUndo(SwUndoId::SETFMTCOLL, &aRewriter); + + // anchor as character + SfxUInt16Item aAnchor(FN_INSERT_FRAME, static_cast(1)); + SvxSizeItem aSizeItem(FN_PARAM_2, Size(1, 1)); + GetView()->GetViewFrame().GetDispatcher()->ExecuteList(FN_INSERT_FRAME, + SfxCallMode::SYNCHRON|SfxCallMode::RECORD, { &aAnchor, &aSizeItem }); + if ( pSh->IsFrameSelected() ) + { + // use the borderless frame style "Formula" + // TODO add a new frame style "Inline Heading" + SwDocStyleSheet* pStyle2 = static_cast( + m_xBasePool->Find( "Formula", SfxStyleFamily::Frame)); + pSh->SetFrameFormat( pStyle2->GetFrameFormat() ); + + // set variable width frame to extend for the width of the text content + SfxItemSetFixed aSet(pSh->GetAttrPool()); + pSh->GetFlyFrameAttr( aSet ); + SwTwips nMinWidth = 100; + SwFormatFrameSize aSize(SwFrameSize::Variable, nMinWidth, nMinWidth); + aSize.SetWidthSizeType(SwFrameSize::Variable); + aSet.Put(aSize); + pSh->SetFlyFrameAttr( aSet ); + + // select the text content of the frame, and apply the paragraph style + pSh->UnSelectFrame(); + pSh->LeaveSelFrameMode(); + pSh->MoveSection( GoCurrSection, fnSectionEnd ); + pSh->SelAll(); + + pSh->SetTextFormatColl( pColl, true, (nMode & KEY_MOD1) ? SetAttrMode::REMOVE_ALL_ATTR : SetAttrMode::DEFAULT); + + // zero the upper and lower margins of the paragraph (also an interoperability issue) + SfxItemSetFixed aSet2(pSh->GetAttrPool()); + pSh->GetCurAttr( aSet2 ); + SvxULSpaceItem aUL( 0, 0, RES_UL_SPACE ); + pSh->SetAttrItem( aUL ); + + // leave the inline heading frame + GetView()->GetViewFrame().GetDispatcher()->Execute(FN_ESCAPE, SfxCallMode::ASYNCHRON); + GetView()->GetViewFrame().GetDispatcher()->Execute(FN_ESCAPE, SfxCallMode::ASYNCHRON); + GetView()->GetViewFrame().GetDispatcher()->Execute(FN_ESCAPE, SfxCallMode::SYNCHRON); + + GetWrtShell()->EndUndo(); + return true; + } + } + return false; +} + // apply template SfxStyleFamily SwDocShell::ApplyStyles(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell, const sal_uInt16 nMode ) @@ -1211,10 +1280,17 @@ SfxStyleFamily SwDocShell::ApplyStyles(const OUString &rName, SfxStyleFamily nFa // outline node become folded content of the previous outline node if the previous // outline node's content is folded. MakeAllOutlineContentTemporarilyVisible a(GetDoc()); + + // if the first 75 or less characters are selected, but not the full paragraph, + // create an inline heading from the selected text + SwTextFormatColl* pColl = pStyle->GetCollection(); + if ( MakeInlineHeading( pSh, pColl, nMode ) ) + break; + // #i62675# // clear also list attributes at affected text nodes, if paragraph // style has the list style attribute set. - pSh->SetTextFormatColl( pStyle->GetCollection(), true, (nMode & KEY_MOD1) ? SetAttrMode::REMOVE_ALL_ATTR : SetAttrMode::DEFAULT); + pSh->SetTextFormatColl( pColl, true, (nMode & KEY_MOD1) ? SetAttrMode::REMOVE_ALL_ATTR : SetAttrMode::DEFAULT); } break; } diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index ea256a2668e3..6aae548adb29 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -129,9 +129,10 @@ public: using SfxStyleSheetPool::Create; rtl::Reference Create(const OUString& rName, SfxStyleFamily eFamily, - SfxStyleSearchBits nMask) override + SfxStyleSearchBits nMask, + const OUString& rParentStyleSheetName) override { - return new EEStyleSheet(rName, *this, eFamily, nMask); + return new EEStyleSheet(rName, *this, eFamily, nMask, rParentStyleSheetName); } void Notify(SfxBroadcaster&, const SfxHint& rHint) override @@ -573,7 +574,7 @@ void SwStyleSheetIterator::SwPoolFormatList::Append( SfxStyleFamily eFam, const SwDocStyleSheet::SwDocStyleSheet( SwDoc& rDocument, SwDocStyleSheetPool& rPool) : - SfxStyleSheetBase( OUString(), &rPool, SfxStyleFamily::Char, SfxStyleSearchBits::Auto ), + SfxStyleSheetBase( OUString(), &rPool, SfxStyleFamily::Char, SfxStyleSearchBits::Auto, u""_ustr ), m_pCharFormat(nullptr), m_pColl(nullptr), m_pFrameFormat(nullptr), @@ -2631,7 +2632,8 @@ SwDocStyleSheetPool::~SwDocStyleSheetPool() SfxStyleSheetBase& SwDocStyleSheetPool::Make( const OUString& rName, SfxStyleFamily eFam, - SfxStyleSearchBits _nMask) + SfxStyleSearchBits _nMask, + const OUString& rParentStyleSheetName) { mxStyleSheet->PresetName(rName); mxStyleSheet->PresetParent(OUString()); @@ -2639,6 +2641,7 @@ SfxStyleSheetBase& SwDocStyleSheetPool::Make( const OUString& rName, mxStyleSheet->SetMask(_nMask) ; mxStyleSheet->SetFamily(eFam); mxStyleSheet->SetPhysical(true); + mxStyleSheet->SetParent(rParentStyleSheetName); mxStyleSheet->Create(); return *mxStyleSheet; @@ -2651,7 +2654,7 @@ rtl::Reference SwDocStyleSheetPool::Create( const SfxStyleShe } rtl::Reference SwDocStyleSheetPool::Create( const OUString &, - SfxStyleFamily, SfxStyleSearchBits ) + SfxStyleFamily, SfxStyleSearchBits, const OUString& ) { OSL_ENSURE( false, "Create in SW-Stylesheet-Pool not possible" ); return nullptr; diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index 6681f3a7a15a..fb7baca39a12 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -128,7 +128,7 @@ uno::Reference< mail::XSmtpService > ConnectToSmtpServer( rConfigItem.GetInServerPort(), u"Insecure"_ustr); xInMailService->connect(xConnectionContext, xAuthenticator); - rxInMailService = xInMailService; + rxInMailService = std::move(xInMailService); } uno::Reference< mail::XAuthenticator> xAuthenticator; if(rConfigItem.IsAuthentication() && diff --git a/sw/source/uibase/inc/break.hxx b/sw/source/uibase/inc/break.hxx index 260229302ed2..62beafb18422 100644 --- a/sw/source/uibase/inc/break.hxx +++ b/sw/source/uibase/inc/break.hxx @@ -37,6 +37,7 @@ class SwBreakDlg final : public weld::GenericDialogController std::unique_ptr m_xPageNumBox; std::unique_ptr m_xPageNumEdit; std::unique_ptr m_xOkBtn; + std::unique_ptr m_xTypeImage; SwWrtShell& m_rSh; OUString m_aTemplate; @@ -48,11 +49,13 @@ class SwBreakDlg final : public weld::GenericDialogController DECL_LINK(ToggleHdl, weld::Toggleable&, void); DECL_LINK(ChangeHdl, weld::ComboBox&, void); + DECL_LINK(LineClearHdl, weld::ComboBox&, void); DECL_LINK(PageNumHdl, weld::Toggleable&, void); DECL_LINK(PageNumModifyHdl, weld::SpinButton&, void); DECL_LINK(OkHdl, weld::Button&, void); void CheckEnable(); + void UpdateImage(); void rememberResult(); public: diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx index e14ff5d419e7..b024f9e59fe5 100644 --- a/sw/source/uibase/inc/pview.hxx +++ b/sw/source/uibase/inc/pview.hxx @@ -152,6 +152,8 @@ public: bool SetBookPreviewMode( const bool _bBookPreview ); virtual css::uno::Reference CreateAccessible() override; + + void ReInit(); }; /** @@ -289,6 +291,8 @@ public: */ void SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos ); + void PrintSettingsChanged(); + SwPagePreview(SfxViewFrame& rFrame, SfxViewShell*); virtual ~SwPagePreview() override; }; diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 8b5e0e56645d..0480aeaf2b20 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -210,9 +210,7 @@ static void sw_CharDialog(SwWrtShell& rWrtSh, bool bUseDialog, bool bApplyToPara SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); pDlg.reset(pFact->CreateSwCharDlg(rWrtSh.GetView().GetFrameWeld(), rWrtSh.GetView(), *pCoreSet, SwCharDlgMode::Std)); - if (nSlot == FN_INSERT_HYPERLINK) - pDlg->SetCurPageId(u"hyperlink"_ustr); - else if (nSlot == SID_CHAR_DLG_EFFECT) + if (nSlot == SID_CHAR_DLG_EFFECT) pDlg->SetCurPageId(u"fonteffects"_ustr); else if (nSlot == SID_CHAR_DLG_POSITION) pDlg->SetCurPageId(u"position"_ustr); @@ -1600,7 +1598,6 @@ void SwTextShell::Execute(SfxRequest &rReq) case SID_ATTR_CHAR_SCALEWIDTH : case SID_ATTR_CHAR_ROTATED : case FN_TXTATR_INET : - case FN_INSERT_HYPERLINK: { const sal_uInt16 nWhich = GetPool().GetWhichIDFromSlotID( nSlot ); if ( pArgs && pArgs->GetItemState( nWhich ) == SfxItemState::SET ) @@ -3329,7 +3326,6 @@ void SwTextShell::GetState( SfxItemSet &rSet ) } break; - case FN_INSERT_HYPERLINK: case SID_INSERTDOC: case FN_INSERT_GLOSSARY: case FN_EXPAND_GLOSSARY: diff --git a/sw/source/uibase/sidebar/CommentsPanel.cxx b/sw/source/uibase/sidebar/CommentsPanel.cxx index 33f656409caf..edad2a8d5c17 100644 --- a/sw/source/uibase/sidebar/CommentsPanel.cxx +++ b/sw/source/uibase/sidebar/CommentsPanel.cxx @@ -416,7 +416,7 @@ void CommentsPanel::populateComments() continue; sal_uInt32 nRootId = getPostItId(pRootNote); - if (mpThreadsMap.find(nRootId) != mpThreadsMap.end()) + if (mpThreadsMap.contains(nRootId)) { if (mxSortbyPosition->get_active()) continue; @@ -491,7 +491,7 @@ void CommentsPanel::addComment(const SwFormatField* pField) sw::annotation::SwAnnotationWin* pNote = mpPostItMgr->GetAnnotationWin(static_cast(pField->GetField())); // If comment is added to an existing thread - if (mpThreadsMap.find(nRootId) != mpThreadsMap.end()) + if (mpThreadsMap.contains(nRootId)) { auto& pThread = mpThreadsMap[nRootId]; auto pComment = std::make_unique(pThread->getCommentBoxWidget(), *this); @@ -561,7 +561,7 @@ void CommentsPanel::deleteComment(sal_uInt32 nId) if (--pThread->mnComments == 0) { mxThreadsContainer->move(pThread->get_widget(), nullptr); - if (mpThreadsMap.find(nRootId) != mpThreadsMap.end()) + if (mpThreadsMap.contains(nRootId)) mpThreadsMap.erase(nRootId); mnThreads--; } diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 25694534a179..79d965c4061a 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -579,6 +579,10 @@ void SwPagePreviewWin::DataChanged( const DataChangedEvent& rDCEvt ) } } +void SwPagePreviewWin::ReInit() +{ + mpPgPreviewLayout->ReInit(); +} /** help method to execute SfxRequest FN_PAGEUP and FN_PAGEDOWN */ void SwPagePreview::ExecPgUpAndPgDown( const bool _bPgUp, SfxRequest* _pReq ) @@ -1390,6 +1394,12 @@ void SwPagePreview::SetVisArea( const tools::Rectangle &rRect ) m_pViewWin->Invalidate(); } +void SwPagePreview::PrintSettingsChanged() +{ + m_pViewWin->ReInit(); + ChgPage( SwPagePreviewWin::MV_DOC_STT ); +} + IMPL_LINK(SwPagePreview, HoriScrollHdl, weld::Scrollbar&, rScrollbar, void) { ScrollHdl(rScrollbar, true); @@ -1779,25 +1789,21 @@ bool SwPagePreview::HandleWheelCommands( const CommandEvent& rCEvt ) const CommandWheelData* pWData = rCEvt.GetWheelData(); if( pWData && CommandWheelMode::ZOOM == pWData->GetMode() ) { - //only the Preference shouldn't control the Zoom, it is better to detect AT tools running. So the bridge can be used here - if (!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport()) + sal_uInt16 nFactor = GetViewShell()->GetViewOptions()->GetZoom(); + const sal_uInt16 nOffset = 10; + if( 0L > pWData->GetDelta() ) { - sal_uInt16 nFactor = GetViewShell()->GetViewOptions()->GetZoom(); - const sal_uInt16 nOffset = 10; - if( 0L > pWData->GetDelta() ) - { - nFactor -= nOffset; - if(nFactor < MIN_PREVIEW_ZOOM) - nFactor = MIN_PREVIEW_ZOOM; - } - else - { - nFactor += nOffset; - if(nFactor > MAX_PREVIEW_ZOOM) - nFactor = MAX_PREVIEW_ZOOM; - } - SetZoom(SvxZoomType::PERCENT, nFactor); + nFactor -= nOffset; + if(nFactor < MIN_PREVIEW_ZOOM) + nFactor = MIN_PREVIEW_ZOOM; } + else + { + nFactor += nOffset; + if(nFactor > MAX_PREVIEW_ZOOM) + nFactor = MAX_PREVIEW_ZOOM; + } + SetZoom(SvxZoomType::PERCENT, nFactor); bOk = true; } else diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index da7bd54a863c..1089d1cc4f10 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -764,7 +764,7 @@ bool SwView::ExecSpellPopup(const Point& rPt) { // Execute dispatch asynchronously ExecuteInfo* pExecuteInfo = new ExecuteInfo; - pExecuteInfo->xDispatch = xDispatch; + pExecuteInfo->xDispatch = std::move(xDispatch); pExecuteInfo->aTargetURL = std::move(aURL); Application::PostUserEvent( LINK(nullptr, AsyncExecute , ExecuteHdl_Impl), pExecuteInfo ); } diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index 86d983b27ae1..1ad9fb07f27a 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -161,7 +161,7 @@ static bool LoadFromURL_impl( if (bClose) CloseModelAndDocSh( rxModel, rxDocSh ); // set new stuff - rxModel = xTmpModel; + rxModel = std::move(xTmpModel); rxDocSh = pTmpDocShell; bRes = true; } diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 828c295d77a0..59927e931a4c 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -6089,7 +6089,7 @@ void SwContentTree::EditEntry(const weld::TreeIter& rEntry, EditEntryMode nMode) Reference< XIndexAccess> xIdxAcc(xModel->getDocumentIndexes()); Reference< XNameAccess >xLocalNameAccess(xIdxAcc, UNO_QUERY); if(EditEntryMode::RENAME == nMode) - xNameAccess = xLocalNameAccess; + xNameAccess = std::move(xLocalNameAccess); else if(xLocalNameAccess.is() && xLocalNameAccess->hasByName(pBase->GetTOXName())) { Any aIdx = xLocalNameAccess->getByName(pBase->GetTOXName()); diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx b/sw/source/writerfilter/dmapper/DomainMapper.cxx index 5d4a0c3b5c14..8fee3500a043 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx @@ -1488,6 +1488,49 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) } return; } + case NS_ooxml::LN_tblStart: + { + if (rContext) + { + /* + * Hack for Importing Section Properties + * LO is not able to import section properties if first element in the + * section is a table. So in case first element is a table add a dummy para + * and remove it again when lcl_endSectionGroup is called + */ + if (m_pImpl->m_StreamStateStack.top().nTableDepth == 0 + && m_pImpl->GetIsFirstParagraphInSection() + && !m_pImpl->GetIsDummyParaAddedForTableInSection() && !m_pImpl->GetIsTextFrameInserted() + && !m_pImpl->GetIsPreviousParagraphFramed() && !IsInHeaderFooter()) + { + m_pImpl->AddDummyParaForTableInSection(); + } + + // if first paragraph style in table has break-before-page, transfer that setting to the table itself. + if (m_pImpl->m_StreamStateStack.top().nTableDepth == 0) + { + const uno::Any aBreakType(style::BreakType_PAGE_BEFORE); + const PropertyMapPtr pParagraphProps = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH); + if( pParagraphProps && pParagraphProps->isSet(PROP_PARA_STYLE_NAME) ) + { + StyleSheetEntryPtr pStyle; + OUString sStyleName; + pParagraphProps->getProperty(PROP_PARA_STYLE_NAME)->second >>= sStyleName; + if( !sStyleName.isEmpty() && GetStyleSheetTable() ) + pStyle = GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( sStyleName ); + + if( pStyle && pStyle->m_pProperties + && pStyle->m_pProperties->isSet(PROP_BREAK_TYPE) + && pStyle->m_pProperties->getProperty(PROP_BREAK_TYPE)->second == aBreakType ) + { + pParagraphProps->Insert(PROP_BREAK_TYPE, aBreakType); + } + } + } + } + m_pImpl->m_StreamStateStack.top().nTableDepth++; + return; + } default: break; } @@ -2097,7 +2140,11 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) break; case NS_ooxml::LN_EG_RPrBase_specVanish: if ( nIntValue && !IsStyleSheetImport() ) + { + // put inline heading inside a text frame to get the same layout with ToC/PDF bookmark support m_pImpl->m_StreamStateStack.top().bIsInlineParagraph = true; + m_pImpl->GetTopContext()->Insert( PROP_INLINE_HEADING, uno::Any( true ), false, PARA_GRAB_BAG ); + } break; case NS_ooxml::LN_EG_RPrBase_sz: case NS_ooxml::LN_EG_RPrBase_szCs: @@ -3390,47 +3437,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) } } break; - case NS_ooxml::LN_tblStart: - { - /* - * Hack for Importing Section Properties - * LO is not able to import section properties if first element in the - * section is a table. So in case first element is a table add a dummy para - * and remove it again when lcl_endSectionGroup is called - */ - if (m_pImpl->m_StreamStateStack.top().nTableDepth == 0 - && m_pImpl->GetIsFirstParagraphInSection() - && !m_pImpl->GetIsDummyParaAddedForTableInSection() && !m_pImpl->GetIsTextFrameInserted() - && !m_pImpl->GetIsPreviousParagraphFramed() && !IsInHeaderFooter()) - { - m_pImpl->AddDummyParaForTableInSection(); - } - - // if first paragraph style in table has break-before-page, transfer that setting to the table itself. - if (m_pImpl->m_StreamStateStack.top().nTableDepth == 0) - { - const uno::Any aBreakType(style::BreakType_PAGE_BEFORE); - const PropertyMapPtr pParagraphProps = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH); - if( pParagraphProps && pParagraphProps->isSet(PROP_PARA_STYLE_NAME) ) - { - StyleSheetEntryPtr pStyle; - OUString sStyleName; - pParagraphProps->getProperty(PROP_PARA_STYLE_NAME)->second >>= sStyleName; - if( !sStyleName.isEmpty() && GetStyleSheetTable() ) - pStyle = GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( sStyleName ); - - if( pStyle && pStyle->m_pProperties - && pStyle->m_pProperties->isSet(PROP_BREAK_TYPE) - && pStyle->m_pProperties->getProperty(PROP_BREAK_TYPE)->second == aBreakType ) - { - pParagraphProps->Insert(PROP_BREAK_TYPE, aBreakType); - } - } - } - - m_pImpl->m_StreamStateStack.top().nTableDepth++; - } - break; case NS_ooxml::LN_tblEnd: m_pImpl->m_StreamStateStack.top().nTableDepth--; break; diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx index 75e758c40523..14e1149356bf 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -218,6 +218,13 @@ static void lcl_handleTextField( const uno::Reference< beans::XPropertySet >& rx } } +static StyleSheetEntryPtr lcl_getParent(StyleSheetEntryPtr pEntry, StyleSheetTablePtr pStyleSheet) +{ + if (!pEntry->m_sBaseStyleIdentifier.isEmpty()) + return pStyleSheet->FindStyleSheetByISTD(pEntry->m_sBaseStyleIdentifier); + return nullptr; +} + /** Very similar to DomainMapper_Impl::GetPropertyFromStyleSheet It is focused on paragraph properties search in current & parent stylesheet entries. @@ -242,10 +249,7 @@ static uno::Any lcl_GetPropertyFromParaStyleSheetNoNum(PropertyIds eId, StyleShe } } //search until the property is set or no parent is available - StyleSheetEntryPtr pNewEntry; - if (!pEntry->m_sBaseStyleIdentifier.isEmpty()) - pNewEntry = rStyleSheet->FindStyleSheetByISTD(pEntry->m_sBaseStyleIdentifier); - + StyleSheetEntryPtr pNewEntry = lcl_getParent(pEntry, rStyleSheet); SAL_WARN_IF(pEntry == pNewEntry, "writerfilter.dmapper", "circular loop in style hierarchy?"); if (pEntry == pNewEntry) //fdo#49587 @@ -1496,9 +1500,7 @@ uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId, const Sty } } //search until the property is set or no parent is available - StyleSheetEntryPtr pNewEntry; - if ( !pEntry->m_sBaseStyleIdentifier.isEmpty() ) - pNewEntry = GetStyleSheetTable()->FindStyleSheetByISTD(pEntry->m_sBaseStyleIdentifier); + StyleSheetEntryPtr pNewEntry = lcl_getParent(pEntry, GetStyleSheetTable()); SAL_WARN_IF( pEntry == pNewEntry, "writerfilter.dmapper", "circular loop in style hierarchy?"); @@ -1833,9 +1835,7 @@ DomainMapper_Impl::MakeFrameProperties(const ParagraphProperties& rProps) { vProps.emplace_back(&pStyle->m_pProperties->props()); assert(pStyle->m_sBaseStyleIdentifier != pStyle->m_sStyleName); - if (pStyle->m_sBaseStyleIdentifier.isEmpty()) - break; - pStyle = GetStyleSheetTable()->FindStyleSheetByISTD(pStyle->m_sBaseStyleIdentifier); + pStyle = lcl_getParent(pStyle, GetStyleSheetTable()); } SAL_WARN_IF(!nSafetyLimit, "writerfilter.dmapper", "Inheritance loop likely: early exit"); @@ -2091,11 +2091,7 @@ static sal_Int32 lcl_getListId(const StyleSheetEntryPtr& rEntry, const StyleShee if (nListId >= 0) return nListId; - // The style has no parent. - if (rEntry->m_sBaseStyleIdentifier.isEmpty()) - return -1; - - const StyleSheetEntryPtr pParent = rStyleTable->FindStyleSheetByISTD(rEntry->m_sBaseStyleIdentifier); + const StyleSheetEntryPtr pParent = lcl_getParent(rEntry, rStyleTable); // No such parent style or loop in the style hierarchy. if (!pParent || pParent == rEntry) return -1; @@ -2136,11 +2132,7 @@ sal_Int16 DomainMapper_Impl::GetListLevel(const StyleSheetEntryPtr& pEntry, if (nListLevel >= 0) return nListLevel; - // The style has no parent. - if (pEntry->m_sBaseStyleIdentifier.isEmpty()) - return -1; - - const StyleSheetEntryPtr pParent = GetStyleSheetTable()->FindStyleSheetByISTD(pEntry->m_sBaseStyleIdentifier); + const StyleSheetEntryPtr pParent = lcl_getParent(pEntry, GetStyleSheetTable()); // No such parent style or loop in the style hierarchy. if (!pParent || pParent == pEntry) return -1; @@ -2232,13 +2224,12 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con const StyleSheetEntryPtr pEntry = GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( GetCurrentParaStyleName() ); SAL_WARN_IF(!pEntry, "writerfilter.dmapper", "no style sheet found"); - const StyleSheetPropertyMap* pStyleSheetProperties = pEntry ? pEntry->m_pProperties.get() : nullptr; sal_Int32 nListId = pParaContext ? pParaContext->props().GetListId() : -1; bool isNumberingViaStyle(false); bool isNumberingViaRule = nListId > -1; - if ( !bRemove && pStyleSheetProperties && pParaContext ) + if (!bRemove && pEntry && pEntry->m_pProperties && pParaContext) { - if (!pEntry || pEntry->m_nStyleTypeCode != StyleType::STYLE_TYPE_PARA) { + if (pEntry->m_nStyleTypeCode != StyleType::STYLE_TYPE_PARA) { // We could not resolve paragraph style or it is not a paragraph style // Remove this style reference, otherwise it will cause exceptions during further // processing and not all paragraph styles will be initialized. @@ -2294,25 +2285,22 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con // But since import has just copied para-style's PROP_NUMBERING_STYLE_NAME directly onto the paragraph, // the numbering indents now have the priority. // So now import must also copy the para-style indents directly onto the paragraph to compensate. - std::optional oProperty; - const StyleSheetEntryPtr pParent = (!pEntry->m_sBaseStyleIdentifier.isEmpty()) ? GetStyleSheetTable()->FindStyleSheetByISTD(pEntry->m_sBaseStyleIdentifier) : nullptr; - const StyleSheetPropertyMap* pParentProperties = pParent ? pParent->m_pProperties.get() : nullptr; - if (!pEntry->m_sBaseStyleIdentifier.isEmpty()) + auto getOptProperty + = [&pEntry, parent = lcl_getParent(pEntry, GetStyleSheetTable())](PropertyIds id, bool useParent) { - oProperty = pStyleSheetProperties->getProperty(PROP_PARA_FIRST_LINE_INDENT); - if ( oProperty - // If the numbering comes from a base style, indent of the base style has also priority. - || (bNumberingFromBaseStyle && pParentProperties && (oProperty = pParentProperties->getProperty(PROP_PARA_FIRST_LINE_INDENT))) ) - pParaContext->Insert(PROP_PARA_FIRST_LINE_INDENT, oProperty->second, /*bOverwrite=*/false); - } - oProperty = pStyleSheetProperties->getProperty(PROP_PARA_LEFT_MARGIN); - if ( oProperty - || (bNumberingFromBaseStyle && pParentProperties && (oProperty = pParentProperties->getProperty(PROP_PARA_LEFT_MARGIN))) ) + auto p = pEntry->m_pProperties->getProperty(id); + if (!p && useParent && parent && parent->m_pProperties) + p = parent->m_pProperties->getProperty(id); + return p; + }; + if (auto oProperty = getOptProperty(PROP_PARA_FIRST_LINE_INDENT, bNumberingFromBaseStyle)) + pParaContext->Insert(PROP_PARA_FIRST_LINE_INDENT, oProperty->second, /*bOverwrite=*/false); + if (auto oProperty = getOptProperty(PROP_PARA_LEFT_MARGIN, bNumberingFromBaseStyle)) pParaContext->Insert(PROP_PARA_LEFT_MARGIN, oProperty->second, /*bOverwrite=*/false); // We're inheriting properties from a numbering style. Make sure a possible right margin is inherited from the base style. - sal_Int32 nParaRightMargin; - if ( pParentProperties && (oProperty = pParentProperties->getProperty(PROP_PARA_RIGHT_MARGIN)) && (nParaRightMargin = oProperty->second.get()) != 0 ) + if (auto oProperty = getOptProperty(PROP_PARA_RIGHT_MARGIN, true); + oProperty && oProperty->second.get() != 0) { // If we're setting the right margin, we should set the first / left margin as well from the numbering style. const sal_Int32 nFirstLineIndent = getNumberingProperty(nListId, nListLevel, u"FirstLineIndent"_ustr); @@ -2322,11 +2310,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con if (nParaLeftMargin != 0) pParaContext->Insert(PROP_PARA_LEFT_MARGIN, uno::Any(nParaLeftMargin), /*bOverwrite=*/false); - // Override right margin value with value from current style, if any - if (pStyleSheetProperties && pStyleSheetProperties->isSet(PROP_PARA_RIGHT_MARGIN)) - nParaRightMargin = pStyleSheetProperties->getProperty(PROP_PARA_RIGHT_MARGIN)->second.get(); - - pParaContext->Insert(PROP_PARA_RIGHT_MARGIN, uno::Any(nParaRightMargin), /*bOverwrite=*/false); + pParaContext->Insert(PROP_PARA_RIGHT_MARGIN, oProperty->second, /*bOverwrite=*/false); } } // Paragraph style based right paragraph indentation affects not paragraph style based lists in DOCX. @@ -2789,6 +2773,9 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con xRangeStart = xParaCursor->getStart(); xRangeEnd = xParaCursor->getEnd(); + comphelper::SequenceAsHashMap aFrameGrabBag; + aFrameGrabBag[u"FrameInlineHeading"_ustr] <<= true; + // TODO anchor as character std::vector aFrameProperties { @@ -2798,7 +2785,9 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT), text::HoriOrientation::LEFT), comphelper::makePropertyValue(getPropertyName(PROP_OPAQUE), false), comphelper::makePropertyValue(getPropertyName(PROP_WIDTH_TYPE), text::SizeType::MIN), - comphelper::makePropertyValue(getPropertyName(PROP_SIZE_TYPE), text::SizeType::MIN) + comphelper::makePropertyValue(getPropertyName(PROP_SIZE_TYPE), text::SizeType::MIN), + comphelper::makePropertyValue(u"FrameInteropGrabBag"_ustr, + aFrameGrabBag.getAsConstPropertyValueList()) }; fillEmptyFrameProperties(aFrameProperties, false); @@ -9401,11 +9390,11 @@ void DomainMapper_Impl::AddAnnotationPosition( AnnotationPosition& aAnnotationPosition = m_aAnnotationPositions[ nAnnotationId ]; if (bStart) { - aAnnotationPosition.m_xStart = xCurrent; + aAnnotationPosition.m_xStart = std::move(xCurrent); } else { - aAnnotationPosition.m_xEnd = xCurrent; + aAnnotationPosition.m_xEnd = std::move(xCurrent); } m_aAnnotationPositions[ nAnnotationId ] = aAnnotationPosition; } @@ -9541,7 +9530,7 @@ void DomainMapper_Impl::ImportGraphic(const writerfilter::Reference { // Remember this object is anchored to the current paragraph. AnchoredObjectInfo aInfo; - aInfo.m_xAnchoredObject = xTextContent; + aInfo.m_xAnchoredObject = std::move(xTextContent); if (m_pGraphicImport) { // We still have the graphic import around, remember the original margin, so later @@ -9560,7 +9549,7 @@ void DomainMapper_Impl::ImportGraphic(const writerfilter::Reference { // Remember this object is anchored to the current paragraph. AnchoredObjectInfo aInfo; - aInfo.m_xAnchoredObject = xTextContent; + aInfo.m_xAnchoredObject = std::move(xTextContent); aInfo.m_xRedlineForInline = m_aRedlines.top().back(); m_aTextAppendStack.top().m_aAnchoredObjects.push_back(aInfo); } diff --git a/sw/source/writerfilter/dmapper/PropertyIds.cxx b/sw/source/writerfilter/dmapper/PropertyIds.cxx index 0126632b4c0d..75de7b841df8 100644 --- a/sw/source/writerfilter/dmapper/PropertyIds.cxx +++ b/sw/source/writerfilter/dmapper/PropertyIds.cxx @@ -396,6 +396,7 @@ OUString getPropertyName( PropertyIds eId ) { PROP_DECORATIVE, u"Decorative"_ustr}, { PROP_PAPER_TRAY, u"PrinterPaperTray"_ustr}, { PROP_CHAR_FONT_FAMILY, u"CharFontFamily"_ustr}, + { PROP_INLINE_HEADING, u"ParaInlineHeading"_ustr}, }; auto iterator = constPropertyMap.find(eId); if (iterator != constPropertyMap.end()) diff --git a/sw/source/writerfilter/dmapper/PropertyIds.hxx b/sw/source/writerfilter/dmapper/PropertyIds.hxx index 72f3ffb149ab..ebc9cdaeede2 100644 --- a/sw/source/writerfilter/dmapper/PropertyIds.hxx +++ b/sw/source/writerfilter/dmapper/PropertyIds.hxx @@ -398,6 +398,7 @@ enum PropertyIds ,PROP_CURSOR_NOT_IGNORE_TABLES_IN_HF ,PROP_PARA_CONNECT_BORDERS ,PROP_CHAR_FONT_FAMILY + ,PROP_INLINE_HEADING }; //Returns the UNO string equivalent to eId. diff --git a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx index 086230b0d941..9192f1055a89 100644 --- a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx +++ b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx @@ -211,19 +211,17 @@ void OOXMLDocumentImpl::importSubStreamRelations(const OOXMLStream::Pointer_t& p if(xRelation.is()) { - mxCustomXmlProsDom = xRelation; + mxCustomXmlProsDom = std::move(xRelation); } } else if(OOXMLStream::EMBEDDINGS == nType) { - mxEmbeddings = xcpInputStream; + mxEmbeddings = std::move(xcpInputStream); } else if(OOXMLStream::CHARTS == nType) { importSubStreamRelations(cStream, OOXMLStream::EMBEDDINGS); } - - } void OOXMLDocumentImpl::setXNoteId(const sal_Int32 nId) @@ -453,7 +451,7 @@ void OOXMLDocumentImpl::resolve(Stream & rStream) uno::Reference xDocumentPropertiesSupplier(mxModel, uno::UNO_QUERY); uno::Reference xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties(); comphelper::SequenceAsHashMap aMap(xDocumentProperties->getDocumentStatistics()); - if (aMap.find(u"ParagraphCount"_ustr) != aMap.end()) + if (aMap.contains(u"ParagraphCount"_ustr)) { sal_Int32 nValue; if (aMap[u"ParagraphCount"_ustr] >>= nValue) diff --git a/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx b/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx index a8532ac4fd6d..ce391551c719 100644 --- a/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx +++ b/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx @@ -1015,7 +1015,15 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference xPropertySet(xShape, uno::UNO_QUERY); if (xPropertySet.is()) - xPropertySet->setPropertyValue(u"Graphic"_ustr, uno::Any(xGraphic)); + // try..catch is for tdf#161359 + try + { + xPropertySet->setPropertyValue(u"Graphic"_ustr, uno::Any(xGraphic)); + } + catch (const css::uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION("sw"); + } // check if the picture is in an OLE object and if the \objdata element is used // (see RTFKeyword::OBJECT in RTFDocumentImpl::dispatchDestination) diff --git a/sw/source/writerfilter/rtftok/rtfsdrimport.cxx b/sw/source/writerfilter/rtftok/rtfsdrimport.cxx index 961cd5186640..09aabf47fd1c 100644 --- a/sw/source/writerfilter/rtftok/rtfsdrimport.cxx +++ b/sw/source/writerfilter/rtftok/rtfsdrimport.cxx @@ -1163,7 +1163,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap // the outer one. rShape.getProperties().clear(); - m_xShape = xShape; + m_xShape = std::move(xShape); } void RTFSdrImport::close() { m_rImport.Mapper().endShape(); } diff --git a/sw/uiconfig/swriter/ui/fldvarpage.ui b/sw/uiconfig/swriter/ui/fldvarpage.ui index d6bea58f3034..06394222e6cc 100644 --- a/sw/uiconfig/swriter/ui/fldvarpage.ui +++ b/sw/uiconfig/swriter/ui/fldvarpage.ui @@ -44,11 +44,10 @@ - + - 700 - 400 True + 700 False True True @@ -57,7 +56,7 @@ 12 True - + True False @@ -139,6 +138,7 @@ 1 1 2 + 2 @@ -191,17 +191,24 @@ 3 - 1 + 2 + + + + + + 0 1 3 + 3 diff --git a/sw/uiconfig/swriter/ui/insertbreak.ui b/sw/uiconfig/swriter/ui/insertbreak.ui index b52655b369f4..c180afd0d9e1 100644 --- a/sw/uiconfig/swriter/ui/insertbreak.ui +++ b/sw/uiconfig/swriter/ui/insertbreak.ui @@ -1,39 +1,39 @@ - + 55535 1 - 1 - 10 + 1 + 10 - False - 6 + False + 6 Insert Break False True - 0 - 0 - dialog + 0 + 0 + dialog - False + False vertical 12 - False - end + False + end _OK True - True - True - True - True + True + True + True + True True @@ -46,8 +46,8 @@ _Cancel True - True - True + True + True True @@ -60,8 +60,8 @@ _Help True - True - True + True + True True @@ -75,32 +75,34 @@ False True - end + end 0 True - False - 0 - none + False + 0 + none - + + True - False - vertical - 6 + False 12 6 + vertical + 6 + 12 Line break True - True - False - True - True + True + False + True + True pagerb @@ -109,54 +111,51 @@ - False - True - 0 + 0 + 0 True - False - 6 + False + 6 Restart Location: - True - clearlb + True + clearlb 0 - False - True - 1 + 0 + 1 True False - False + False 0 - [None] + Next Line Left Right Next Full Line - False - True - 2 + 0 + 2 Column break True - True - False - True - True + True + False + True + True pagerb @@ -165,20 +164,19 @@ - False - True - 3 + 0 + 3 Page break True - True - False - True + True + False + True True - True + True Inserts a manual page break, and moves the text found to the right of the cursor to the beginning of the next page. The inserted page break is indicated by a nonprinting border at the top of the new page. @@ -186,31 +184,30 @@ - False - True - 4 + 0 + 4 True - False - 6 + False + 6 Page Style: - True - stylelb + True + stylelb 0 - False - True - 5 + 0 + 5 + 2 True - False + False 0 [None] @@ -222,20 +219,20 @@ - False - True - 6 + 0 + 6 + 2 Change page number True - True - False - 6 - True - True + True + False + 6 + True + True Assigns the page number that you specify to the page that follows the manual page break. This option is only available if you assign a different page style to the page that follows manual page break. @@ -243,22 +240,22 @@ - False - True - 7 + 0 + 7 + 2 True - True + True start - True + True + True adjustment1 - True Enter the new page number for the page that follows the manual page break. @@ -266,9 +263,24 @@ - False - True - 8 + 0 + 8 + 2 + + + + + True + False + center + start + True + True + + + 1 + 0 + 5 @@ -276,7 +288,7 @@ True - False + False Type @@ -296,9 +308,6 @@ cancel help - - - Inserts a manual line break, column break or a page break at the current cursor position. diff --git a/sw/uiconfig/swriter/ui/renameobjectdialog.ui b/sw/uiconfig/swriter/ui/renameobjectdialog.ui index a623970a48c1..83ab85a3a7e6 100644 --- a/sw/uiconfig/swriter/ui/renameobjectdialog.ui +++ b/sw/uiconfig/swriter/ui/renameobjectdialog.ui @@ -1,32 +1,32 @@ - + - False - 6 + False + 6 Rename object: True - 0 - 0 - dialog + 0 + 0 + dialog - False + False vertical 12 - False - end + False + end _OK True - True - True - True - True + True + True + True + True True @@ -39,8 +39,8 @@ _Cancel True - True - True + True + True True @@ -53,8 +53,8 @@ _Help True - True - True + True + True True @@ -68,54 +68,54 @@ False True - end + end 0 True - False + False True True - 0 - none + 0 + none - + True - False - True - True - 6 - 12 + False 12 6 + True + True + 6 + 12 True - False + False New name: - True - entry + True + entry 0 - 0 - 0 + 0 + 0 True - True + True True + True True - True - 1 - 0 + 1 + 0 @@ -123,7 +123,7 @@ True - False + False Change Name @@ -144,8 +144,5 @@ cancel help - - - diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx index 316b92c92dbd..09b2f1e9d81d 100644 --- a/testtools/source/bridgetest/bridgetest.cxx +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -1245,7 +1245,7 @@ sal_Int32 TestBridgeImpl::run( const Sequence< OUString > & rArgs ) rArgs[0], m_xContext); } if (!stress) { - xOriginal = o; + xOriginal = std::move(o); break; } } diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index da5e165ab831..65b6f665d7cd 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -701,7 +701,7 @@ uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessi Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { - xChild = xAcc; + xChild = std::move(xAcc); break; } } diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx index db5f9c03b183..6739377238ed 100644 --- a/toolkit/source/controls/accessiblecontrolcontext.cxx +++ b/toolkit/source/controls/accessiblecontrolcontext.cxx @@ -221,7 +221,7 @@ namespace toolkit vcl::Window* pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : nullptr; if ( _pxUNOWindow ) - *_pxUNOWindow = xWindow; + *_pxUNOWindow = std::move(xWindow); return pWindow; } diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 862b78027ed7..110e56c88406 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -83,7 +83,7 @@ public: Reference< T > xElement; if ( ! ( aElement >>= xElement ) ) throw IllegalArgumentException(); - it->second = xElement; + it->second = std::move(xElement); } virtual Any SAL_CALL getByName( const OUString& aName ) override { @@ -112,7 +112,7 @@ public: Reference< T > xElement; if ( ! ( aElement >>= xElement ) ) throw IllegalArgumentException(); - things[ aName ] = xElement; + things[ aName ] = std::move(xElement); } virtual void SAL_CALL removeByName( const OUString& aName ) override { diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx index 4ca74107805b..d74a496ad1ec 100644 --- a/toolkit/source/controls/grid/sortablegriddatamodel.cxx +++ b/toolkit/source/controls/grid/sortablegriddatamodel.cxx @@ -312,8 +312,8 @@ void lcl_clear( STLCONTAINER& i_container ) if ( !xDelegator.is() ) throw IllegalArgumentException( OUString(), *this, 1 ); - m_delegator = xDelegator; - m_collator = xCollator; + m_delegator = std::move(xDelegator); + m_collator = std::move(xCollator); m_delegator->addGridDataListener( this ); diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk index e2f1a9fccbf6..b82c065bdeef 100644 --- a/tools/Library_tl.mk +++ b/tools/Library_tl.mk @@ -72,6 +72,7 @@ $(eval $(call gb_Library_add_exception_objects,tl,\ tools/source/misc/cpuid \ tools/source/misc/extendapplicationenvironment \ tools/source/misc/json_writer \ + tools/source/misc/lazydelete \ tools/source/misc/UniqueID \ tools/source/ref/globname \ tools/source/ref/ref \ diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 3a5c434ba303..34d761d11e66 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -2849,6 +2849,7 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p goto done; else if (rtl::isAsciiDigit(*p) && nDigits < 3) { + assert(nNumber < 999); nNumber = 10 * nNumber + INetMIME::getWeight(*p); ++nDigits; } diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx index cc5cce9c3b16..00b3aef2c2c7 100644 --- a/tools/source/generic/config.cxx +++ b/tools/source/generic/config.cxx @@ -252,6 +252,7 @@ static void ImplMakeConfigList( ImplConfigData* pData, // filter group names pLine++; + assert(nLineLen > 0); nLineLen--; // remove spaces and tabs while ( (*pLine == ' ') || (*pLine == '\t') ) diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx index 739d2874875a..37e12ff9ac5d 100644 --- a/tools/source/memtools/multisel.cxx +++ b/tools/source/memtools/multisel.cxx @@ -217,11 +217,8 @@ bool MultiSelection::Select( sal_Int32 nIndex, bool bSelect ) else { // split the sub selection - if ( nSubSelPos < aSels.size() ) { - aSels.insert( aSels.begin() + nSubSelPos, Range( aSels[ nSubSelPos ].Min(), nIndex-1 ) ); - } else { - aSels.push_back( Range( aSels[ nSubSelPos ].Min(), nIndex-1 ) ); - } + // we know nSubSelPos < aSels.size() since it's been tested some lines before + aSels.insert( aSels.begin() + nSubSelPos, Range( aSels[ nSubSelPos ].Min(), nIndex-1 ) ); aSels[ nSubSelPos+1 ].Min() = nIndex + 1; } } @@ -323,11 +320,7 @@ void MultiSelection::Insert( sal_Int32 nIndex, sal_Int32 nCount ) if ( aSels[ nSubSelPos ].Min() != nIndex && aSels[ nSubSelPos ].Contains(nIndex) ) { // split the sub selection - if ( nSubSelPos < aSels.size() ) { - aSels.insert( aSels.begin() + nSubSelPos, Range( aSels[ nSubSelPos ].Min(), nIndex-1 ) ); - } else { - aSels.push_back( Range( aSels[ nSubSelPos ].Min(), nIndex-1 ) ); - } + aSels.insert( aSels.begin() + nSubSelPos, Range( aSels[ nSubSelPos ].Min(), nIndex-1 ) ); ++nSubSelPos; aSels[ nSubSelPos ].Min() = nIndex; } diff --git a/tools/source/misc/fix16.cxx b/tools/source/misc/fix16.cxx index b726acb8f660..e465c16c5dc1 100644 --- a/tools/source/misc/fix16.cxx +++ b/tools/source/misc/fix16.cxx @@ -76,6 +76,8 @@ fix16_t fix16_mul(fix16_t inArg0, fix16_t inArg1) return result; } +static uint32_t mask(int bits) { return (1U << bits) - 1; } + /* 32-bit implementation of fix16_div. Fastest version for e.g. ARM Cortex M3. * Performs 32-bit divisions repeatedly to reduce the remainder. For this to * be efficient, the processor has to have 32-bit hardware division. @@ -111,13 +113,13 @@ fix16_t fix16_div(fix16_t a, fix16_t b) bit_pos -= 4; } - while (remainder && bit_pos >= 0) + while (remainder > 0 && bit_pos >= 0) { // Shift remainder as much as we can without overflowing int shift = std::countl_zero(remainder); if (shift > bit_pos) shift = bit_pos; - remainder <<= shift; + remainder = (remainder & mask(32 - shift)) << shift; bit_pos -= shift; uint32_t div = remainder / divider; diff --git a/vcl/source/helper/lazydelete.cxx b/tools/source/misc/lazydelete.cxx similarity index 64% rename from vcl/source/helper/lazydelete.cxx rename to tools/source/misc/lazydelete.cxx index af1f9fcb3308..1d441e432dce 100644 --- a/vcl/source/helper/lazydelete.cxx +++ b/tools/source/misc/lazydelete.cxx @@ -17,42 +17,38 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include -#include +#include #include +#include -namespace vcl +namespace tools { -DeleteOnDeinitBase::~DeleteOnDeinitBase() -{ - ImplSVData* pSVData = ImplGetSVData(); - if (!pSVData) - return; - auto& rList = pSVData->maDeinitDeleteList; - std::erase(rList, this); -} +static std::vector gDeinitDeleteList; +static bool gShutdown = false; + +DeleteOnDeinitBase::~DeleteOnDeinitBase() { std::erase(gDeinitDeleteList, this); } void DeleteOnDeinitBase::addDeinitContainer(DeleteOnDeinitBase* i_pContainer) { - ImplSVData* pSVData = ImplGetSVData(); - - SAL_WARN_IF(pSVData->mbDeInit, "vcl", "DeleteOnDeinit added after DeiInitVCL !"); - if (pSVData->mbDeInit) + if (gShutdown) + { + SAL_WARN("tools", "DeleteOnDeinit added after DeiInitVCL !"); return; + } - pSVData->maDeinitDeleteList.push_back(i_pContainer); + gDeinitDeleteList.push_back(i_pContainer); } void DeleteOnDeinitBase::ImplDeleteOnDeInit() { - ImplSVData* pSVData = ImplGetSVData(); - for (auto const& deinitDelete : pSVData->maDeinitDeleteList) + gShutdown = true; + for (auto const& deinitDelete : gDeinitDeleteList) { deinitDelete->doCleanup(); } - pSVData->maDeinitDeleteList.clear(); + gDeinitDeleteList.clear(); } -} // namespace vcl +} // namespace tools /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/translations b/translations index d5e786eb5690..3afbfbdd5fe5 160000 --- a/translations +++ b/translations @@ -1 +1 @@ -Subproject commit d5e786eb569095ac348028ca7878e44bc4543dc1 +Subproject commit 3afbfbdd5fe5e3053aa67158a95897c21e142ad7 diff --git a/ucb/source/cacher/cacheddynamicresultsetstub.cxx b/ucb/source/cacher/cacheddynamicresultsetstub.cxx index f5decb5e5506..1904a7be0395 100644 --- a/ucb/source/cacher/cacheddynamicresultsetstub.cxx +++ b/ucb/source/cacher/cacheddynamicresultsetstub.cxx @@ -216,7 +216,7 @@ void SAL_CALL CachedDynamicResultSetStubFactory xSortFactory->createSortedDynamicResultSet( Source, SortingInfo, CompareFactory ) ); if( xSorted.is() ) - xSource = xSorted; + xSource = std::move(xSorted); } } diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx index c25f21789313..7f10f8e5fe00 100644 --- a/ucb/source/ucp/file/filglob.cxx +++ b/ucb/source/ucp/file/filglob.cxx @@ -336,14 +336,8 @@ namespace fileaccess { // not enough memory for allocating structures ioErrorCode = IOErrorCode_OUT_OF_MEMORY; break; - case FileBase::E_BUSY: - // Text file busy - ioErrorCode = IOErrorCode_LOCKING_VIOLATION; - break; - case FileBase::E_AGAIN: - // Operation would block - ioErrorCode = IOErrorCode_LOCKING_VIOLATION; - break; + case FileBase::E_BUSY: // Text file busy + case FileBase::E_AGAIN: // Operation would block case FileBase::E_NOLCK: // No record locks available ioErrorCode = IOErrorCode_LOCKING_VIOLATION; break; @@ -476,16 +470,13 @@ namespace fileaccess { // Is a directory ioErrorCode = IOErrorCode_NO_FILE; break; - case FileBase::E_AGAIN: - // Operation would block + case FileBase::E_AGAIN: // Operation would block + case FileBase::E_NOLCK: // No record locks available ioErrorCode = IOErrorCode_LOCKING_VIOLATION; break; case FileBase::E_TIMEDOUT: ioErrorCode = IOErrorCode_DEVICE_NOT_READY; break; - case FileBase::E_NOLCK: // No record locks available - ioErrorCode = IOErrorCode_LOCKING_VIOLATION; - break; case FileBase::E_IO: // I/O error case FileBase::E_BADF: // Bad file case FileBase::E_FAULT: // Bad address @@ -686,6 +677,8 @@ namespace fileaccess { ioErrorCode = IOErrorCode_ACCESS_DENIED; break; case FileBase::E_PERM: // Operation not permitted + case FileBase::E_ISDIR: // Is a directory + case FileBase::E_ROFS: // Read-only file system ioErrorCode = IOErrorCode_NOT_SUPPORTED; break; case FileBase::E_NAMETOOLONG: // File name too long @@ -695,10 +688,6 @@ namespace fileaccess { case FileBase::E_NOENT: // No such file or directory ioErrorCode = IOErrorCode_NOT_EXISTING; break; - case FileBase::E_ISDIR: // Is a directory - case FileBase::E_ROFS: // Read-only file system - ioErrorCode = IOErrorCode_NOT_SUPPORTED; - break; case FileBase::E_BUSY: // Device or resource busy ioErrorCode = IOErrorCode_LOCKING_VIOLATION; break; diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.cxx b/ucb/source/ucp/hierarchy/hierarchycontent.cxx index da0a328fe8ff..5a1c062f8ef5 100644 --- a/ucb/source/ucp/hierarchy/hierarchycontent.cxx +++ b/ucb/source/ucp/hierarchy/hierarchycontent.cxx @@ -1392,7 +1392,7 @@ void HierarchyContent::insert( sal_Int32 nNameClashResolve, // Identifier changed? bool bNewId = ( xId->getContentIdentifier() != m_xIdentifier->getContentIdentifier() ); - m_xIdentifier = xId; + m_xIdentifier = std::move(xId); if ( !storeData() ) { diff --git a/ucb/source/ucp/hierarchy/hierarchydata.cxx b/ucb/source/ucp/hierarchy/hierarchydata.cxx index cba3330718e1..725e4c3d1c26 100644 --- a/ucb/source/ucp/hierarchy/hierarchydata.cxx +++ b/ucb/source/ucp/hierarchy/hierarchydata.cxx @@ -646,7 +646,7 @@ bool HierarchyEntry::move( if ( bDifferentParents ) xNewParentNameAccess.set( xNewParentBatch, uno::UNO_QUERY ); else - xNewParentNameAccess = xOldParentNameAccess; + xNewParentNameAccess = std::move(xOldParentNameAccess); OSL_ENSURE( xNewParentNameAccess.is(), "HierarchyEntry::move - No name access!" ); @@ -667,7 +667,7 @@ bool HierarchyEntry::move( } } else - xNewNameContainer = xOldNameContainer; + xNewNameContainer = std::move(xOldNameContainer); if ( !xNewNameContainer.is() ) return false; @@ -875,7 +875,7 @@ bool HierarchyEntry::first( iterator & it ) OSL_ENSURE( xHierNameAccess.is(), "HierarchyEntry::first - No hier. name access!" ); - it.dir = xHierNameAccess; + it.dir = std::move(xHierNameAccess); it.officeDirs = m_xOfficeInstDirs; } diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx index 8d933acf200a..e98008487fec 100644 --- a/ucb/source/ucp/webdav-curl/CurlSession.cxx +++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx @@ -1105,9 +1105,7 @@ auto CurlProcessor::ProcessRequestImpl( { // Sharepoint 2016 workaround: contains unencoded U+0020 OUString const redirectURL(::rtl::Uri::encode( - pRedirectURL - ? OUString(pRedirectURL, strlen(pRedirectURL), RTL_TEXTENCODING_UTF8) - : OUString(), + OUString(pRedirectURL, strlen(pRedirectURL), RTL_TEXTENCODING_UTF8), rtl_UriCharClassUric, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8)); throw DAVException(DAVException::DAV_HTTP_REDIRECT, redirectURL); diff --git a/ucbhelper/source/provider/registerucb.cxx b/ucbhelper/source/provider/registerucb.cxx index baf0e5b3f6bb..77b931f2c548 100644 --- a/ucbhelper/source/provider/registerucb.cxx +++ b/ucbhelper/source/provider/registerucb.cxx @@ -97,7 +97,7 @@ registerAtUcb( catch (lang::IllegalArgumentException const &) {} if (xInstance.is()) - xProvider = xInstance; + xProvider = std::move(xInstance); } bool bSuccess = false; diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index 2813131b1472..398925353a6f 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -154,7 +154,7 @@ OUString DefaultFontConfiguration::tryLocale( const OUString& rBcp47, const OUSt { Any aAny = m_xConfigAccess->getByName( it->second.aConfigLocaleString ); if( aAny >>= xNode ) - it->second.xAccess = xNode; + it->second.xAccess = std::move(xNode); } } catch (const NoSuchElementException&) diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index f48b61240543..f96928d4d7b8 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -1152,7 +1152,7 @@ OUString SvtLinguConfig::GetVendorImageUrl_Impl( OUString aVendorImagesNode; if (aAny >>= aVendorImagesNode) { - xNA = xImagesNA; + xNA = std::move(xImagesNA); xNA.set( xNA->getByName(u"VendorImages"_ustr), uno::UNO_QUERY_THROW ); xNA.set( xNA->getByName( aVendorImagesNode ), uno::UNO_QUERY_THROW ); aAny = xNA->getByName( rImageName ); diff --git a/unotools/source/misc/eventlisteneradapter.cxx b/unotools/source/misc/eventlisteneradapter.cxx index b899db5c0723..0c1cfdac5577 100644 --- a/unotools/source/misc/eventlisteneradapter.cxx +++ b/unotools/source/misc/eventlisteneradapter.cxx @@ -67,7 +67,7 @@ namespace utl _rxComp->addEventListener(xMeMyselfAndI); m_xComponent = _rxComp; - m_xKeepMeAlive = xMeMyselfAndI; + m_xKeepMeAlive = std::move(xMeMyselfAndI); } void OEventListenerImpl::dispose() diff --git a/unoxml/qa/complex/unoxml/DOMTest.java b/unoxml/qa/complex/unoxml/DOMTest.java index 0d2436070e0d..7d31a525aae9 100644 --- a/unoxml/qa/complex/unoxml/DOMTest.java +++ b/unoxml/qa/complex/unoxml/DOMTest.java @@ -1312,187 +1312,6 @@ public class DOMTest xText, xAttr.getLastChild()); } - @Test public void testXText() throws Exception - { - XDocumentBuilder xBuilder = - UnoRuntime.queryInterface(XDocumentBuilder.class, - m_xMSF.createInstance("com.sun.star.xml.dom.DocumentBuilder")); - XDocument xDoc = xBuilder.newDocument(); - - XText xText = xDoc.createTextNode("foobar"); - assertNotNull(xText); - - assertEquals("XText.getData", "foobar", xText.getData()); - assertEquals("XText.getLength", 6, xText.getLength()); - - /* FIXME - try { - xText.splitText(9999); - fail("XText.splitText(9999)"); - } catch (DOMException e) { - assertTrue("XText.splitText(9999)", INDEX_SIZE_ERR == e.Code); - } - - { - XText xTextBar = xText.splitText(2); - assertNotNull("XText.splitText", xTextBar); - assertEquals("XText.splitText", "foo", xText.getData()); - assertEquals("XText.splitText", "bar", xTextBar.getData()); - } - */ - xText.setData("foo"); - - xText.appendData("baz"); - assertEquals("XText.appendData", "foobaz", xText.getData()); - - try { - xText.deleteData(999,999); - fail("XText.deleteData(999,999)"); - } catch (DOMException e) { - assertTrue("XText.deleteData(999,999)", INDEX_SIZE_ERR == e.Code); - } - xText.deleteData(0, 3); - assertEquals("XText.deleteData", "baz", xText.getData()); - - try { - xText.insertData(999,"blah"); - fail("XText.insertData(999,\"blah\")"); - } catch (DOMException e) { - assertTrue("XText.insertData(999,\"blah\")", - INDEX_SIZE_ERR == e.Code); - } - xText.insertData(1, "arb"); - assertEquals("XText.insertData", "barbaz", xText.getData()); - - try { - xText.replaceData(999,999,"x"); - fail("XText.replaceData(999,999,\"x\")"); - } catch (DOMException e) { - assertTrue("XText.replaceData(999,999,\"x\")", - INDEX_SIZE_ERR == e.Code); - } - xText.replaceData(3, 3, "foo"); - assertEquals("XText.replaceData", "barfoo", xText.getData()); - - xText.setData("quux"); - assertEquals("XText.setData", "quux", xText.getData()); - - try { - xText.subStringData(999,999); - fail("XText.subStringData(999,999)"); - } catch (DOMException e) { - assertTrue("XText.subStringData(999,999)", - INDEX_SIZE_ERR == e.Code); - } - assertEquals("XText.subStringData", "x", xText.subStringData(3, 1)); - - // XNode - - { - XNode xTextCloneN = xText.cloneNode(false); - assertNotNull("XText.cloneNode(false)", xTextCloneN); - XText xTextClone = - UnoRuntime.queryInterface(XText.class, xTextCloneN); - assertNotNull("XText.cloneNode(false)", xTextClone); - assertFalse("XText.cloneNode(false)", - xTextClone.hasChildNodes()); - } - { - XNode xTextCloneN = xText.cloneNode(true); - assertNotNull("XText.cloneNode(true)", xTextCloneN); - XText xTextClone = - UnoRuntime.queryInterface(XText.class, xTextCloneN); - assertNotNull("XText.cloneNode(true)", xTextClone); - assertFalse("XText.cloneNode(true)", xTextClone.hasChildNodes()); - } - - assertNull("XText.getAttributes()", xText.getAttributes()); - - { - XNodeList xChildren = xText.getChildNodes(); - assertTrue("XText.getChildNodes()", 0 == xChildren.getLength()); - } - - assertEquals("XText.getLocalName()", "", xText.getLocalName()); - - assertEquals("XText.getNamespaceURI()", "", xText.getNamespaceURI()); - - assertNull("XText.getNextSibling()", xText.getNextSibling()); - - assertEquals("XText.getNodeName()", "#text", xText.getNodeName()); - - assertTrue("XText.getNodeType()", - TEXT_NODE == xText.getNodeType()); - - assertEquals("XText.getNodeValue()", "quux", xText.getNodeValue()); - - assertEquals("XText.getOwnerDocument()", - xDoc, xText.getOwnerDocument()); - - assertNull("XText.getParentNode()", xText.getParentNode()); - - assertEquals("XText.getPrefix()", "", xText.getPrefix()); - - assertNull("XText.getPreviousSibling()", xText.getPreviousSibling()); - - assertFalse("XText.hasAttributes()", xText.hasAttributes()); - - assertFalse("XText.hasChildNodes()", xText.hasChildNodes()); - - assertFalse("XText.isSupported()", - xText.isSupported("frobnication", "v99.33.0.0.0.1")); - - xText.normalize(); - - xText.setNodeValue("42"); - assertEquals("XText.setNodeValue()", "42", xText.getNodeValue()); - - try { - xText.setPrefix("foo"); - fail("XText.setPrefix()"); - } catch (DOMException e) { - assertTrue("XText.setPrefix()", - NO_MODIFICATION_ALLOWED_ERR == e.Code); - } - - XText xText2 = xDoc.createTextNode("foobar"); - XText xText3 = xDoc.createTextNode("foobar"); - - try { - xText.appendChild(null); - fail("XText.appendChild(null)"); - } catch (Exception e) { /* expected */ } - try { - xText.appendChild(xText2); - fail("XText.appendChild(xText2)"); - } catch (DOMException e) { - assertTrue("XText.appendChild(xText2)", - HIERARCHY_REQUEST_ERR == e.Code); - } - - try { - xText.insertBefore(xText2, xText3); - fail("XText.insertBefore"); - } catch (Exception e) { /* expected */ } - - try { - xText.replaceChild(xText2, xText3); - fail("XText.insertBefore"); - } catch (Exception e) { /* expected */ } - - try { - xText.removeChild(null); - fail("XText.removeChild(null)"); - } catch (Exception e) { /* expected */ } - - try { - xText.removeChild(xText2); - fail("XText.removeChild"); - } catch (DOMException e) { - assertTrue("XText.removeChild", HIERARCHY_REQUEST_ERR == e.Code); - } - } - @Test public void testXCDataSection() throws Exception { XDocumentBuilder xBuilder = diff --git a/unoxml/qa/unit/domtest.cxx b/unoxml/qa/unit/domtest.cxx index a6d7997f8951..de17af86057c 100644 --- a/unoxml/qa/unit/domtest.cxx +++ b/unoxml/qa/unit/domtest.cxx @@ -561,6 +561,185 @@ public: } } + void testXText() + { + Reference< xml::dom::XDocument > xDocument = mxDomBuilder->newDocument(); + CPPUNIT_ASSERT(xDocument); + uno::Reference xText = xDocument->createTextNode(u"foobar"_ustr); + CPPUNIT_ASSERT(xText); + + CPPUNIT_ASSERT_EQUAL(u"foobar"_ustr, xText->getData()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xText->getLength()); + + xText->setData(u"foo"_ustr); + + xText->appendData(u"baz"_ustr); + CPPUNIT_ASSERT_EQUAL(u"foobaz"_ustr, xText->getData()); + + try + { + xText->deleteData(999, 999); + CPPUNIT_FAIL("XText.deleteData(999,999)"); + } + catch (xml::dom::DOMException& e) + { + CPPUNIT_ASSERT_EQUAL(xml::dom::DOMExceptionType::DOMExceptionType_INDEX_SIZE_ERR, e.Code); + } + + xText->deleteData(0, 3); + CPPUNIT_ASSERT_EQUAL(u"baz"_ustr, xText->getData()); + + try + { + xText->insertData(999, u"blah"_ustr); + CPPUNIT_FAIL("XText.insertData(999,\"blah\")"); + } + catch (xml::dom::DOMException& e) + { + CPPUNIT_ASSERT_EQUAL(xml::dom::DOMExceptionType::DOMExceptionType_INDEX_SIZE_ERR, e.Code); + } + + xText->insertData(1, u"arb"_ustr); + CPPUNIT_ASSERT_EQUAL(u"barbaz"_ustr, xText->getData()); + + try + { + xText->replaceData(999, 999, u"x"_ustr); + CPPUNIT_FAIL("XText.replaceData(999, 999, \"x\")"); + } + catch (xml::dom::DOMException& e) + { + CPPUNIT_ASSERT_EQUAL(xml::dom::DOMExceptionType::DOMExceptionType_INDEX_SIZE_ERR, e.Code); + } + + xText->replaceData(3, 3, u"foo"_ustr); + CPPUNIT_ASSERT_EQUAL(u"barfoo"_ustr, xText->getData()); + + xText->setData(u"quux"_ustr); + CPPUNIT_ASSERT_EQUAL(u"quux"_ustr, xText->getData()); + + try + { + xText->subStringData(999, 999); + CPPUNIT_FAIL("XText.subStringData(999, 999)"); + } + catch (xml::dom::DOMException& e) + { + CPPUNIT_ASSERT_EQUAL(xml::dom::DOMExceptionType::DOMExceptionType_INDEX_SIZE_ERR, e.Code); + } + + CPPUNIT_ASSERT_EQUAL(u"x"_ustr, xText->subStringData(3, 1)); + + // XNode + { + uno::Reference xTextCloneN = xText->cloneNode(false); + CPPUNIT_ASSERT(xTextCloneN); + uno::Reference xTextClone(xTextCloneN, uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT(xTextClone); + CPPUNIT_ASSERT(!xTextClone->hasChildNodes()); + } + { + uno::Reference xTextCloneN = xText->cloneNode(true); + CPPUNIT_ASSERT(xTextCloneN); + uno::Reference xTextClone(xTextCloneN, uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT(xTextClone); + CPPUNIT_ASSERT(!xTextClone->hasChildNodes()); + } + + CPPUNIT_ASSERT(!xText->getAttributes()); + + uno::Reference xChildList = xText->getChildNodes(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xChildList->getLength()); + + CPPUNIT_ASSERT_EQUAL(u""_ustr, xText->getLocalName()); + CPPUNIT_ASSERT_EQUAL(u""_ustr, xText->getNamespaceURI()); + CPPUNIT_ASSERT(!xText->getNextSibling()); + CPPUNIT_ASSERT_EQUAL(u"#text"_ustr, xText->getNodeName()); + CPPUNIT_ASSERT_EQUAL(xml::dom::NodeType::NodeType_TEXT_NODE, xText->getNodeType()); + CPPUNIT_ASSERT_EQUAL(u"quux"_ustr, xText->getNodeValue()); + CPPUNIT_ASSERT_EQUAL(xDocument, xText->getOwnerDocument()); + CPPUNIT_ASSERT(!xText->getParentNode()); + CPPUNIT_ASSERT_EQUAL(u""_ustr, xText->getPrefix()); + CPPUNIT_ASSERT(!xText->getPreviousSibling()); + CPPUNIT_ASSERT(!xText->hasAttributes()); + CPPUNIT_ASSERT(!xText->hasChildNodes()); + CPPUNIT_ASSERT(!xText->isSupported(u"frobnication"_ustr, u"v99.33.0.0.0.1"_ustr)); + + xText->normalize(); + xText->setNodeValue(u"42"_ustr); + CPPUNIT_ASSERT_EQUAL(u"42"_ustr, xText->getNodeValue()); + + try + { + xText->setPrefix(u"foo"_ustr); + CPPUNIT_FAIL("XText.setPrefix()"); + } + catch (xml::dom::DOMException& e) + { + CPPUNIT_ASSERT_EQUAL(xml::dom::DOMExceptionType::DOMExceptionType_NO_MODIFICATION_ALLOWED_ERR, e.Code); + } + + uno::Reference xText2 = xDocument->createTextNode(u"foobar"_ustr); + uno::Reference xText3 = xDocument->createTextNode(u"foobar"_ustr); + + try + { + xText->appendChild(nullptr); + CPPUNIT_FAIL("XText.appendChild(null)"); + } + catch (css::uno::RuntimeException&) + { + } + + try + { + xText->appendChild(xText2); + CPPUNIT_FAIL("XText.appendChild(xText2)"); + } + catch (xml::dom::DOMException& e) + { + CPPUNIT_ASSERT_EQUAL(xml::dom::DOMExceptionType::DOMExceptionType_HIERARCHY_REQUEST_ERR, e.Code); + } + + try + { + xText->insertBefore(xText2, xText3); + CPPUNIT_FAIL("XText.insertBefore"); + } + catch (xml::dom::DOMException&) + { + } + + try + { + xText->replaceChild(xText2, xText3); + CPPUNIT_FAIL("XText.replaceChild"); + } + catch (xml::dom::DOMException&) + { + } + + try + { + xText->removeChild(nullptr); + CPPUNIT_FAIL("XText.removeChild(null)"); + } + catch (css::uno::RuntimeException&) + { + } + + try + { + xText->removeChild(xText2); + CPPUNIT_FAIL("XText.removeChild"); + } + catch (xml::dom::DOMException& e) + { + CPPUNIT_ASSERT_EQUAL(xml::dom::DOMExceptionType::DOMExceptionType_HIERARCHY_REQUEST_ERR, e.Code); + } + + } + void testXProcessingInstruction() { Reference< xml::dom::XDocument > xDocument = mxDomBuilder->newDocument(); @@ -866,6 +1045,7 @@ public: CPPUNIT_TEST(testXDocumentBuilder); CPPUNIT_TEST(testXXPathAPI); CPPUNIT_TEST(testXXPathObject); + CPPUNIT_TEST(testXText); CPPUNIT_TEST(testXProcessingInstruction); CPPUNIT_TEST(testXNamedNodeMap_AttributesMap); CPPUNIT_TEST(testXNodeList_ChildList); diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index 0eba4c26597f..ab57e51b869a 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -66,6 +66,7 @@ namespace DOM (cur->type == XML_DTD_NODE)) { return cur; } + cur = cur->next; } return nullptr; } diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx index 69b40dc3ab5c..1a59d85513f8 100644 --- a/unoxml/source/dom/element.cxx +++ b/unoxml/source/dom/element.cxx @@ -198,7 +198,7 @@ namespace DOM {} // restore after children have been processed - i_rContext.mxCurrentHandler = xParentHandler; + i_rContext.mxCurrentHandler = std::move(xParentHandler); popContext(i_rContext); } diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx index 2ab050820ee0..72a75b452be2 100644 --- a/unoxml/source/dom/saxbuilder.cxx +++ b/unoxml/source/dom/saxbuilder.cxx @@ -100,7 +100,7 @@ namespace DOM m_aDocument = ownerDoc; Reference< XDocumentFragment > aFragment = m_aDocument->createDocumentFragment(); m_aNodeStack.push(aFragment); - m_aFragment = aFragment; + m_aFragment = std::move(aFragment); m_aState = SAXDocumentBuilderState_BUILDING_FRAGMENT; } @@ -132,7 +132,7 @@ namespace DOM Reference< XDocumentBuilder > aBuilder(DocumentBuilder::create(m_xContext)); Reference< XDocument > aDocument = aBuilder->newDocument(); m_aNodeStack.push(aDocument); - m_aDocument = aDocument; + m_aDocument = std::move(aDocument); m_aState = SAXDocumentBuilderState_BUILDING_DOCUMENT; } diff --git a/unoxml/source/rdf/CLiteral.cxx b/unoxml/source/rdf/CLiteral.cxx index bab788093f76..b3733ff164f6 100644 --- a/unoxml/source/rdf/CLiteral.cxx +++ b/unoxml/source/rdf/CLiteral.cxx @@ -120,7 +120,7 @@ void SAL_CALL CLiteral::initialize(const css::uno::Sequence< css::uno::Any > & a throw css::lang::IllegalArgumentException( u"CLiteral::initialize: argument is null"_ustr, *this, 1); } - m_xDatatype = xURI; + m_xDatatype = std::move(xURI); } else { throw css::lang::IllegalArgumentException( u"CLiteral::initialize: argument must be string or URI"_ustr, *this, 1); diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk index ec580d76358a..26533420c67f 100644 --- a/vcl/CustomTarget_qt5_moc.mk +++ b/vcl/CustomTarget_qt5_moc.mk @@ -14,7 +14,10 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \ $(gb_CustomTarget_workdir)/vcl/qt5/QtFilePicker.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtFrame.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstance.moc \ + $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceComboBox.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceDialog.moc \ + $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceEntry.moc \ + $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLinkButton.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceMessageDialog.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtMainWindow.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtMenu.moc \ diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk index 28fb0100f40e..f31184182a82 100644 --- a/vcl/CustomTarget_qt6_moc.mk +++ b/vcl/CustomTarget_qt6_moc.mk @@ -14,7 +14,10 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \ $(gb_CustomTarget_workdir)/vcl/qt6/QtFilePicker.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtFrame.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstance.moc \ + $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceComboBox.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceDialog.moc \ + $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceEntry.moc \ + $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLinkButton.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceMessageDialog.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtMainWindow.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtMenu.moc \ diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 8d51d7157bcf..a59285a26dfb 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -390,7 +390,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/helper/driverblocklist \ vcl/source/helper/evntpost \ vcl/source/helper/idletask \ - vcl/source/helper/lazydelete \ vcl/source/helper/strhelper \ vcl/source/helper/svtaccessiblefactory \ vcl/source/helper/threadex \ diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk index 767eab5e4024..2a8441a566b0 100644 --- a/vcl/Library_vclplug_qt5.mk +++ b/vcl/Library_vclplug_qt5.mk @@ -93,16 +93,22 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\ vcl/qt5/QtGraphics_Controls \ vcl/qt5/QtGraphics_GDI \ vcl/qt5/QtGraphics_Text \ + vcl/qt5/QtHyperlinkLabel \ vcl/qt5/QtInstance \ vcl/qt5/QtInstance_Print \ vcl/qt5/QtInstanceBuilder \ vcl/qt5/QtInstanceButton \ vcl/qt5/QtInstanceCheckButton \ vcl/qt5/QtInstanceContainer \ + vcl/qt5/QtInstanceComboBox \ vcl/qt5/QtInstanceDialog \ vcl/qt5/QtInstanceEntry \ + vcl/qt5/QtInstanceFrame \ + vcl/qt5/QtInstanceImage \ + vcl/qt5/QtInstanceLinkButton \ vcl/qt5/QtInstanceMessageDialog \ vcl/qt5/QtInstanceLabel \ + vcl/qt5/QtInstanceRadioButton \ vcl/qt5/QtInstanceTextView \ vcl/qt5/QtInstanceWidget \ vcl/qt5/QtInstanceWindow \ diff --git a/vcl/Library_vclplug_qt6.mk b/vcl/Library_vclplug_qt6.mk index 01e0ae5a2a9d..e5247de86c4e 100644 --- a/vcl/Library_vclplug_qt6.mk +++ b/vcl/Library_vclplug_qt6.mk @@ -92,16 +92,22 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\ vcl/qt6/QtGraphics_Controls \ vcl/qt6/QtGraphics_GDI \ vcl/qt6/QtGraphics_Text \ + vcl/qt6/QtHyperlinkLabel \ vcl/qt6/QtInstance \ vcl/qt6/QtInstance_Print \ vcl/qt6/QtInstanceBuilder \ vcl/qt6/QtInstanceButton \ vcl/qt6/QtInstanceCheckButton \ + vcl/qt6/QtInstanceComboBox \ vcl/qt6/QtInstanceContainer \ vcl/qt6/QtInstanceDialog \ vcl/qt6/QtInstanceEntry \ + vcl/qt6/QtInstanceFrame \ + vcl/qt6/QtInstanceImage \ vcl/qt6/QtInstanceLabel \ + vcl/qt6/QtInstanceLinkButton \ vcl/qt6/QtInstanceMessageDialog \ + vcl/qt6/QtInstanceRadioButton \ vcl/qt6/QtInstanceTextView \ vcl/qt6/QtInstanceWidget \ vcl/qt6/QtInstanceWindow \ diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx index a0c780d755b5..ea0cbdccd206 100644 --- a/vcl/headless/CairoCommon.cxx +++ b/vcl/headless/CairoCommon.cxx @@ -671,8 +671,6 @@ void CairoCommon::SetROPLineColor(SalROPColor nROPColor) m_oLineColor = Color(0, 0, 0); break; case SalROPColor::N1: - m_oLineColor = Color(0xff, 0xff, 0xff); - break; case SalROPColor::Invert: m_oLineColor = Color(0xff, 0xff, 0xff); break; @@ -687,8 +685,6 @@ void CairoCommon::SetROPFillColor(SalROPColor nROPColor) m_oFillColor = Color(0, 0, 0); break; case SalROPColor::N1: - m_oFillColor = Color(0xff, 0xff, 0xff); - break; case SalROPColor::Invert: m_oFillColor = Color(0xff, 0xff, 0xff); break; diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 81a35471dcc7..5542fd7c1da6 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -46,12 +46,11 @@ void SvpSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) rDPIX = rDPIY = 96; } -bool SvpSalGraphics::ShouldDownscaleIconsAtSurface(double* pScaleOut) const +bool SvpSalGraphics::ShouldDownscaleIconsAtSurface(double& rScaleOut) const { if (comphelper::LibreOfficeKit::isActive()) - return SalGraphics::ShouldDownscaleIconsAtSurface(pScaleOut); - if (pScaleOut) - *pScaleOut = m_aCairoCommon.m_fScale; + return SalGraphics::ShouldDownscaleIconsAtSurface(rScaleOut); + rScaleOut = m_aCairoCommon.m_fScale; return true; } diff --git a/vcl/inc/bitmap/BitmapDisabledImageFilter.hxx b/vcl/inc/bitmap/BitmapDisabledImageFilter.hxx index 7591125dd3d8..144c36f6e45c 100644 --- a/vcl/inc/bitmap/BitmapDisabledImageFilter.hxx +++ b/vcl/inc/bitmap/BitmapDisabledImageFilter.hxx @@ -8,8 +8,7 @@ * */ -#ifndef INCLUDED_VCL_INC_BITMAP_BITMAPDISABLEDIMAGEFILTER_HXX -#define INCLUDED_VCL_INC_BITMAP_BITMAPDISABLEDIMAGEFILTER_HXX +#pragma once #include @@ -21,6 +20,4 @@ public: virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/BitmapFastScaleFilter.hxx b/vcl/inc/bitmap/BitmapFastScaleFilter.hxx index 9d6dc14769e7..d4c9183046d1 100644 --- a/vcl/inc/bitmap/BitmapFastScaleFilter.hxx +++ b/vcl/inc/bitmap/BitmapFastScaleFilter.hxx @@ -8,8 +8,7 @@ * */ -#ifndef VCL_INC_BITMAP_BITMAPFASTSCALEFILTER_HXX -#define VCL_INC_BITMAP_BITMAPFASTSCALEFILTER_HXX +#pragma once #include @@ -29,6 +28,4 @@ private: double mfScaleY; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/BitmapInterpolateScaleFilter.hxx b/vcl/inc/bitmap/BitmapInterpolateScaleFilter.hxx index 66e309a9746d..cf63e5c2a719 100644 --- a/vcl/inc/bitmap/BitmapInterpolateScaleFilter.hxx +++ b/vcl/inc/bitmap/BitmapInterpolateScaleFilter.hxx @@ -8,8 +8,7 @@ * */ -#ifndef VCL_INC_BITMAP_BITMAPINTERPOLATESCALEFILTER_HXX -#define VCL_INC_BITMAP_BITMAPINTERPOLATESCALEFILTER_HXX +#pragma once #include @@ -29,6 +28,4 @@ private: double mfScaleY; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/bitmap/BitmapLightenFilter.hxx b/vcl/inc/bitmap/BitmapLightenFilter.hxx index 541eb29f34da..c0be3356fe3f 100644 --- a/vcl/inc/bitmap/BitmapLightenFilter.hxx +++ b/vcl/inc/bitmap/BitmapLightenFilter.hxx @@ -8,8 +8,7 @@ * */ -#ifndef INCLUDED_VCL_INC_BITMAP_BITMAPLIGHTENFILTER_HXX -#define INCLUDED_VCL_INC_BITMAP_BITMAPLIGHTENFILTER_HXX +#pragma once #include @@ -19,6 +18,4 @@ public: virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 0c4476e9aa5b..89370154b014 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -80,7 +80,7 @@ public: virtual void DrawTextLayout( const GenericSalLayout& ) override; virtual void DrawSalLayout(const GenericSalLayout& rLayout, void* pSurface, const basegfx::BColor& rTextColor, bool bAntiAliased) const override; - virtual bool ShouldDownscaleIconsAtSurface(double* pScaleOut) const override; + virtual bool ShouldDownscaleIconsAtSurface(double& rScaleOut) const override; virtual SystemGraphicsData GetGraphicsData() const override; diff --git a/vcl/inc/osx/salframeview.h b/vcl/inc/osx/salframeview.h index dec2f03a42f3..287ccaedbc06 100644 --- a/vcl/inc/osx/salframeview.h +++ b/vcl/inc/osx/salframeview.h @@ -111,6 +111,7 @@ enum class SalEvent; BOOL mbInCommitMarkedText; NSAttributedString* mpLastMarkedText; BOOL mbTextInputWantsNonRepeatKeyDown; + NSTrackingArea* mpLastTrackingArea; } +(void)unsetMouseFrame: (AquaSalFrame*)pFrame; -(id)initWithSalFrame: (AquaSalFrame*)pFrame; @@ -146,6 +147,8 @@ enum class SalEvent; -(BOOL)handleKeyDownException:(NSEvent*)pEvent; -(void)clearLastEvent; -(void)clearLastMarkedText; +-(void)clearLastTrackingArea; +-(void)updateTrackingAreas; /* text action methods */ diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx index 00d156760020..6adbba81df4d 100644 --- a/vcl/inc/pch/precompiled_vcl.hxx +++ b/vcl/inc/pch/precompiled_vcl.hxx @@ -348,7 +348,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/vcl/inc/qt5/QtBuilder.hxx b/vcl/inc/qt5/QtBuilder.hxx index 7e74f96bdfef..ad7569b77a11 100644 --- a/vcl/inc/qt5/QtBuilder.hxx +++ b/vcl/inc/qt5/QtBuilder.hxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -73,6 +74,9 @@ private: static void setProperties(QObject* obj, stringmap& rProps); static QWidget* windowForObject(QObject* pObject); static QDialogButtonBox* findButtonBox(QDialog* pDialog); + + static void applyGridPackingProperties(QObject* pCurrentChild, QGridLayout& rGrid, + const stringmap& rPackingProperties); }; template inline T* QtBuilder::get(std::u16string_view sID) diff --git a/vcl/inc/qt5/QtHyperlinkLabel.hxx b/vcl/inc/qt5/QtHyperlinkLabel.hxx new file mode 100644 index 000000000000..f188f2ba9e18 --- /dev/null +++ b/vcl/inc/qt5/QtHyperlinkLabel.hxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include + +/** + * QLabel subclass for a label that holds a hyperlink, + * with convenient getters/setters for the displayed text + * and the hyperlink target. + */ +class QtHyperlinkLabel : public QLabel +{ + QString m_sDisplayText; + QString m_sUri; + +public: + QtHyperlinkLabel(QWidget* pParent); + + QString displayText() const { return m_sDisplayText; } + void setDisplayText(const QString& rDisplayText); + + QString uri() const { return m_sUri; } + void setUri(const QString& rUri); + +private: + void update(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtInstanceBuilder.hxx b/vcl/inc/qt5/QtInstanceBuilder.hxx index d0332b7601be..6df0b81dd335 100644 --- a/vcl/inc/qt5/QtInstanceBuilder.hxx +++ b/vcl/inc/qt5/QtInstanceBuilder.hxx @@ -37,7 +37,7 @@ public: virtual std::unique_ptr weld_container(const OUString&) override; virtual std::unique_ptr weld_box(const OUString&) override; virtual std::unique_ptr weld_paned(const OUString&) override; - virtual std::unique_ptr weld_frame(const OUString&) override; + virtual std::unique_ptr weld_frame(const OUString& rId) override; virtual std::unique_ptr weld_scrolled_window(const OUString&, bool bUserManagedScrolling = false) override; virtual std::unique_ptr weld_notebook(const OUString&) override; @@ -45,15 +45,15 @@ public: virtual std::unique_ptr weld_menu_button(const OUString&) override; virtual std::unique_ptr weld_menu_toggle_button(const OUString&) override; - virtual std::unique_ptr weld_link_button(const OUString&) override; + virtual std::unique_ptr weld_link_button(const OUString& rId) override; virtual std::unique_ptr weld_toggle_button(const OUString&) override; - virtual std::unique_ptr weld_radio_button(const OUString&) override; + virtual std::unique_ptr weld_radio_button(const OUString& rId) override; virtual std::unique_ptr weld_check_button(const OUString& rId) override; virtual std::unique_ptr weld_scale(const OUString&) override; virtual std::unique_ptr weld_progress_bar(const OUString&) override; virtual std::unique_ptr weld_level_bar(const OUString&) override; virtual std::unique_ptr weld_spinner(const OUString&) override; - virtual std::unique_ptr weld_image(const OUString&) override; + virtual std::unique_ptr weld_image(const OUString& rId) override; virtual std::unique_ptr weld_calendar(const OUString&) override; virtual std::unique_ptr weld_entry(const OUString& rId) override; virtual std::unique_ptr weld_spin_button(const OUString&) override; @@ -61,7 +61,7 @@ public: FieldUnit) override; virtual std::unique_ptr weld_formatted_spin_button(const OUString&) override; - virtual std::unique_ptr weld_combo_box(const OUString&) override; + virtual std::unique_ptr weld_combo_box(const OUString& rId) override; virtual std::unique_ptr weld_entry_tree_view(const OUString&, const OUString&, const OUString&) override; virtual std::unique_ptr weld_tree_view(const OUString&) override; diff --git a/vcl/inc/qt5/QtInstanceButton.hxx b/vcl/inc/qt5/QtInstanceButton.hxx index 52f940064332..3a513512e06e 100644 --- a/vcl/inc/qt5/QtInstanceButton.hxx +++ b/vcl/inc/qt5/QtInstanceButton.hxx @@ -29,6 +29,13 @@ public: virtual void set_font(const vcl::Font& rFont) override; virtual void set_custom_button(VirtualDevice* pDevice) override; + virtual void connect_clicked(const Link& rLink) override; + + // whether a custom click handler is set for the given button + // (s.a. weld::Button::is_custom_handler_set which would give the + // same result if called on the corresponding QtInstanceButton) + static bool hasCustomClickHandler(QAbstractButton& rButton); + private slots: void buttonClicked(); }; diff --git a/vcl/inc/qt5/QtInstanceComboBox.hxx b/vcl/inc/qt5/QtInstanceComboBox.hxx new file mode 100644 index 000000000000..159f5ce84072 --- /dev/null +++ b/vcl/inc/qt5/QtInstanceComboBox.hxx @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "QtInstanceWidget.hxx" + +#include + +class QtInstanceComboBox : public QObject, public QtInstanceWidget, public virtual weld::ComboBox +{ + Q_OBJECT + + QComboBox* m_pComboBox; + bool m_bSorted; + +public: + QtInstanceComboBox(QComboBox* pComboBox); + + virtual void insert(int nPos, const OUString& rStr, const OUString* pId, + const OUString* pIconName, VirtualDevice* pImageSurface) override; + virtual void insert_vector(const std::vector& rItems, + bool bKeepExisting) override; + + virtual void insert_separator(int nPos, const OUString& rId) override; + + virtual int get_count() const override; + virtual void make_sorted() override; + virtual void clear() override; + + virtual int get_active() const override; + virtual void set_active(int nPos) override; + virtual void remove(int nPos) override; + + virtual OUString get_active_text() const override; + virtual OUString get_text(int nPos) const override; + virtual int find_text(const OUString& rStr) const override; + + virtual OUString get_active_id() const override; + virtual void set_active_id(const OUString& rStr) override; + virtual OUString get_id(int nPos) const override; + virtual void set_id(int nRow, const OUString& rId) override; + virtual int find_id(const OUString& rId) const override; + + virtual bool changed_by_direct_pick() const override; + + virtual bool has_entry() const override; + virtual void set_entry_message_type(weld::EntryMessageType eType) override; + virtual void set_entry_text(const OUString& rStr) override; + virtual void set_entry_width_chars(int nChars) override; + virtual void set_entry_max_length(int nChars) override; + virtual void select_entry_region(int nStartPos, int nEndPos) override; + virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) override; + virtual void set_entry_completion(bool bEnable, bool bCaseSensitive = false) override; + virtual void set_entry_placeholder_text(const OUString& rText) override; + virtual void set_entry_editable(bool bEditable) override; + virtual void cut_entry_clipboard() override; + virtual void copy_entry_clipboard() override; + virtual void paste_entry_clipboard() override; + + virtual void set_font(const vcl::Font& rFont) override; + + virtual void set_entry_font(const vcl::Font& rFont) override; + virtual vcl::Font get_entry_font() override; + + virtual bool get_popup_shown() const override; + + virtual void set_custom_renderer(bool bOn) override; + virtual VclPtr create_render_virtual_device() const override; + virtual void set_item_menu(const OUString& rIdent, weld::Menu* pMenu) override; + virtual int get_menu_button_width() const override; + + virtual int get_max_mru_count() const override; + virtual void set_max_mru_count(int nCount) override; + virtual OUString get_mru_entries() const override; + virtual void set_mru_entries(const OUString& rEntries) override; + + virtual void set_max_drop_down_rows(int nRows) override; + +private: + void sortItems(); + +private slots: + void handleCurrentIndexChanged(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtInstanceEntry.hxx b/vcl/inc/qt5/QtInstanceEntry.hxx index 001d6714bcc4..4007765a41f8 100644 --- a/vcl/inc/qt5/QtInstanceEntry.hxx +++ b/vcl/inc/qt5/QtInstanceEntry.hxx @@ -13,8 +13,10 @@ #include -class QtInstanceEntry : public QtInstanceWidget, public virtual weld::Entry +class QtInstanceEntry : public QObject, public QtInstanceWidget, public virtual weld::Entry { + Q_OBJECT; + QLineEdit* m_pLineEdit; public: diff --git a/vcl/inc/qt5/QtInstanceFrame.hxx b/vcl/inc/qt5/QtInstanceFrame.hxx new file mode 100644 index 000000000000..78a9dc304c8e --- /dev/null +++ b/vcl/inc/qt5/QtInstanceFrame.hxx @@ -0,0 +1,28 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "QtInstanceContainer.hxx" + +#include + +class QtInstanceFrame : public QtInstanceContainer, public virtual weld::Frame +{ + QGroupBox* m_pGroupBox; + +public: + QtInstanceFrame(QGroupBox* pGroupBox); + + virtual void set_label(const OUString& rText) override; + virtual OUString get_label() const override; + virtual std::unique_ptr weld_label_widget() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtInstanceImage.hxx b/vcl/inc/qt5/QtInstanceImage.hxx new file mode 100644 index 000000000000..9afd20a2f16a --- /dev/null +++ b/vcl/inc/qt5/QtInstanceImage.hxx @@ -0,0 +1,28 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "QtInstanceWidget.hxx" + +#include + +class QtInstanceImage : public QtInstanceWidget, public virtual weld::Image +{ + QLabel* m_pLabel; + +public: + QtInstanceImage(QLabel* pLabel); + + virtual void set_from_icon_name(const OUString& rIconName) override; + virtual void set_image(VirtualDevice* pDevice) override; + virtual void set_image(const css::uno::Reference& rImage) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtInstanceLinkButton.hxx b/vcl/inc/qt5/QtInstanceLinkButton.hxx new file mode 100644 index 000000000000..2484aec008cd --- /dev/null +++ b/vcl/inc/qt5/QtInstanceLinkButton.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "QtHyperlinkLabel.hxx" +#include "QtInstanceWidget.hxx" + +#include + +class QtInstanceLinkButton : public QObject, + public QtInstanceWidget, + public virtual weld::LinkButton +{ + Q_OBJECT + + QtHyperlinkLabel* m_pLabel; + +public: + QtInstanceLinkButton(QtHyperlinkLabel* pLabel); + + virtual void set_label(const OUString& rText) override; + virtual OUString get_label() const override; + virtual void set_label_wrap(bool bWrap) override; + virtual void set_uri(const OUString& rUri) override; + virtual OUString get_uri() const override; + +private Q_SLOTS: + void linkActivated(const QString& rUrl); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtInstanceRadioButton.hxx b/vcl/inc/qt5/QtInstanceRadioButton.hxx new file mode 100644 index 000000000000..46eb098f942a --- /dev/null +++ b/vcl/inc/qt5/QtInstanceRadioButton.hxx @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "QtInstanceWidget.hxx" + +#include +#include + +class QtInstanceRadioButton : public QtInstanceWidget, public virtual weld::RadioButton +{ + QRadioButton* m_pRadioButton; + +public: + QtInstanceRadioButton(QRadioButton* pRadioButton); + + // weld::Toggleable methods + virtual void set_active(bool bActive) override; + virtual bool get_active() const override; + virtual void set_inconsistent(bool bInconsistent) override; + virtual bool get_inconsistent() const override; + + // weld::RadioButton methods + virtual void set_label(const OUString& rText) override; + virtual OUString get_label() const override; + virtual void set_label_wrap(bool bWrap) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/QtTools.hxx b/vcl/inc/qt5/QtTools.hxx index bc4a12d483a2..404fe4aa7967 100644 --- a/vcl/inc/qt5/QtTools.hxx +++ b/vcl/inc/qt5/QtTools.hxx @@ -49,11 +49,6 @@ inline OUString toOUString(const QString& s) return OUString(reinterpret_cast(s.data()), s.length()); } -inline QString toQString(const OUString& s) -{ - return QString::fromUtf16(s.getStr(), s.getLength()); -} - inline QRect toQRect(const tools::Rectangle& rRect) { return QRect(rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight()); diff --git a/vcl/inc/qt6/QtHyperlinkLabel.hxx b/vcl/inc/qt6/QtHyperlinkLabel.hxx new file mode 100644 index 000000000000..8afedee790d9 --- /dev/null +++ b/vcl/inc/qt6/QtHyperlinkLabel.hxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtHyperlinkLabel.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtInstanceComboBox.hxx b/vcl/inc/qt6/QtInstanceComboBox.hxx new file mode 100644 index 000000000000..019af7c2522b --- /dev/null +++ b/vcl/inc/qt6/QtInstanceComboBox.hxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtInstanceComboBox.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtInstanceFrame.hxx b/vcl/inc/qt6/QtInstanceFrame.hxx new file mode 100644 index 000000000000..70b53ba816b5 --- /dev/null +++ b/vcl/inc/qt6/QtInstanceFrame.hxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtInstanceFrame.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtInstanceImage.hxx b/vcl/inc/qt6/QtInstanceImage.hxx new file mode 100644 index 000000000000..01f647222fc8 --- /dev/null +++ b/vcl/inc/qt6/QtInstanceImage.hxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtInstanceImage.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtInstanceLinkButton.hxx b/vcl/inc/qt6/QtInstanceLinkButton.hxx new file mode 100644 index 000000000000..2f9204a48432 --- /dev/null +++ b/vcl/inc/qt6/QtInstanceLinkButton.hxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtInstanceLinkButton.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt6/QtInstanceRadioButton.hxx b/vcl/inc/qt6/QtInstanceRadioButton.hxx new file mode 100644 index 000000000000..0207173a6ca2 --- /dev/null +++ b/vcl/inc/qt6/QtInstanceRadioButton.hxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtInstanceRadioButton.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index b7fb674f7553..f29f35948d5b 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -474,7 +474,7 @@ public: virtual void DrawTextLayout( const GenericSalLayout& ) override; #ifdef MACOSX - virtual bool ShouldDownscaleIconsAtSurface(double* pScaleOut) const override; + virtual bool ShouldDownscaleIconsAtSurface(double& rScaleOut) const override; #endif virtual SystemGraphicsData diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 6fd58da78172..5a8a932ca559 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -399,7 +399,7 @@ public: // surface is hidpi then pScaleOut contains the scaling factor. So we can // create larger hires bitmaps which we know will be logically scaled down // by this factor but physically just copied - virtual bool ShouldDownscaleIconsAtSurface(double* pScaleOut) const; + virtual bool ShouldDownscaleIconsAtSurface(double& rScaleOut) const; #if ENABLE_CAIRO_CANVAS diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 3619de00d25b..f3c2f43a369f 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -128,7 +128,6 @@ namespace vcl { class DisplayConnectionDispatch; class SettingsConfigItem; - class DeleteOnDeinitBase; class Window; } @@ -421,7 +420,6 @@ struct ImplSVData css::uno::Reference< css::lang::XComponent > mxAccessBridge; std::unique_ptr mpSettingsConfigItem; - std::vector< vcl::DeleteOnDeinitBase* > maDeinitDeleteList; std::unordered_map< int, OUString > maPaperNames; css::uno::Reference m_xCharClass; @@ -464,7 +462,7 @@ VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData(); VCL_PLUGIN_PUBLIC void ImplHideSplash(); #ifdef _WIN32 -bool ImplInitAccessBridge(); +void ImplInitAccessBridge(); #endif const FieldUnitStringList& ImplGetFieldUnits(); diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index 940337b770a1..81aae45457a7 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -244,20 +244,6 @@ void AquaSalFrame::initWindowAndView() [mpNSWindow setRestorable:NO]; - // tdf#155092 use tracking areas instead of tracking rectangles - // Apparently, the older, tracking rectangles selectors cause - // unexpected window resizing upon the first mouse down after the - // window has been manually resized so switch to the newer, - // tracking areas selectors. Also, the NSTrackingInVisibleRect - // option allows us to create one single tracking area that - // resizes itself automatically over the lifetime of the view. - // Note: for some unknown reason, both NSTrackingMouseMoved and - // NSTrackingAssumeInside are necessary options for this fix - // to work. - NSTrackingArea *pTrackingArea = [[NSTrackingArea alloc] initWithRect: [mpNSView bounds] options: ( NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways | NSTrackingAssumeInside | NSTrackingInVisibleRect ) owner: mpNSView userInfo: nil]; - [mpNSView addTrackingArea: pTrackingArea]; - [pTrackingArea release]; - maSysData.mpNSView = mpNSView; UpdateFrameGeometry(); diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index 07193529e0d8..681567f3a5fa 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -774,6 +774,7 @@ static void updateWinDataInLiveResize(bool bInLiveResize) mbInCommitMarkedText = NO; mpLastMarkedText = nil; mbTextInputWantsNonRepeatKeyDown = NO; + mpLastTrackingArea = nil; } return self; @@ -783,6 +784,7 @@ static void updateWinDataInLiveResize(bool bInLiveResize) { [self clearLastEvent]; [self clearLastMarkedText]; + [self clearLastTrackingArea]; [self revokeWrapper]; [super dealloc]; @@ -2129,6 +2131,38 @@ static void updateWinDataInLiveResize(bool bInLiveResize) mbTextInputWantsNonRepeatKeyDown = NO; } +-(void)clearLastTrackingArea +{ + if (mpLastTrackingArea) + { + [self removeTrackingArea: mpLastTrackingArea]; + [mpLastTrackingArea release]; + mpLastTrackingArea = nil; + } +} + +-(void)updateTrackingAreas +{ + [super updateTrackingAreas]; + + // tdf#155092 use tracking areas instead of tracking rectangles + // Apparently, the older, tracking rectangles selectors cause + // unexpected window resizing upon the first mouse down after the + // window has been manually resized so switch to the newer, + // tracking areas selectors. Also, the NSTrackingInVisibleRect + // option allows us to create one single tracking area that + // resizes itself automatically over the lifetime of the view. + // Note: for some unknown reason, both NSTrackingMouseMoved and + // NSTrackingAssumeInside are necessary options for this fix + // to work. + // Note: for some unknown reason, [mpLastTrackingArea rect] + // returns an empty NSRect (at least on macOS Sequoia) so always + // remove the old tracking area and add a new one. + [self clearLastTrackingArea]; + mpLastTrackingArea = [[NSTrackingArea alloc] initWithRect: [self bounds] options: ( NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways | NSTrackingAssumeInside | NSTrackingInVisibleRect ) owner: self userInfo: nil]; + [self addTrackingArea: mpLastTrackingArea]; +} + - (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { // FIXME - These should probably be used? diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index ae79709fde86..977787ca1531 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index c6699bf18e5a..9b33ad3099cb 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -57,6 +57,7 @@ #include #include #include +#include using namespace css; using namespace css::accessibility; diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index 10c2c49bb6ec..a655e351117b 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -9,12 +9,15 @@ #include +#include #include #include #include +#include #include +#include #include #include #include @@ -23,6 +26,7 @@ #include #include #include +#include #include namespace @@ -53,10 +57,26 @@ QObject* QtBuilder::get_by_name(std::u16string_view sID) return nullptr; } -void QtBuilder::insertComboBoxOrListBoxItems(QObject*, stringmap&, - const std::vector&) +void QtBuilder::insertComboBoxOrListBoxItems(QObject* pObject, stringmap& rMap, + const std::vector& rItems) { - assert(false && "comboboxes and list boxes are not supported yet"); + if (QComboBox* pComboBox = qobject_cast(pObject)) + { + for (const ComboBoxTextItem& rItem : rItems) + { + QVariant aUserData; + if (!rItem.m_sId.isEmpty()) + aUserData = QVariant::fromValue(toQString(rItem.m_sId)); + + pComboBox->addItem(toQString(rItem.m_sItem), aUserData); + } + + const int nActiveId = BuilderBase::extractActive(rMap); + pComboBox->setCurrentIndex(nActiveId); + return; + } + + assert(false && "list boxes are not supported yet"); } QObject* QtBuilder::insertObject(QObject* pParent, const OUString& rClass, const OUString& rID, @@ -143,6 +163,12 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons { pObject = new QCheckBox(pParentWidget); } + else if (sName == u"GtkComboBoxText") + { + QComboBox* pComboBox = new QComboBox(pParentWidget); + pComboBox->setEditable(extractEntry(rMap)); + pObject = pComboBox; + } else if (sName == u"GtkDialog") { pObject = new QDialog(pParentWidget); @@ -155,11 +181,33 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons { pObject = new QGroupBox(pParentWidget); } + else if (sName == u"GtkGrid") + { + pObject = new QGridLayout(pParentWidget); + } + else if (sName == u"GtkImage") + { + pObject = new QLabel(pParentWidget); + } else if (sName == u"GtkLabel") { extractMnemonicWidget(sID, rMap); pObject = new QLabel(pParentWidget); } + else if (sName == u"GtkLinkButton") + { + QtHyperlinkLabel* pLabel = new QtHyperlinkLabel(pParentWidget); + if (rMap.contains(u"label"_ustr)) + pLabel->setDisplayText(toQString(rMap[u"label"_ustr])); + if (rMap.contains(u"uri"_ustr)) + pLabel->setUri(toQString(rMap[u"label"_ustr])); + + pObject = pLabel; + } + else if (sName == u"GtkRadioButton") + { + pObject = new QRadioButton(pParentWidget); + } else if (sName == u"GtkScrolledWindow") { pObject = new QScrollArea(pParentWidget); @@ -195,6 +243,8 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons // add layout to parent layout if (QBoxLayout* pParentBoxLayout = qobject_cast(pParentLayout)) pParentBoxLayout->addLayout(pLayout); + else if (QGridLayout* pParentGridLayout = qobject_cast(pParentLayout)) + pParentGridLayout->addLayout(pLayout, pParentGridLayout->rowCount(), 0); } m_aChildren.emplace_back(sID, pObject); @@ -203,8 +253,16 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons } void QtBuilder::tweakInsertedChild(QObject* pParent, QObject* pCurrentChild, std::string_view sType, - std::string_view) + std::string_view sInternalChild) { + if (sInternalChild == "entry" && qobject_cast(pParent)) + { + // an editable GtkComboBox has an internal GtkEntry child, + // but QComboBox doesn't need a separate widget for it, so + // delete it + pCurrentChild->deleteLater(); + } + if (sType == "label") { if (QLabel* pLabel = qobject_cast(pCurrentChild)) @@ -286,9 +344,50 @@ void QtBuilder::applyAtkProperties(QObject* pObject, const stringmap& rPropertie } } -void QtBuilder::applyPackingProperties(QObject*, QObject*, const stringmap&) +void QtBuilder::applyGridPackingProperties(QObject* pCurrentChild, QGridLayout& rGrid, + const stringmap& rPackingProperties) { - SAL_WARN("vcl.qt", "QtBuilder::applyPackingProperties not implemented yet"); + assert(pCurrentChild); + + // properties not set when there's no explicit GtkGrid in the .ui file, + // like for the QGridLayout that's the (implicit) layout of a QMessageBox + if (!rPackingProperties.contains(u"left-attach"_ustr) + || !rPackingProperties.contains(u"top-attach"_ustr)) + return; + + const sal_Int32 nColumn = rPackingProperties.at(u"left-attach"_ustr).toInt32(); + const sal_Int32 nRow = rPackingProperties.at(u"top-attach"_ustr).toInt32(); + + auto aWidthIt = rPackingProperties.find(u"width"_ustr); + sal_Int32 nColumnSpan = (aWidthIt == rPackingProperties.end()) ? 1 : aWidthIt->second.toInt32(); + + auto aHeightIt = rPackingProperties.find(u"height"_ustr); + sal_Int32 nRowSpan = (aHeightIt == rPackingProperties.end()) ? 1 : aHeightIt->second.toInt32(); + + if (pCurrentChild->isWidgetType()) + { + QWidget* pWidget = static_cast(pCurrentChild); + rGrid.removeWidget(pWidget); + rGrid.addWidget(pWidget, nRow, nColumn, nRowSpan, nColumnSpan); + return; + } + + // if it's not a QWidget, it must be a QLayout + QLayout* pLayout = static_cast(pCurrentChild); + rGrid.removeItem(pLayout); + rGrid.addLayout(pLayout, nRow, nColumn, nRowSpan, nColumnSpan); +} + +void QtBuilder::applyPackingProperties(QObject* pCurrentChild, QObject* pParent, + const stringmap& rPackingProperties) +{ + if (!pCurrentChild) + return; + + if (QGridLayout* pGrid = qobject_cast(pParent)) + applyGridPackingProperties(pCurrentChild, *pGrid, rPackingProperties); + else + SAL_WARN("vcl.qt", "QtBuilder::applyPackingProperties not yet implemented for this case"); } void QtBuilder::set_response(std::u16string_view sID, short nResponse) @@ -331,14 +430,15 @@ void QtBuilder::setProperties(QObject* pObject, stringmap& rProps) } } } - else if (QCheckBox* pCheckBox = qobject_cast(pObject)) + else if (qobject_cast(pObject) || qobject_cast(pObject)) { + QAbstractButton* pButton = static_cast(pObject); for (auto const & [ rKey, rValue ] : rProps) { if (rKey == u"active") - pCheckBox->setChecked(toBool(rValue)); + pButton->setChecked(toBool(rValue)); else if (rKey == u"label") - pCheckBox->setText(convertAccelerator(rValue)); + pButton->setText(convertAccelerator(rValue)); } } else if (QDialog* pDialog = qobject_cast(pObject)) diff --git a/vcl/qt5/QtFilePicker.cxx b/vcl/qt5/QtFilePicker.cxx index 93b16057e5dd..369e26054698 100644 --- a/vcl/qt5/QtFilePicker.cxx +++ b/vcl/qt5/QtFilePicker.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #include #include diff --git a/vcl/qt5/QtFont.cxx b/vcl/qt5/QtFont.cxx index e3a6c0b0a9d7..7d7c0aff30e6 100644 --- a/vcl/qt5/QtFont.cxx +++ b/vcl/qt5/QtFont.cxx @@ -22,6 +22,8 @@ #include #include +#include + #include #include #include diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index d8afccf189de..61903543bc9e 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -58,6 +58,7 @@ #endif #include +#include #include #include diff --git a/vcl/qt5/QtHyperlinkLabel.cxx b/vcl/qt5/QtHyperlinkLabel.cxx new file mode 100644 index 000000000000..91851c285ac1 --- /dev/null +++ b/vcl/qt5/QtHyperlinkLabel.cxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +QtHyperlinkLabel::QtHyperlinkLabel(QWidget* pParent) + : QLabel(pParent) +{ + setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard); +} + +void QtHyperlinkLabel::setDisplayText(const QString& rDisplayText) +{ + m_sDisplayText = rDisplayText; + update(); +}; + +void QtHyperlinkLabel::setUri(const QString& rUri) +{ + m_sUri = rUri; + update(); +}; + +void QtHyperlinkLabel::update() +{ + setText(QLatin1String("%2").arg(m_sUri).arg(m_sDisplayText)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx index e3348828a5bd..fe6fd90d0bea 100644 --- a/vcl/qt5/QtInstance.cxx +++ b/vcl/qt5/QtInstance.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index c5aa49acbb98..7558bb63a508 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -13,9 +13,14 @@ #include #include +#include #include +#include +#include #include +#include #include +#include #include QtInstanceBuilder::QtInstanceBuilder(QWidget* pParent, std::u16string_view sUIRoot, @@ -36,12 +41,18 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile) // what is relevant for that particular one, without having to implement the full // weld API at once. static std::unordered_set aSupportedUIFiles = { + u"cui/ui/optnewdictionarydialog.ui"_ustr, u"modules/scalc/ui/inputstringdialog.ui"_ustr, u"modules/schart/ui/insertaxisdlg.ui"_ustr, + u"modules/smath/ui/alignmentdialog.ui"_ustr, u"modules/swriter/ui/inforeadonlydialog.ui"_ustr, + u"modules/swriter/ui/renameobjectdialog.ui"_ustr, + u"modules/swriter/ui/wordcount.ui"_ustr, u"sfx/ui/licensedialog.ui"_ustr, u"sfx/ui/querysavedialog.ui"_ustr, + u"svt/ui/printersetupdialog.ui"_ustr, u"svt/ui/restartdialog.ui"_ustr, + u"writerperfect/ui/exportepub.ui"_ustr, }; return aSupportedUIFiles.contains(rUIFile); @@ -101,10 +112,12 @@ std::unique_ptr QtInstanceBuilder::weld_paned(const OUString&) return nullptr; } -std::unique_ptr QtInstanceBuilder::weld_frame(const OUString&) +std::unique_ptr QtInstanceBuilder::weld_frame(const OUString& rId) { - assert(false && "Not implemented yet"); - return nullptr; + QGroupBox* pGroupBox = m_xBuilder->get(rId); + std::unique_ptr xRet(pGroupBox ? std::make_unique(pGroupBox) + : nullptr); + return xRet; } std::unique_ptr QtInstanceBuilder::weld_scrolled_window(const OUString&, bool) @@ -139,10 +152,12 @@ std::unique_ptr QtInstanceBuilder::weld_menu_toggle_butt return nullptr; } -std::unique_ptr QtInstanceBuilder::weld_link_button(const OUString&) +std::unique_ptr QtInstanceBuilder::weld_link_button(const OUString& rId) { - assert(false && "Not implemented yet"); - return nullptr; + QtHyperlinkLabel* pLabel = m_xBuilder->get(rId); + std::unique_ptr xRet(pLabel ? std::make_unique(pLabel) + : nullptr); + return xRet; } std::unique_ptr QtInstanceBuilder::weld_toggle_button(const OUString&) @@ -151,10 +166,12 @@ std::unique_ptr QtInstanceBuilder::weld_toggle_button(const return nullptr; } -std::unique_ptr QtInstanceBuilder::weld_radio_button(const OUString&) +std::unique_ptr QtInstanceBuilder::weld_radio_button(const OUString& rId) { - assert(false && "Not implemented yet"); - return nullptr; + QRadioButton* pRadioButton = m_xBuilder->get(rId); + std::unique_ptr xRet( + pRadioButton ? std::make_unique(pRadioButton) : nullptr); + return xRet; } std::unique_ptr QtInstanceBuilder::weld_check_button(const OUString& rId) @@ -189,10 +206,11 @@ std::unique_ptr QtInstanceBuilder::weld_spinner(const OUString&) return nullptr; } -std::unique_ptr QtInstanceBuilder::weld_image(const OUString&) +std::unique_ptr QtInstanceBuilder::weld_image(const OUString& rId) { - assert(false && "Not implemented yet"); - return nullptr; + QLabel* pLabel = m_xBuilder->get(rId); + std::unique_ptr xRet(pLabel ? std::make_unique(pLabel) : nullptr); + return xRet; } std::unique_ptr QtInstanceBuilder::weld_calendar(const OUString&) @@ -229,10 +247,12 @@ QtInstanceBuilder::weld_formatted_spin_button(const OUString&) return nullptr; } -std::unique_ptr QtInstanceBuilder::weld_combo_box(const OUString&) +std::unique_ptr QtInstanceBuilder::weld_combo_box(const OUString& rId) { - assert(false && "Not implemented yet"); - return nullptr; + QComboBox* pComboBox = m_xBuilder->get(rId); + std::unique_ptr xRet(pComboBox ? std::make_unique(pComboBox) + : nullptr); + return xRet; } std::unique_ptr diff --git a/vcl/qt5/QtInstanceButton.cxx b/vcl/qt5/QtInstanceButton.cxx index 1d68f9bcdb0e..6de1164e8d10 100644 --- a/vcl/qt5/QtInstanceButton.cxx +++ b/vcl/qt5/QtInstanceButton.cxx @@ -9,6 +9,13 @@ #include +#include + +// Name of QObject property to indicate whether a click handler +// was set on the QPushButton: If that property is set and has a value +// of true, then a custom click handler is set, otherwise not. +const char* const PROPERTY_CLICK_HANDLER_SET = "click-handler-set"; + QtInstanceButton::QtInstanceButton(QPushButton* pButton) : QtInstanceWidget(pButton) , m_pButton(pButton) @@ -42,9 +49,13 @@ void QtInstanceButton::set_image(const css::uno::ReferencesetIcon(aIcon); + }); } OUString QtInstanceButton::get_label() const @@ -72,6 +83,22 @@ void QtInstanceButton::set_custom_button(VirtualDevice* /*pDevice*/) assert(false && "Not implemented yet"); } +void QtInstanceButton::connect_clicked(const Link& rLink) +{ + weld::Button::connect_clicked(rLink); + m_pButton->setProperty(PROPERTY_CLICK_HANDLER_SET, QVariant::fromValue(rLink.IsSet())); +} + +bool QtInstanceButton::hasCustomClickHandler(QAbstractButton& rButton) +{ + QVariant aProp = rButton.property(PROPERTY_CLICK_HANDLER_SET); + if (!aProp.isValid()) + return false; + + assert(aProp.canConvert()); + return aProp.toBool(); +} + void QtInstanceButton::buttonClicked() { signal_clicked(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/QtInstanceCheckButton.cxx b/vcl/qt5/QtInstanceCheckButton.cxx index f30febec0120..11abffd33280 100644 --- a/vcl/qt5/QtInstanceCheckButton.cxx +++ b/vcl/qt5/QtInstanceCheckButton.cxx @@ -9,6 +9,8 @@ #include +#include + QtInstanceCheckButton::QtInstanceCheckButton(QCheckBox* pCheckBox) : QtInstanceWidget(pCheckBox) , m_pCheckBox(pCheckBox) diff --git a/vcl/qt5/QtInstanceComboBox.cxx b/vcl/qt5/QtInstanceComboBox.cxx new file mode 100644 index 000000000000..3915f2728c4a --- /dev/null +++ b/vcl/qt5/QtInstanceComboBox.cxx @@ -0,0 +1,357 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include + +#include + +#include + +QtInstanceComboBox::QtInstanceComboBox(QComboBox* pComboBox) + : QtInstanceWidget(pComboBox) + , m_pComboBox(pComboBox) + , m_bSorted(false) +{ + assert(pComboBox); + + QObject::connect(m_pComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, + &QtInstanceComboBox::handleCurrentIndexChanged); +} + +void QtInstanceComboBox::insert(int nPos, const OUString& rStr, const OUString* pId, + const OUString* pIconName, VirtualDevice* pImageSurface) +{ + if (pIconName || pImageSurface) + assert(false && "Handling for these not implemented yet"); + + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { + QVariant aUserData; + if (pId) + aUserData = QVariant::fromValue(toQString(*pId)); + + m_pComboBox->insertItem(nPos, toQString(rStr), aUserData); + if (m_bSorted) + sortItems(); + }); +} + +void QtInstanceComboBox::insert_vector(const std::vector& rItems, + bool bKeepExisting) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { + if (!bKeepExisting) + m_pComboBox->clear(); + + // if sorted, only sort once at the end + const bool bSorted = m_bSorted; + m_bSorted = false; + + for (const weld::ComboBoxEntry& rEntry : rItems) + { + const OUString* pId = rEntry.sId.isEmpty() ? nullptr : &rEntry.sId; + const OUString* pImage = rEntry.sImage.isEmpty() ? nullptr : &rEntry.sImage; + insert(m_pComboBox->count(), rEntry.sString, pId, pImage, nullptr); + } + + m_bSorted = bSorted; + if (m_bSorted) + sortItems(); + }); +} + +void QtInstanceComboBox::insert_separator(int nPos, const OUString&) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { + if (nPos == -1) + nPos = m_pComboBox->count(); + m_pComboBox->insertSeparator(nPos); + }); +} + +int QtInstanceComboBox::get_count() const +{ + SolarMutexGuard g; + int nCount; + GetQtInstance().RunInMainThread([&] { nCount = m_pComboBox->count(); }); + return nCount; +} + +void QtInstanceComboBox::make_sorted() +{ + SolarMutexGuard g; + m_bSorted = true; + GetQtInstance().RunInMainThread([&] { sortItems(); }); +} + +void QtInstanceComboBox::clear() +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pComboBox->clear(); }); +} + +int QtInstanceComboBox::get_active() const +{ + SolarMutexGuard g; + int nCurrentIndex; + GetQtInstance().RunInMainThread([&] { nCurrentIndex = m_pComboBox->currentIndex(); }); + return nCurrentIndex; +} + +void QtInstanceComboBox::set_active(int nPos) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pComboBox->setCurrentIndex(nPos); }); +} + +void QtInstanceComboBox::remove(int nPos) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pComboBox->removeItem(nPos); }); +} + +OUString QtInstanceComboBox::get_active_text() const +{ + SolarMutexGuard g; + OUString sCurrentText; + GetQtInstance().RunInMainThread([&] { sCurrentText = toOUString(m_pComboBox->currentText()); }); + return sCurrentText; +} + +OUString QtInstanceComboBox::get_text(int nPos) const +{ + SolarMutexGuard g; + OUString sItemText; + GetQtInstance().RunInMainThread([&] { sItemText = toOUString(m_pComboBox->itemText(nPos)); }); + return sItemText; +} + +int QtInstanceComboBox::find_text(const OUString& rStr) const +{ + SolarMutexGuard g; + int nIndex; + GetQtInstance().RunInMainThread([&] { nIndex = m_pComboBox->findText(toQString(rStr)); }); + return nIndex; +} + +OUString QtInstanceComboBox::get_active_id() const +{ + SolarMutexGuard g; + + OUString sId; + GetQtInstance().RunInMainThread([&] { + QVariant aUserData = m_pComboBox->currentData(); + if (aUserData.canConvert()) + sId = toOUString(aUserData.toString()); + }); + + return sId; +} + +void QtInstanceComboBox::set_active_id(const OUString& rId) +{ + SolarMutexGuard g; + + GetQtInstance().RunInMainThread([&] { + int nIndex = find_id(rId); + set_active(nIndex); + }); +} + +OUString QtInstanceComboBox::get_id(int nPos) const +{ + SolarMutexGuard g; + + OUString sId; + GetQtInstance().RunInMainThread([&] { + QVariant aUserData = m_pComboBox->itemData(nPos); + if (aUserData.canConvert()) + sId = toOUString(aUserData.toString()); + }); + + return sId; +} + +void QtInstanceComboBox::set_id(int nRow, const OUString& rId) +{ + SolarMutexGuard g; + + GetQtInstance().RunInMainThread([&] { + QVariant aUserData = QVariant::fromValue(toQString(rId)); + m_pComboBox->setItemData(nRow, aUserData); + }); +} + +int QtInstanceComboBox::find_id(const OUString& rId) const +{ + SolarMutexGuard g; + + int nIndex; + GetQtInstance().RunInMainThread([&] { + QVariant aUserData = toQString(rId); + nIndex = m_pComboBox->findData(aUserData); + }); + + return nIndex; +} + +bool QtInstanceComboBox::changed_by_direct_pick() const +{ + assert(false && "Not implemented yet"); + return false; +} + +bool QtInstanceComboBox::has_entry() const +{ + SolarMutexGuard g; + bool bEditable; + GetQtInstance().RunInMainThread([&] { bEditable = m_pComboBox->isEditable(); }); + return bEditable; +} + +void QtInstanceComboBox::set_entry_message_type(weld::EntryMessageType) +{ + assert(false && "Not implemented yet"); +} + +void QtInstanceComboBox::set_entry_text(const OUString& rStr) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pComboBox->setEditText(toQString(rStr)); }); +} + +void QtInstanceComboBox::set_entry_width_chars(int) { assert(false && "Not implemented yet"); } + +void QtInstanceComboBox::set_entry_max_length(int) { assert(false && "Not implemented yet"); } + +void QtInstanceComboBox::select_entry_region(int nStartPos, int nEndPos) +{ + SolarMutexGuard g; + + GetQtInstance().RunInMainThread([&] { + QLineEdit* pEdit = m_pComboBox->lineEdit(); + if (pEdit) + { + if (nEndPos == -1) + nEndPos = pEdit->text().length(); + + const int nLength = nEndPos - nStartPos; + pEdit->setSelection(nStartPos, nLength); + } + }); +} + +bool QtInstanceComboBox::get_entry_selection_bounds(int& rStartPos, int& rEndPos) +{ + SolarMutexGuard g; + + bool bHasSelection = false; + GetQtInstance().RunInMainThread([&] { + QLineEdit* pEdit = m_pComboBox->lineEdit(); + if (pEdit) + { + bHasSelection = pEdit->hasSelectedText(); + rStartPos = pEdit->selectionStart(); + rEndPos = pEdit->selectionEnd(); + } + }); + + return bHasSelection; +} + +void QtInstanceComboBox::set_entry_completion(bool, bool) +{ + assert(false && "Not implemented yet"); +} + +void QtInstanceComboBox::set_entry_placeholder_text(const OUString& rText) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pComboBox->setEditText(toQString(rText)); }); +} + +void QtInstanceComboBox::set_entry_editable(bool bEditable) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pComboBox->setEditable(bEditable); }); +} + +void QtInstanceComboBox::cut_entry_clipboard() { assert(false && "Not implemented yet"); } + +void QtInstanceComboBox::copy_entry_clipboard() { assert(false && "Not implemented yet"); } + +void QtInstanceComboBox::paste_entry_clipboard() { assert(false && "Not implemented yet"); } + +void QtInstanceComboBox::set_font(const vcl::Font&) { assert(false && "Not implemented yet"); } + +void QtInstanceComboBox::set_entry_font(const vcl::Font&) +{ + assert(false && "Not implemented yet"); +} + +vcl::Font QtInstanceComboBox::get_entry_font() +{ + assert(false && "Not implemented yet"); + return vcl::Font(); +} + +bool QtInstanceComboBox::get_popup_shown() const +{ + assert(false && "Not implemented yet"); + return false; +} + +void QtInstanceComboBox::set_custom_renderer(bool) { assert(false && "Not implemented yet"); } + +VclPtr QtInstanceComboBox::create_render_virtual_device() const +{ + assert(false && "Not implemented yet"); + return nullptr; +} + +void QtInstanceComboBox::set_item_menu(const OUString&, weld::Menu*) +{ + assert(false && "Not implemented yet"); +} + +int QtInstanceComboBox::get_menu_button_width() const +{ + assert(false && "Not implemented yet"); + return -1; +} + +int QtInstanceComboBox::get_max_mru_count() const +{ + assert(false && "Not implemented yet"); + return -1; +} + +void QtInstanceComboBox::set_max_mru_count(int) { assert(false && "Not implemented yet"); } + +OUString QtInstanceComboBox::get_mru_entries() const +{ + assert(false && "Not implemented yet"); + return OUString(); +} + +void QtInstanceComboBox::set_mru_entries(const OUString&) +{ + assert(false && "Not implemented yet"); +} + +void QtInstanceComboBox::set_max_drop_down_rows(int) { assert(false && "Not implemented yet"); } + +void QtInstanceComboBox::sortItems() { m_pComboBox->model()->sort(0, Qt::AscendingOrder); } + +void QtInstanceComboBox::handleCurrentIndexChanged() { signal_changed(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/QtInstanceDialog.cxx b/vcl/qt5/QtInstanceDialog.cxx index ef88d4e2e005..059a8fd5f6e5 100644 --- a/vcl/qt5/QtInstanceDialog.cxx +++ b/vcl/qt5/QtInstanceDialog.cxx @@ -10,6 +10,8 @@ #include #include +#include + #include const char* const QtInstanceDialog::PROPERTY_VCL_RESPONSE_CODE = "response-code"; @@ -146,8 +148,6 @@ void QtInstanceDialog::dialogFinished(int nResult) return; } - assert(m_aRunAsyncFunc); - disconnect(m_pDialog.get(), &QDialog::finished, this, &QtInstanceDialog::dialogFinished); // use local variables for these, as members might have got de-allocated by the time they're reset @@ -158,7 +158,8 @@ void QtInstanceDialog::dialogFinished(int nResult) m_xRunAsyncDialogController.reset(); m_xRunAsyncDialog.reset(); - aFunc(nResult); + if (aFunc) + aFunc(nResult); xRunAsyncDialogController.reset(); xRunAsyncDialog.reset(); @@ -174,6 +175,10 @@ void QtInstanceDialog::handleButtonClick(QDialog& rDialog, QAbstractButton& rBut return; } + // skip default handling if a custom click handler is set + if (QtInstanceButton::hasCustomClickHandler(rButton)) + return; + QVariant aResponseProperty = rButton.property(QtInstanceDialog::PROPERTY_VCL_RESPONSE_CODE); if (!aResponseProperty.isValid()) return; diff --git a/vcl/qt5/QtInstanceEntry.cxx b/vcl/qt5/QtInstanceEntry.cxx index f1ab7bf824fc..f1001cc834db 100644 --- a/vcl/qt5/QtInstanceEntry.cxx +++ b/vcl/qt5/QtInstanceEntry.cxx @@ -8,12 +8,19 @@ */ #include +#include + +#include QtInstanceEntry::QtInstanceEntry(QLineEdit* pLineEdit) : QtInstanceWidget(pLineEdit) , m_pLineEdit(pLineEdit) { assert(m_pLineEdit); + + QObject::connect(m_pLineEdit, &QLineEdit::cursorPositionChanged, this, + [&] { signal_cursor_position(); }); + QObject::connect(m_pLineEdit, &QLineEdit::textEdited, this, [&] { signal_changed(); }); } void QtInstanceEntry::set_text(const OUString& rText) diff --git a/vcl/qt5/QtInstanceFrame.cxx b/vcl/qt5/QtInstanceFrame.cxx new file mode 100644 index 000000000000..94ebc831d80f --- /dev/null +++ b/vcl/qt5/QtInstanceFrame.cxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include + +QtInstanceFrame::QtInstanceFrame(QGroupBox* pGroupBox) + : QtInstanceContainer(pGroupBox) +{ +} + +void QtInstanceFrame::set_label(const OUString& rText) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pGroupBox->setTitle(toQString(rText)); }); +} + +OUString QtInstanceFrame::get_label() const +{ + SolarMutexGuard g; + + OUString sLabel; + GetQtInstance().RunInMainThread([&] { sLabel = toOUString(m_pGroupBox->title()); }); + + return sLabel; +} + +std::unique_ptr QtInstanceFrame::weld_label_widget() const +{ + assert(false && "Not implemented yet"); + return nullptr; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/QtInstanceImage.cxx b/vcl/qt5/QtInstanceImage.cxx new file mode 100644 index 000000000000..ce63b3b03e50 --- /dev/null +++ b/vcl/qt5/QtInstanceImage.cxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include + +QtInstanceImage::QtInstanceImage(QLabel* pLabel) + : QtInstanceWidget(pLabel) + , m_pLabel(pLabel) +{ + assert(m_pLabel); +} + +void QtInstanceImage::set_from_icon_name(const OUString&) +{ + assert(false && "Not implemented yet"); +} + +void QtInstanceImage::set_image(VirtualDevice*) { assert(false && "Not implemented yet"); } + +void QtInstanceImage::set_image(const css::uno::Reference& rGraphic) +{ + m_pLabel->setPixmap(toQPixmap(rGraphic)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/QtInstanceLabel.cxx b/vcl/qt5/QtInstanceLabel.cxx index ce0947dc3227..4db763982644 100644 --- a/vcl/qt5/QtInstanceLabel.cxx +++ b/vcl/qt5/QtInstanceLabel.cxx @@ -9,6 +9,8 @@ #include +#include + QtInstanceLabel::QtInstanceLabel(QLabel* pLabel) : QtInstanceWidget(pLabel) , m_pLabel(pLabel) diff --git a/vcl/qt5/QtInstanceLinkButton.cxx b/vcl/qt5/QtInstanceLinkButton.cxx new file mode 100644 index 000000000000..c54b6d1801e5 --- /dev/null +++ b/vcl/qt5/QtInstanceLinkButton.cxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include + +#include + +#include + +QtInstanceLinkButton::QtInstanceLinkButton(QtHyperlinkLabel* pLabel) + : QtInstanceWidget(pLabel) + , m_pLabel(pLabel) +{ + assert(m_pLabel); + + connect(m_pLabel, &QtHyperlinkLabel::linkActivated, this, &QtInstanceLinkButton::linkActivated); +} + +void QtInstanceLinkButton::set_label(const OUString& rText) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pLabel->setDisplayText(toQString(rText)); }); +} + +OUString QtInstanceLinkButton::get_label() const +{ + SolarMutexGuard g; + OUString sLabel; + GetQtInstance().RunInMainThread([&] { sLabel = toOUString(m_pLabel->displayText()); }); + return sLabel; +} + +void QtInstanceLinkButton::set_label_wrap(bool) { assert(false && "Not implemented yet"); } + +void QtInstanceLinkButton::set_uri(const OUString& rUri) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pLabel->setUri(toQString(rUri)); }); +} + +OUString QtInstanceLinkButton::get_uri() const +{ + SolarMutexGuard g; + OUString sUri; + GetQtInstance().RunInMainThread([&] { sUri = toOUString(m_pLabel->uri()); }); + return sUri; +} + +void QtInstanceLinkButton::linkActivated(const QString& rUrl) +{ + if (signal_activate_link()) + return; + + QDesktopServices::openUrl(rUrl); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/QtInstanceMessageDialog.cxx b/vcl/qt5/QtInstanceMessageDialog.cxx index c2e80a146737..ed2c377258bb 100644 --- a/vcl/qt5/QtInstanceMessageDialog.cxx +++ b/vcl/qt5/QtInstanceMessageDialog.cxx @@ -10,6 +10,8 @@ #include #include +#include + #include QtInstanceMessageDialog::QtInstanceMessageDialog(QMessageBox* pMessageDialog) diff --git a/vcl/qt5/QtInstanceRadioButton.cxx b/vcl/qt5/QtInstanceRadioButton.cxx new file mode 100644 index 000000000000..8c5124aa2661 --- /dev/null +++ b/vcl/qt5/QtInstanceRadioButton.cxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include + +QtInstanceRadioButton::QtInstanceRadioButton(QRadioButton* pRadioButton) + : QtInstanceWidget(pRadioButton) + , m_pRadioButton(pRadioButton) +{ + assert(m_pRadioButton); +} + +void QtInstanceRadioButton::set_active(bool bActive) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pRadioButton->setChecked(bActive); }); +} + +bool QtInstanceRadioButton::get_active() const +{ + SolarMutexGuard g; + bool bActive; + GetQtInstance().RunInMainThread([&] { bActive = m_pRadioButton->isChecked(); }); + return bActive; +} + +void QtInstanceRadioButton::set_inconsistent(bool) { assert(false && "Not implemented yet"); } + +bool QtInstanceRadioButton::get_inconsistent() const +{ + assert(false && "Not implemented yet"); + return false; +} + +void QtInstanceRadioButton::set_label(const OUString& rText) +{ + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pRadioButton->setText(toQString(rText)); }); +} +OUString QtInstanceRadioButton::get_label() const +{ + SolarMutexGuard g; + OUString sLabel; + GetQtInstance().RunInMainThread([&] { sLabel = toOUString(m_pRadioButton->text()); }); + return sLabel; +} + +void QtInstanceRadioButton::QtInstanceRadioButton::set_label_wrap(bool /*bWrap*/) +{ + assert(false && "Not implemented yet"); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/QtInstanceTextView.cxx b/vcl/qt5/QtInstanceTextView.cxx index 60b50de721bf..50ae6dba76a2 100644 --- a/vcl/qt5/QtInstanceTextView.cxx +++ b/vcl/qt5/QtInstanceTextView.cxx @@ -9,6 +9,8 @@ #include +#include + #include QtInstanceTextView::QtInstanceTextView(QPlainTextEdit* pTextEdit) diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx index 3338fcb35c73..5f3590bd88d9 100644 --- a/vcl/qt5/QtInstanceWidget.cxx +++ b/vcl/qt5/QtInstanceWidget.cxx @@ -10,6 +10,7 @@ #include #include +#include /** Name of QObject property used for the help ID. */ const char* const PROPERTY_HELP_ID = "help-id"; @@ -186,7 +187,15 @@ void QtInstanceWidget::set_size_request(int, int) {} Size QtInstanceWidget::get_size_request() const { return Size(); } -Size QtInstanceWidget::get_preferred_size() const { return Size(); } +Size QtInstanceWidget::get_preferred_size() const +{ + SolarMutexGuard g; + + Size aPreferredSize; + GetQtInstance().RunInMainThread([&] { aPreferredSize = toSize(m_pWidget->sizeHint()); }); + + return aPreferredSize; +} float QtInstanceWidget::get_approximate_digit_width() const { return 1.0; } diff --git a/vcl/qt5/QtInstanceWindow.cxx b/vcl/qt5/QtInstanceWindow.cxx index 63f27bad055c..a915dd373131 100644 --- a/vcl/qt5/QtInstanceWindow.cxx +++ b/vcl/qt5/QtInstanceWindow.cxx @@ -9,6 +9,8 @@ #include +#include + QtInstanceWindow::QtInstanceWindow(QWidget* pWidget) : QtInstanceContainer(pWidget) { diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx index b0d4ca9841af..49cabbbc4548 100644 --- a/vcl/qt5/QtMenu.cxx +++ b/vcl/qt5/QtMenu.cxx @@ -38,6 +38,7 @@ #include #include +#include #include #include diff --git a/vcl/qt5/QtTools.cxx b/vcl/qt5/QtTools.cxx index e1eb3d1d8bce..758264fea3c4 100644 --- a/vcl/qt5/QtTools.cxx +++ b/vcl/qt5/QtTools.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/vcl/qt5/QtTransferable.cxx b/vcl/qt5/QtTransferable.cxx index 095ba9ec6836..509bcf6bc684 100644 --- a/vcl/qt5/QtTransferable.cxx +++ b/vcl/qt5/QtTransferable.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index 77dda53eb6da..d099ec36b417 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include diff --git a/vcl/qt6/QtHyperlinkLabel.cxx b/vcl/qt6/QtHyperlinkLabel.cxx new file mode 100644 index 000000000000..4b518036813b --- /dev/null +++ b/vcl/qt6/QtHyperlinkLabel.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtHyperlinkLabel.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt6/QtInstanceComboBox.cxx b/vcl/qt6/QtInstanceComboBox.cxx new file mode 100644 index 000000000000..05a6f06c2cb6 --- /dev/null +++ b/vcl/qt6/QtInstanceComboBox.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtInstanceComboBox.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt6/QtInstanceFrame.cxx b/vcl/qt6/QtInstanceFrame.cxx new file mode 100644 index 000000000000..a620a15ca58b --- /dev/null +++ b/vcl/qt6/QtInstanceFrame.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtInstanceFrame.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt6/QtInstanceImage.cxx b/vcl/qt6/QtInstanceImage.cxx new file mode 100644 index 000000000000..4f3779f4ab86 --- /dev/null +++ b/vcl/qt6/QtInstanceImage.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtInstanceImage.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt6/QtInstanceLinkButton.cxx b/vcl/qt6/QtInstanceLinkButton.cxx new file mode 100644 index 000000000000..5cf866815511 --- /dev/null +++ b/vcl/qt6/QtInstanceLinkButton.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtInstanceLinkButton.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt6/QtInstanceRadioButton.cxx b/vcl/qt6/QtInstanceRadioButton.cxx new file mode 100644 index 000000000000..f4e3c36ac474 --- /dev/null +++ b/vcl/qt6/QtInstanceRadioButton.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "../qt5/QtInstanceRadioButton.cxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 115ca04b8f30..6673a6fd6824 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -331,12 +331,11 @@ void AquaSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) #ifdef MACOSX -bool AquaSalGraphics::ShouldDownscaleIconsAtSurface(double* pScaleOut) const +bool AquaSalGraphics::ShouldDownscaleIconsAtSurface(double& rScaleOut) const { if (comphelper::LibreOfficeKit::isActive()) - return SalGraphics::ShouldDownscaleIconsAtSurface(pScaleOut); - if (pScaleOut) - *pScaleOut = sal::aqua::getWindowScaling(); + return SalGraphics::ShouldDownscaleIconsAtSurface(rScaleOut); + rScaleOut = sal::aqua::getWindowScaling(); return true; } diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 83b9fd6810c6..f6c7d21374bf 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 2372a380937c..26c398c3f063 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -2710,55 +2710,6 @@ bool MiscSettings::GetDisablePrinting() const bool MiscSettings::GetEnableATToolSupport() const { - -#ifdef _WIN32 - if( mxData->mnEnableATT == TRISTATE_INDET ) - { - // Check in the Windows registry if an AT tool wants Accessibility support to - // be activated .. - HKEY hkey; - - if( ERROR_SUCCESS == RegOpenKeyW(HKEY_CURRENT_USER, - L"Software\\LibreOffice\\Accessibility\\AtToolSupport", - &hkey) ) - { - DWORD dwType; - wchar_t Data[6]; // possible values: "true", "false", "1", "0", DWORD - DWORD cbData = sizeof(Data); - - if( ERROR_SUCCESS == RegQueryValueExW(hkey, L"SupportAssistiveTechnology", - nullptr, &dwType, reinterpret_cast(Data), &cbData) ) - { - switch (dwType) - { - case REG_SZ: - mxData->mnEnableATT = ((0 == wcsicmp(Data, L"1")) || (0 == wcsicmp(Data, L"true"))) ? TRISTATE_TRUE : TRISTATE_FALSE; - break; - case REG_DWORD: - switch (reinterpret_cast(Data)[0]) { - case 0: - mxData->mnEnableATT = TRISTATE_FALSE; - break; - case 1: - mxData->mnEnableATT = TRISTATE_TRUE; - break; - default: - mxData->mnEnableATT = TRISTATE_INDET; - //TODO: or TRISTATE_TRUE? - break; - } - break; - default: - // Unsupported registry type - break; - } - } - - RegCloseKey(hkey); - } - } -#endif - if( mxData->mnEnableATT == TRISTATE_INDET ) { static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" ); @@ -2784,49 +2735,13 @@ void MiscSettings::SetEnableATToolSupport( bool bEnable ) { if ( (bEnable ? TRISTATE_TRUE : TRISTATE_FALSE) != mxData->mnEnableATT ) { - if( bEnable && !ImplInitAccessBridge() ) - return; + if (bEnable) + ImplInitAccessBridge(); mxData->mnEnableATT = bEnable ? TRISTATE_TRUE : TRISTATE_FALSE; if (o3tl::IsRunningUnitTest()) - return; // No registry changing; no SettingsConfigItem modification - - HKEY hkey; - - // If the accessibility key in the Windows registry exists, change it synchronously - if( ERROR_SUCCESS == RegOpenKeyW(HKEY_CURRENT_USER, - L"Software\\LibreOffice\\Accessibility\\AtToolSupport", - &hkey) ) - { - DWORD dwType; - wchar_t Data[6]; // possible values: "true", "false", 1, 0 - DWORD cbData = sizeof(Data); - - if( ERROR_SUCCESS == RegQueryValueExW(hkey, L"SupportAssistiveTechnology", - nullptr, &dwType, reinterpret_cast(Data), &cbData) ) - { - switch (dwType) - { - case REG_SZ: - RegSetValueExW(hkey, L"SupportAssistiveTechnology", - 0, dwType, - reinterpret_cast(bEnable ? L"true" : L"false"), - bEnable ? sizeof(L"true") : sizeof(L"false")); - break; - case REG_DWORD: - reinterpret_cast(Data)[0] = bEnable ? 1 : 0; - RegSetValueExW(hkey, L"SupportAssistiveTechnology", - 0, dwType, reinterpret_cast(Data), sizeof(DWORD)); - break; - default: - // Unsupported registry type - break; - } - } - - RegCloseKey(hkey); - } + return; // no SettingsConfigItem modification vcl::SettingsConfigItem::get()-> setValue( "Accessibility", diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index debd5ec920ff..819fdaf729d7 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1634,25 +1634,11 @@ void Application::AddToRecentDocumentList(const OUString& rFileUrl, const OUStri pSVData->mpDefInst->AddToRecentDocumentList(rFileUrl, rMimeType, rDocumentService); } -bool InitAccessBridge() +void InitAccessBridge() { -// Disable MSAA bridge on UNIX -#if defined UNX - return true; -#else - bool bRet = ImplInitAccessBridge(); - - if( !bRet ) - { - // disable accessibility if the user chooses to continue - AllSettings aSettings = Application::GetSettings(); - MiscSettings aMisc = aSettings.GetMiscSettings(); - aMisc.SetEnableATToolSupport( false ); - aSettings.SetMiscSettings( aMisc ); - Application::SetSettings( aSettings ); - } - return bRet; -#endif // !UNX +#ifdef _WIN32 + ImplInitAccessBridge(); +#endif } // MT: AppEvent was in oldsv.cxx, but is still needed... diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index b48fc6695a3a..6f0732ef498c 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -330,7 +330,7 @@ BlendFrameCache* ImplGetBlendFrameCache() } #ifdef _WIN32 -bool ImplInitAccessBridge() +void ImplInitAccessBridge() { ImplSVData* pSVData = ImplGetSVData(); if( ! pSVData->mxAccessBridge.is() ) @@ -340,16 +340,13 @@ bool ImplInitAccessBridge() { pSVData->mxAccessBridge = css::accessibility::MSAAService::create(xContext); SAL_INFO("vcl", "got IAccessible2 bridge"); - return true; } catch (css::uno::DeploymentException &) { TOOLS_WARN_EXCEPTION("vcl", "got no IAccessible2 bridge"); - return false; + assert(false && "failed to create IAccessible2 bridge"); } } - - return true; } #endif diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 47df58d33965..a8a2412aa810 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include @@ -468,7 +468,7 @@ void DeInitVCL() // Some events may need to access objects destroyed in ImplDeleteOnDeInit, so process them first Scheduler::ProcessEventsToIdle(); - vcl::DeleteOnDeinitBase::ImplDeleteOnDeInit(); + tools::DeleteOnDeinitBase::ImplDeleteOnDeInit(); #if OSL_DEBUG_LEVEL > 0 OStringBuffer aBuf( 256 ); diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx index 96d08f38a600..2bd03eaead81 100644 --- a/vcl/source/app/weldutils.cxx +++ b/vcl/source/app/weldutils.cxx @@ -500,7 +500,7 @@ WidgetStatusListener::WidgetStatusListener(weld::Widget* widget, const OUString& if (!xFrame.is()) xFrame = xDesktop; - mxFrame = xFrame; + mxFrame = std::move(xFrame); maCommandURL.Complete = aCommand; css::uno::Reference xParser diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx index 5551280c7aca..ec8f5569ecab 100644 --- a/vcl/source/control/fmtfield.cxx +++ b/vcl/source/control/fmtfield.cxx @@ -306,7 +306,7 @@ void Formatter::SetTextFormatted(const OUString& rStr) if( IsUsingInputStringForFormatting() && GetOrCreateFormatter()->IsNumberFormat(m_sCurrentTextValue, nTempFormatKey, dNumber) ) { - GetOrCreateFormatter()->GetInputLineString(dNumber, m_nFormatKey, sFormatted); + sFormatted = GetOrCreateFormatter()->GetInputLineString(dNumber, m_nFormatKey); } else { @@ -774,7 +774,7 @@ void Formatter::ImplSetValue(double dVal, bool bForce) { if( IsUsingInputStringForFormatting()) { - GetOrCreateFormatter()->GetInputLineString(dVal, m_nFormatKey, sNewText); + sNewText = GetOrCreateFormatter()->GetInputLineString(dVal, m_nFormatKey); } else { diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx index 0f6f59385ddb..c2c12162dfdc 100644 --- a/vcl/source/control/imivctl1.cxx +++ b/vcl/source/control/imivctl1.cxx @@ -624,14 +624,8 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) case KEY_ADD: case KEY_DIVIDE : case KEY_A: - bKeyUsed = false; - break; - case KEY_SUBTRACT: case KEY_COMMA : - bKeyUsed = false; - break; - case KEY_RETURN: bKeyUsed = false; break; diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 0f09428e6c0c..ecd506a42548 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -186,94 +186,90 @@ ErrCode GraphicFilter::ImpTestOrFindFormat( std::u16string_view rPath, SvStream& static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& rConfigItem ) { - Graphic aGraphic; + if ( rGraphic.GetType() == GraphicType::NONE ) + return rGraphic; sal_Int32 nLogicalWidth = rConfigItem.ReadInt32( u"LogicalWidth"_ustr, 0 ); sal_Int32 nLogicalHeight = rConfigItem.ReadInt32( u"LogicalHeight"_ustr, 0 ); + sal_Int32 nMode = rConfigItem.ReadInt32( u"ExportMode"_ustr, -1 ); + if ( nMode == -1 ) // the property is not there, this is possible, if the graphic filter + { // is called via UnoGraphicExporter and not from a graphic export Dialog + nMode = 0; // then we are defaulting this mode to 0 + if ( nLogicalWidth || nLogicalHeight ) + nMode = 2; + } - if ( rGraphic.GetType() != GraphicType::NONE ) + Graphic aGraphic; + Size aPrefSize( rGraphic.GetPrefSize() ); + Size aOriginalSize; + MapMode aPrefMapMode( rGraphic.GetPrefMapMode() ); + if (aPrefMapMode.GetMapUnit() == MapUnit::MapPixel) + aOriginalSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MapMode(MapUnit::Map100thMM)); + else + aOriginalSize = OutputDevice::LogicToLogic(aPrefSize, aPrefMapMode, MapMode(MapUnit::Map100thMM)); + if ( !nLogicalWidth ) + nLogicalWidth = aOriginalSize.Width(); + if ( !nLogicalHeight ) + nLogicalHeight = aOriginalSize.Height(); + + if( rGraphic.GetType() == GraphicType::Bitmap ) { - sal_Int32 nMode = rConfigItem.ReadInt32( u"ExportMode"_ustr, -1 ); - if ( nMode == -1 ) // the property is not there, this is possible, if the graphic filter - { // is called via UnoGraphicExporter and not from a graphic export Dialog - nMode = 0; // then we are defaulting this mode to 0 - if ( nLogicalWidth || nLogicalHeight ) - nMode = 2; - } - - Size aOriginalSize; - Size aPrefSize( rGraphic.GetPrefSize() ); - MapMode aPrefMapMode( rGraphic.GetPrefMapMode() ); - if (aPrefMapMode.GetMapUnit() == MapUnit::MapPixel) - aOriginalSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MapMode(MapUnit::Map100thMM)); - else - aOriginalSize = OutputDevice::LogicToLogic(aPrefSize, aPrefMapMode, MapMode(MapUnit::Map100thMM)); - if ( !nLogicalWidth ) - nLogicalWidth = aOriginalSize.Width(); - if ( !nLogicalHeight ) - nLogicalHeight = aOriginalSize.Height(); - if( rGraphic.GetType() == GraphicType::Bitmap ) + // Resolution is set + if( nMode == 1 ) { + BitmapEx aBitmap( rGraphic.GetBitmapEx() ); + MapMode aMap( MapUnit::Map100thInch ); - // Resolution is set - if( nMode == 1 ) - { - BitmapEx aBitmap( rGraphic.GetBitmapEx() ); - MapMode aMap( MapUnit::Map100thInch ); + sal_Int32 nDPI = rConfigItem.ReadInt32( u"Resolution"_ustr, 75 ); + Fraction aFrac( 1, std::clamp( nDPI, sal_Int32(75), sal_Int32(600) ) ); - sal_Int32 nDPI = rConfigItem.ReadInt32( u"Resolution"_ustr, 75 ); - Fraction aFrac( 1, std::clamp( nDPI, sal_Int32(75), sal_Int32(600) ) ); + aMap.SetScaleX( aFrac ); + aMap.SetScaleY( aFrac ); - aMap.SetScaleX( aFrac ); - aMap.SetScaleY( aFrac ); - - Size aOldSize = aBitmap.GetSizePixel(); - aGraphic = rGraphic; - aGraphic.SetPrefMapMode( aMap ); - aGraphic.SetPrefSize( Size( aOldSize.Width() * 100, - aOldSize.Height() * 100 ) ); - } - // Size is set - else if( nMode == 2 ) - { - aGraphic = rGraphic; - aGraphic.SetPrefMapMode( MapMode( MapUnit::Map100thMM ) ); - aGraphic.SetPrefSize( Size( nLogicalWidth, nLogicalHeight ) ); - } - else - aGraphic = rGraphic; - - sal_Int32 nColors = rConfigItem.ReadInt32( u"Color"_ustr, 0 ); - if ( nColors ) // graphic conversion necessary ? - { - BitmapEx aBmpEx( aGraphic.GetBitmapEx() ); - aBmpEx.Convert( static_cast(nColors) ); // the entries in the xml section have the same meaning as - aGraphic = aBmpEx; // they have in the BmpConversion enum, so it should be - } // allowed to cast them + Size aOldSize = aBitmap.GetSizePixel(); + aGraphic = rGraphic; + aGraphic.SetPrefMapMode( aMap ); + aGraphic.SetPrefSize( Size( aOldSize.Width() * 100, + aOldSize.Height() * 100 ) ); + } + // Size is set + else if( nMode == 2 ) + { + aGraphic = rGraphic; + aGraphic.SetPrefMapMode( MapMode( MapUnit::Map100thMM ) ); + aGraphic.SetPrefSize( Size( nLogicalWidth, nLogicalHeight ) ); } else + aGraphic = rGraphic; + + sal_Int32 nColors = rConfigItem.ReadInt32( u"Color"_ustr, 0 ); + if ( nColors ) // graphic conversion necessary ? { - if( ( nMode == 1 ) || ( nMode == 2 ) ) - { - GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() ); - Size aNewSize( OutputDevice::LogicToLogic(Size(nLogicalWidth, nLogicalHeight), MapMode(MapUnit::Map100thMM), aMtf.GetPrefMapMode()) ); - - if( aNewSize.Width() && aNewSize.Height() ) - { - const Size aPreferredSize( aMtf.GetPrefSize() ); - aMtf.Scale( Fraction( aNewSize.Width(), aPreferredSize.Width() ), - Fraction( aNewSize.Height(), aPreferredSize.Height() ) ); - } - aGraphic = Graphic( aMtf ); - } - else - aGraphic = rGraphic; - } - + BitmapEx aBmpEx( aGraphic.GetBitmapEx() ); + aBmpEx.Convert( static_cast(nColors) ); // the entries in the xml section have the same meaning as + aGraphic = aBmpEx; // they have in the BmpConversion enum, so it should be + } // allowed to cast them } else - aGraphic = rGraphic; + { + if( ( nMode == 1 ) || ( nMode == 2 ) ) + { + GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() ); + Size aNewSize( OutputDevice::LogicToLogic(Size(nLogicalWidth, nLogicalHeight), MapMode(MapUnit::Map100thMM), aMtf.GetPrefMapMode()) ); + + if( aNewSize.Width() && aNewSize.Height() ) + { + const Size aPreferredSize( aMtf.GetPrefSize() ); + aMtf.Scale( Fraction( aNewSize.Width(), aPreferredSize.Width() ), + Fraction( aNewSize.Height(), aPreferredSize.Height() ) ); + } + aGraphic = Graphic( aMtf ); + } + else + aGraphic = rGraphic; + } + return aGraphic; } diff --git a/vcl/source/filter/png/PngImageWriter.cxx b/vcl/source/filter/png/PngImageWriter.cxx index f2b7ac038b34..54334469f65e 100644 --- a/vcl/source/filter/png/PngImageWriter.cxx +++ b/vcl/source/filter/png/PngImageWriter.cxx @@ -142,6 +142,10 @@ static bool pngWrite(SvStream& rStream, const Graphic& rGraphic, int nCompressio return false; } + basegfx::B2DSize const aPPM = rGraphic.GetPPM(); + png_set_pHYs(pPng, pInfo, std::round(aPPM.getWidth()), std::round(aPPM.getHeight()), + PNG_RESOLUTION_METER); + BitmapEx aBitmapEx; if (rGraphic.GetBitmapEx().getPixelFormat() == vcl::PixelFormat::N32_BPP) { diff --git a/vcl/source/gdi/formpdfexport.cxx b/vcl/source/gdi/formpdfexport.cxx index 1d0151c98d4c..7a2f253e5dc1 100644 --- a/vcl/source/gdi/formpdfexport.cxx +++ b/vcl/source/gdi/formpdfexport.cxx @@ -217,7 +217,7 @@ namespace toolkitform { // step down the hierarchy aAncestors.push_back( xCurrentContainer ); - xCurrentContainer = xNewContainer; + xCurrentContainer = std::move(xNewContainer); aPath.push_back( i ); nStartWithChild = 0; break; diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index f90adeb24703..803ec4589680 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include #include #include #include @@ -381,30 +384,24 @@ void Graphic::SetPrefMapMode( const MapMode& rPrefMapMode ) mxImpGraphic->setPrefMapMode( rPrefMapMode ); } -basegfx::B2DSize Graphic::GetPPI() const +basegfx::B2DSize Graphic::GetPPUnit(const MapMode& unit) const { - double nGrfDPIx; - double nGrfDPIy; - - const MapMode aGrfMap(GetPrefMapMode()); - const Size aGrfPixelSize(GetSizePixel()); const Size aGrfPrefMapModeSize(GetPrefSize()); - if (aGrfMap.GetMapUnit() == MapUnit::MapInch) - { - nGrfDPIx = aGrfPixelSize.Width() / ( static_cast(aGrfMap.GetScaleX()) * aGrfPrefMapModeSize.Width() ); - nGrfDPIy = aGrfPixelSize.Height() / ( static_cast(aGrfMap.GetScaleY()) * aGrfPrefMapModeSize.Height() ); - } - else - { - const Size aGrf1000thInchSize = OutputDevice::LogicToLogic( - aGrfPrefMapModeSize, aGrfMap, MapMode(MapUnit::Map1000thInch)); - nGrfDPIx = aGrf1000thInchSize.Width() == 0 - ? 0.0 : 1000.0 * aGrfPixelSize.Width() / aGrf1000thInchSize.Width(); - nGrfDPIy = aGrf1000thInchSize.Height() == 0 - ? 0.0 : 1000.0 * aGrfPixelSize.Height() / aGrf1000thInchSize.Height(); - } + if (aGrfPrefMapModeSize.IsEmpty()) + return {}; + const Size aGrfPixelSize(GetSizePixel()); + basegfx::B2DHomMatrix toPixels = basegfx::utils::createScaleB2DHomMatrix( + double(aGrfPixelSize.Width()) / aGrfPrefMapModeSize.Width(), + double(aGrfPixelSize.Height()) / aGrfPrefMapModeSize.Height()); + toPixels *= OutputDevice::LogicToLogic(unit, GetPrefMapMode()); + return toPixels * basegfx::B2DSize(1, 1); +} - return basegfx::B2DSize(nGrfDPIx, nGrfDPIy); +basegfx::B2DSize Graphic::GetPPI() const { return GetPPUnit(MapMode(MapUnit::MapInch)); } + +basegfx::B2DSize Graphic::GetPPM() const +{ + return GetPPUnit(MapMode(MapUnit::MapMM, {}, { 1000, 1 }, { 1000, 1 })); } Size Graphic::GetSizePixel( const OutputDevice* pRefDevice ) const diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx index 946230a51762..6001ccd0236b 100644 --- a/vcl/source/gdi/impglyphitem.cxx +++ b/vcl/source/gdi/impglyphitem.cxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -234,7 +234,7 @@ void SalLayoutGlyphsCache::clear() { mCachedGlyphs.clear(); } SalLayoutGlyphsCache* SalLayoutGlyphsCache::self() { - static vcl::DeleteOnDeinit cache( + static tools::DeleteOnDeinit cache( !comphelper::IsFuzzing() ? officecfg::Office::Common::Cache::Font::GlyphsCacheSize::get() : 20000000); return cache.get(); diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 12c98cc72937..a2ef1f30f4a3 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -1055,11 +1055,6 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa break; case MetaActionType::RASTEROP: - { - // !!! >>> we don't want to support this actions - } - break; - case MetaActionType::REFPOINT: { // !!! >>> we don't want to support this actions diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 2654b211a2ac..14dd62104fe3 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -917,10 +917,9 @@ OUString SalGraphics::getRenderBackendName() const return OUString(); } -bool SalGraphics::ShouldDownscaleIconsAtSurface(double* pScaleOut) const +bool SalGraphics::ShouldDownscaleIconsAtSurface(double& rScaleOut) const { - if (pScaleOut) - *pScaleOut = comphelper::LibreOfficeKit::getDPIScale(); + rScaleOut = comphelper::LibreOfficeKit::getDPIScale(); return comphelper::LibreOfficeKit::isActive(); } diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx index 9960f67e1008..6485a832841f 100644 --- a/vcl/source/helper/strhelper.cxx +++ b/vcl/source/helper/strhelper.cxx @@ -266,7 +266,7 @@ OUString WhitespaceToSpace( std::u16string_view rLine ) while( pRun != pEnd ) { - if( pRun != pEnd && isSpace( *pRun ) ) + if( isSpace( *pRun ) ) { *pLeap = ' '; pLeap++; @@ -326,7 +326,7 @@ OString WhitespaceToSpace(std::string_view rLine) while( pRun != pEnd ) { - if( pRun != pEnd && isSpace( *pRun ) ) + if( isSpace( *pRun ) ) { *pLeap = ' '; pLeap++; diff --git a/vcl/source/image/ImplImage.cxx b/vcl/source/image/ImplImage.cxx index fa469bc20e69..08bc9c64a836 100644 --- a/vcl/source/image/ImplImage.cxx +++ b/vcl/source/image/ImplImage.cxx @@ -68,7 +68,7 @@ bool ImplImage::loadStockAtScale(SalGraphics* pGraphics, BitmapEx &rBitmapEx) if (aIconTheme.endsWith("_svg")) { #endif - if (pGraphics && pGraphics->ShouldDownscaleIconsAtSurface(&fScale)) // scale at the surface + if (pGraphics && pGraphics->ShouldDownscaleIconsAtSurface(fScale)) // scale at the surface { nScalePercentage = fScale * 100.0; eScalingFlags = ImageLoadFlags::IgnoreScalingFactor; @@ -164,7 +164,7 @@ BitmapEx const & ImplImage::getBitmapExForHiDPI(bool bDisabled, SalGraphics* pGr if ((isStock() || mxMetaFile) && pGraphics) { // check we have the right bitmap cached. double fScale = 1.0; - pGraphics->ShouldDownscaleIconsAtSurface(&fScale); + pGraphics->ShouldDownscaleIconsAtSurface(fScale); Size aTarget(maSizePixel.Width()*fScale, maSizePixel.Height()*fScale); if (maBitmapEx.GetSizePixel() != aTarget) diff --git a/vcl/source/opengl/x11/context.cxx b/vcl/source/opengl/x11/context.cxx index 93125f91085a..73dfbaf8cd8f 100644 --- a/vcl/source/opengl/x11/context.cxx +++ b/vcl/source/opengl/x11/context.cxx @@ -8,7 +8,7 @@ */ #include -#include +#include #include #include diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index f54f231f5700..1a23db131a77 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -162,7 +162,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize, // but hidpi surfaces like the cairo one have their own scale, so don't downscale // past the surface scaling which can retain the extra detail double fScale(1.0); - if (mpGraphics->ShouldDownscaleIconsAtSurface(&fScale)) + if (mpGraphics->ShouldDownscaleIconsAtSurface(fScale)) { nScaleX *= fScale; nScaleY *= fScale; diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 334f6a311eb0..45b773a20c01 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -462,9 +462,6 @@ vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLan { case DefaultFontType::SANS_UNICODE: case DefaultFontType::UI_SANS: - aFont.SetFamily( FAMILY_SWISS ); - break; - case DefaultFontType::SANS: case DefaultFontType::LATIN_HEADING: case DefaultFontType::LATIN_SPREADSHEET: @@ -494,9 +491,6 @@ vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLan case DefaultFontType::CJK_SPREADSHEET: case DefaultFontType::CJK_HEADING: case DefaultFontType::CJK_DISPLAY: - aFont.SetFamily( FAMILY_SYSTEM ); // don't care, but don't use font subst config later... - break; - case DefaultFontType::CTL_TEXT: case DefaultFontType::CTL_PRESENTATION: case DefaultFontType::CTL_SPREADSHEET: diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index b2ca6382bfac..f177efab6cdb 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include @@ -788,7 +788,7 @@ com::sun::star::uno::Reference< css::rendering::XCanvas > OutputDevice::ImplGetC Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); - static vcl::DeleteUnoReferenceOnDeinit xStaticCanvasFactory( + static tools::DeleteUnoReferenceOnDeinit xStaticCanvasFactory( css::rendering::CanvasFactory::create( xContext ) ); Reference xCanvasFactory(xStaticCanvasFactory.get()); Reference< css::rendering::XCanvas > xCanvas; diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index 20315c6c6aaa..42ffa0613aa2 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -1051,7 +1051,7 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, const Point& rEndPos, to if ( fOrientation == 0.0 ) { - static vcl::DeleteOnDeinit< WavyLineCache > snLineCache {}; + static tools::DeleteOnDeinit< WavyLineCache > snLineCache {}; if ( !snLineCache.get() ) return; WavyLineCache& rLineCache = *snLineCache.get(); diff --git a/vcl/source/text/TextLayoutCache.cxx b/vcl/source/text/TextLayoutCache.cxx index 414ab29f895a..3e3571dfc861 100644 --- a/vcl/source/text/TextLayoutCache.cxx +++ b/vcl/source/text/TextLayoutCache.cxx @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include namespace vcl::text @@ -55,7 +55,7 @@ std::shared_ptr TextLayoutCache::Create(OUString const& r typedef o3tl::lru_map, FirstCharsStringHash, FastStringCompareEqual, TextLayoutCacheCost> Cache; - static vcl::DeleteOnDeinit cache( + static tools::DeleteOnDeinit cache( !comphelper::IsFuzzing() ? officecfg::Office::Common::Cache::Font::TextRunsCacheSize::get() : 100); if (Cache* map = cache.get()) diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index 3008488b5d4f..985a7525c44c 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -2400,6 +2400,7 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) ExpandAll(); break; + case KEY_DIVIDE : case KEY_A: if( bMod1 ) SelAllDestrAnch( true ); @@ -2437,13 +2438,6 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) bKeyUsed = false; break; - case KEY_DIVIDE : - if( bMod1 ) - SelAllDestrAnch( true ); - else - bKeyUsed = false; - break; - case KEY_COMMA : if( bMod1 ) SelAllDestrAnch( false ); diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index 0fbe9304d0d1..150f3ccbfb57 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -2204,7 +2204,7 @@ TransferableDataHelper TransferableDataHelper::CreateFromPrimarySelection() if( xTransferable.is() ) { aRet = TransferableDataHelper( xTransferable ); - aRet.mxClipboard = xSelection; + aRet.mxClipboard = std::move(xSelection); } } catch( const css::uno::Exception& ) diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 0320715b7a02..c54014053d85 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -972,18 +972,6 @@ namespace return bCloseable; } - bool extractEntry(VclBuilder::stringmap &rMap) - { - bool bHasEntry = false; - VclBuilder::stringmap::iterator aFind = rMap.find(u"has-entry"_ustr); - if (aFind != rMap.end()) - { - bHasEntry = toBool(aFind->second); - rMap.erase(aFind); - } - return bHasEntry; - } - bool extractVerticalTabPos(VclBuilder::stringmap &rMap) { bool bVertical = false; @@ -1297,18 +1285,6 @@ bool VclBuilder::extractAdjustmentToMap(const OUString& id, VclBuilder::stringma namespace { - sal_Int32 extractActive(VclBuilder::stringmap &rMap) - { - sal_Int32 nActiveId = 0; - VclBuilder::stringmap::iterator aFind = rMap.find(u"active"_ustr); - if (aFind != rMap.end()) - { - nActiveId = aFind->second.toInt32(); - rMap.erase(aFind); - } - return nActiveId; - } - bool extractSelectable(VclBuilder::stringmap &rMap) { bool bSelectable = false; @@ -3507,7 +3483,7 @@ template static bool insertItems(vcl::Window *pWindow, VclBuilder::s if (!pContainer) return false; - sal_uInt16 nActiveId = extractActive(rMap); + sal_uInt16 nActiveId = BuilderBase::extractActive(rMap); for (auto const& item : rItems) { sal_Int32 nPos = pContainer->InsertEntry(item.m_sItem); @@ -3766,7 +3742,29 @@ bool BuilderBase::hasOrientationVertical(VclBuilder::stringmap &rMap) return bVertical; } +sal_Int32 BuilderBase::extractActive(VclBuilder::stringmap& rMap) +{ + sal_Int32 nActiveId = 0; + VclBuilder::stringmap::iterator aFind = rMap.find(u"active"_ustr); + if (aFind != rMap.end()) + { + nActiveId = aFind->second.toInt32(); + rMap.erase(aFind); + } + return nActiveId; +} +bool BuilderBase::extractEntry(VclBuilder::stringmap &rMap) +{ + bool bHasEntry = false; + VclBuilder::stringmap::iterator aFind = rMap.find(u"has-entry"_ustr); + if (aFind != rMap.end()) + { + bHasEntry = toBool(aFind->second); + rMap.erase(aFind); + } + return bHasEntry; +} bool BuilderBase::extractVisible(VclBuilder::stringmap& rMap) { diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx index d25e2b677e36..adb82ad575c3 100644 --- a/vcl/source/window/split.cxx +++ b/vcl/source/window/split.cxx @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include @@ -35,12 +35,12 @@ namespace { Wallpaper& ImplBlackWall() { - static vcl::DeleteOnDeinit< Wallpaper > SINGLETON(COL_BLACK); + static tools::DeleteOnDeinit< Wallpaper > SINGLETON(COL_BLACK); return *SINGLETON.get(); } Wallpaper& ImplWhiteWall() { - static vcl::DeleteOnDeinit< Wallpaper > SINGLETON(COL_LIGHTGRAY); + static tools::DeleteOnDeinit< Wallpaper > SINGLETON(COL_LIGHTGRAY); return *SINGLETON.get(); } } diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index 26dfabf09beb..2e48a7282870 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -1238,15 +1238,11 @@ Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize ) switch ( meAlign ) { case WindowAlign::Top: - aSize.AdjustHeight(nDelta ); - break; case WindowAlign::Bottom: aSize.AdjustHeight(nDelta ); break; - case WindowAlign::Left: - aSize.AdjustWidth(nDelta ); - break; case WindowAlign::Right: + case WindowAlign::Left: default: aSize.AdjustWidth(nDelta ); break; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 10db9fd7a3d2..8cde4c668112 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -3747,7 +3747,7 @@ Reference< css::rendering::XCanvas > WindowOutputDevice::ImplGetCanvas( bool bSp // Create canvas instance with window handle - static vcl::DeleteUnoReferenceOnDeinit xStaticCanvasFactory( + static tools::DeleteUnoReferenceOnDeinit xStaticCanvasFactory( css::rendering::CanvasFactory::create( xContext ) ); Reference xCanvasFactory(xStaticCanvasFactory.get()); Reference< css::rendering::XCanvas > xCanvas; diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index 600276791e69..87a05a95e0cd 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -5226,20 +5226,18 @@ gboolean GtkInstDropTarget::signalDragDrop(GtkDropTargetAsync* context, GdkDrop* if (!(mask & (GDK_CONTROL_MASK | GDK_SHIFT_MASK))) aEvent.DropAction |= css::datatransfer::dnd::DNDConstants::ACTION_DEFAULT; - css::uno::Reference xTransferable; // For LibreOffice internal D&D we provide the Transferable without Gtk // intermediaries as a shortcut, see tdf#100097 for how dbaccess depends on this if (GtkInstDragSource::g_ActiveDragSource) - xTransferable = GtkInstDragSource::g_ActiveDragSource->GetTransferable(); + aEvent.Transferable = GtkInstDragSource::g_ActiveDragSource->GetTransferable(); else { #if GTK_CHECK_VERSION(4,0,0) - xTransferable = new GtkDnDTransferable(drop); + aEvent.Transferable = new GtkDnDTransferable(drop); #else - xTransferable = new GtkDnDTransferable(context, time, pWidget, this); + aEvent.Transferable = new GtkDnDTransferable(context, time, pWidget, this); #endif } - aEvent.Transferable = xTransferable; fire_drop(aEvent); diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index c7a460656f07..5e8b46c7a0af 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -157,12 +157,6 @@ extern "C" #endif #if !GTK_CHECK_VERSION(4, 0, 0) - // init gdk thread protection - bool const sup = g_thread_supported(); - // extracted from the 'if' to avoid Clang -Wunreachable-code - if ( !sup ) - g_thread_init( nullptr ); - gdk_threads_set_lock_functions (GdkThreadsEnter, GdkThreadsLeave); SAL_INFO("vcl.gtk", "Hooked gdk threads locks"); #endif diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx index bcb3041225b6..8dbe2428b7e4 100644 --- a/vcl/win/app/salinst.cxx +++ b/vcl/win/app/salinst.cxx @@ -1123,7 +1123,6 @@ OUString WinSalInstance::getOSVersion() } // Now use RtlGetVersion (which is not subject to deprecation for GetVersion(Ex) API) // to get build number and SP info - bool bHaveVerFromRtlGetVersion = false; DWORD nBuildNumber = 0; if (HMODULE h_ntdll = GetModuleHandleW(L"ntdll.dll")) { @@ -1138,7 +1137,6 @@ OUString WinSalInstance::getOSVersion() aNtVersion = (OUString::number(vi2.dwMajorVersion) + "." + OUString::number(vi2.dwMinorVersion)); nBuildNumber = vi2.dwBuildNumber; - bHaveVerFromRtlGetVersion = true; } } } diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx index 318009acadae..4daad8eadc9b 100644 --- a/vcl/win/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/gdi/salnativewidgets-luna.cxx @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -909,6 +910,28 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, iState = bChecked ? TS_HOTCHECKED : TS_HOT; else iState = bChecked ? TS_CHECKED : TS_NORMAL; + + if (bUseDarkMode && GetSalInstance()->getOSVersion().startsWith(u"Windows 11") + && (bChecked + || (nState & (ControlState::PRESSED) || (nState & ControlState::ROLLOVER)))) + { + // tdf#152534 workaround bug with Windows 11 Dark theme using + // light blue as highlight color which gives insufficient + // contrast for hovered-over or pressed/checked toolbar buttons: + // manually draw background (using color a bit lighter than background + // for non-highlighted items) and draw a frame around it + ScopedHBRUSH aBgColorBrush(CreateSolidBrush(RGB(38, 38, 38))); + FillRect(hDC, &rc, aBgColorBrush.get()); + const Color aFrameColor = Application::GetSettings().GetStyleSettings().GetDisableColor(); + ScopedHBRUSH aFrameBrush(CreateSolidBrush( + RGB(aFrameColor.GetRed(), aFrameColor.GetGreen(), aFrameColor.GetBlue()))); + FrameRect(hDC, &rc, aFrameBrush.get()); + + DrawThemeText(hTheme, hDC, iPart, iState, o3tl::toW(aCaption.getStr()), -1, + DT_CENTER | DT_VCENTER | DT_SINGLELINE, 0, &rc); + return true; + } + return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); } else if( nPart == ControlPart::ThumbHorz || nPart == ControlPart::ThumbVert ) diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 3a688858b312..16c75d094735 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -804,8 +804,8 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame, } nScreenX = aRect.Left(); nScreenY = aRect.Top(); - nScreenDX = aRect.GetWidth(); - nScreenDY = aRect.GetHeight(); + nScreenDX = aRect.GetWidth() + 1; + nScreenDY = aRect.GetHeight() + 1; } catch( Exception& ) { @@ -5631,8 +5631,7 @@ ImplHandleGetObject(HWND hWnd, LPARAM lParam, WPARAM wParam, LRESULT & nRet) // to avoid RFT interrupts regular accessibility processing if ( !pSVData->mxAccessBridge.is() ) { - if( !InitAccessBridge() ) - return false; + InitAccessBridge(); } xMSAA.set(pSVData->mxAccessBridge, uno::UNO_QUERY); ImplSalYieldMutexRelease(); diff --git a/wizards/com/sun/star/wizards/ui/FieldSelection.java b/wizards/com/sun/star/wizards/ui/FieldSelection.java index 97f19e4eb108..3483132d4cd0 100644 --- a/wizards/com/sun/star/wizards/ui/FieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java @@ -169,7 +169,7 @@ public class FieldSelection Integer cmdShiftButtonPosX = Integer.valueOf((CompPosX + ListBoxWidth.intValue() + cmdButtonHoriDist)); Integer ListBoxPosY = Integer.valueOf(CompPosY + lblVertiDist + lblHeight); Integer ListBoxHeight = Integer.valueOf(CompHeight - 8 - 2); - Integer SelListBoxPosX = Integer.valueOf(cmdShiftButtonPosX.intValue() + cmdButtonWidth + cmdButtonHoriDist); + Integer SelListBoxPosX = Integer.valueOf(cmdShiftButtonPosX.intValue() + cmdButtonWidth + cmdButtonHoriDist + 2); IStep = Integer.valueOf(_iStep); if (bshowFourButtons) diff --git a/writerperfect/uiconfig/ui/exportepub.ui b/writerperfect/uiconfig/ui/exportepub.ui index 0d7730fdd57b..3040d2d8485f 100644 --- a/writerperfect/uiconfig/ui/exportepub.ui +++ b/writerperfect/uiconfig/ui/exportepub.ui @@ -215,6 +215,121 @@ 0 + + + True + False + True + True + 6 + 0 + none + + + + True + False + 12 + 6 + True + 6 + 12 + + + True + False + Cover image: + True + coverpath + 0 + + + 0 + 0 + + + + + True + True + True + True + True + + + 1 + 0 + + + + + Browse... + True + True + True + + + 2 + 0 + + + + + True + False + Media directory: + True + mediadir + 0 + + + 0 + 1 + + + + + True + True + True + True + True + + + 1 + 1 + + + + + Browse... + True + True + True + + + 2 + 1 + + + + + + + True + False + Customize + + + + + + + + 0 + 1 + + True @@ -388,121 +503,6 @@ 2 - - - True - False - True - True - 6 - 0 - none - - - - True - False - 12 - 6 - True - 6 - 12 - - - True - False - Cover image: - True - coverpath - 0 - - - 0 - 0 - - - - - True - True - True - True - True - - - 1 - 0 - - - - - Browse... - True - True - True - - - 2 - 0 - - - - - True - False - Media directory: - True - mediadir - 0 - - - 0 - 1 - - - - - True - True - True - True - True - - - 1 - 1 - - - - - Browse... - True - True - True - - - 2 - 1 - - - - - - - True - False - Customize - - - - - - - - 0 - 1 - - False diff --git a/xmerge/Jar_XMergeBridge.mk b/xmerge/Jar_XMergeBridge.mk deleted file mode 100644 index 2ca6fede5f25..000000000000 --- a/xmerge/Jar_XMergeBridge.mk +++ /dev/null @@ -1,26 +0,0 @@ -# -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# - -$(eval $(call gb_Jar_Jar,XMergeBridge)) - -$(eval $(call gb_Jar_set_componentfile,XMergeBridge,xmerge/source/bridge/XMergeBridge,OOO,services)) - -$(eval $(call gb_Jar_set_manifest,XMergeBridge,$(SRCDIR)/xmerge/source/bridge/manifest.mf)) - -$(eval $(call gb_Jar_set_packageroot,XMergeBridge,*.class)) - -$(eval $(call gb_Jar_use_jars,XMergeBridge,\ - xmerge \ - libreoffice \ -)) - -$(eval $(call gb_Jar_add_sourcefiles,XMergeBridge,\ - xmerge/source/bridge/java/XMergeBridge \ -)) diff --git a/xmerge/Jar_xmerge.mk b/xmerge/Jar_xmerge.mk deleted file mode 100644 index f90139ca32be..000000000000 --- a/xmerge/Jar_xmerge.mk +++ /dev/null @@ -1,118 +0,0 @@ -# -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# - -$(eval $(call gb_Jar_Jar,xmerge)) - -$(eval $(call gb_Jar_set_manifest,xmerge,$(SRCDIR)/xmerge/source/xmerge/xmerge.mf)) - -$(eval $(call gb_Jar_use_jars,xmerge,\ - libreoffice \ -)) - -$(eval $(call gb_Jar_set_packageroot,xmerge,org)) - -$(eval $(call gb_Jar_add_sourcefiles,xmerge,\ - xmerge/source/xmerge/java/org/openoffice/xmerge/Convert \ - xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertData \ - xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterCapabilities \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument \ - xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterFactory \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDB \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDocument \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbDecoder \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbEncoder \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbHeader \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbUtil \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedBinaryObject \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedObject \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedXMLObject \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeConstants \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeZip \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/ParaStyle \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/Style \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/CellStyle \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/ColumnRowInfo \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/ColumnStyle \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/DocumentMergerImpl \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/NameDefinition \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/RowStyle \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SheetSettings \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetDecoder \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetEncoder \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcConstants \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocument \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentDeserializer \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcPluginFactory \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxw/SxwDocument \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxw/SxwPluginFactory \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/ConverterCapabilitiesImpl \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentDeserializerImpl \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentMergerImpl \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/DocumentSerializerImpl \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/GenericOfficeDocument \ - xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl \ - xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertException \ - xmerge/source/xmerge/java/org/openoffice/xmerge/Document \ - xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer \ - xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer2 \ - xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializerFactory \ - xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMerger \ - xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMergerFactory \ - xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer \ - xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer2 \ - xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializerFactory \ - xmerge/source/xmerge/java/org/openoffice/xmerge/MergeException \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/DiffAlgorithm \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CellNodeIterator \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharacterParser \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/CharArrayLCSAlgorithm \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Difference \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorLCSAlgorithm \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/IteratorRowCompare \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/NodeIterator \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ObjectArrayIterator \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/ParaNodeIterator \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/RowIterator \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeEntry \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/diff/TextNodeIterator \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Iterator \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/MergeAlgorithm \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/CharacterBaseParagraphMerge \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/DocumentMerge \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/PositionBaseRowMerge \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/SheetMerge \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/merge/SheetUtil \ - xmerge/source/xmerge/java/org/openoffice/xmerge/merger/NodeMergeAlgorithm \ - xmerge/source/xmerge/java/org/openoffice/xmerge/PluginFactory \ - xmerge/source/xmerge/java/org/openoffice/xmerge/test/ConverterInfoList \ - xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/ColourConverter \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/EndianConverter \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/IntArrayList \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/OfficeUtil \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoReader \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/Resources \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/TwipsConverter \ - xmerge/source/xmerge/java/org/openoffice/xmerge/util/XmlUtil \ - xmerge/source/xmerge/java/org/openoffice/xmerge/Version \ -)) diff --git a/xmerge/Module_xmerge.mk b/xmerge/Module_xmerge.mk deleted file mode 100644 index e92da2ae9cb5..000000000000 --- a/xmerge/Module_xmerge.mk +++ /dev/null @@ -1,17 +0,0 @@ -# -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# -$(eval $(call gb_Module_Module,xmerge)) - -$(eval $(call gb_Module_add_targets,xmerge,\ - $(if $(ENABLE_JAVA), \ - Jar_xmerge \ - Jar_XMergeBridge \ - ) \ -)) diff --git a/xmerge/README.md b/xmerge/README.md deleted file mode 100644 index aa7183dd44d8..000000000000 --- a/xmerge/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Document Conversion and Merging - -For converting documents among from and into formats and also for merging them. - -Uses Java and plug-in architecture. - -## See also - - diff --git a/xmerge/source/bridge/XMergeBridge.component b/xmerge/source/bridge/XMergeBridge.component deleted file mode 100644 index bea9a8d75437..000000000000 --- a/xmerge/source/bridge/XMergeBridge.component +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/xmerge/source/bridge/java/XMergeBridge.java b/xmerge/source/bridge/java/XMergeBridge.java deleted file mode 100644 index 6506326c4046..000000000000 --- a/xmerge/source/bridge/java/XMergeBridge.java +++ /dev/null @@ -1,579 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -/** You can find more - * information on the following web page: - * https://api.libreoffice.org/docs/common/ref/com/sun/star/module-ix.html - */ - -/*Java Uno Helper Classes*/ -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URI; -import java.util.Iterator; - -import javax.xml.parsers.ParserConfigurationException; - -import org.openoffice.xmerge.Convert; -import org.openoffice.xmerge.ConvertData; -import org.openoffice.xmerge.ConverterFactory; -import org.openoffice.xmerge.Document; -import org.openoffice.xmerge.converter.xml.OfficeDocument; -import org.openoffice.xmerge.util.registry.ConverterInfo; -import org.openoffice.xmerge.util.registry.ConverterInfoMgr; -import org.openoffice.xmerge.util.registry.ConverterInfoReader; - -import com.sun.star.comp.loader.FactoryHelper; -import com.sun.star.frame.XConfigManager; -import com.sun.star.io.XInputStream; -import com.sun.star.io.XOutputStream; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XServiceInfo; -import com.sun.star.lang.XServiceName; -import com.sun.star.lang.XSingleServiceFactory; -import com.sun.star.lang.XTypeProvider; -import com.sun.star.lib.uno.adapter.XInputStreamToInputStreamAdapter; -import com.sun.star.lib.uno.adapter.XOutputStreamToOutputStreamAdapter; -import com.sun.star.registry.XRegistryKey; -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.Type; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.xml.XExportFilter; -import com.sun.star.xml.XImportFilter; -import com.sun.star.xml.sax.InputSource; -import com.sun.star.xml.sax.XDocumentHandler; -import com.sun.star.xml.sax.XParser; - -/** This outer class provides an inner class to implement the service - * description and a method to instantiate the - * component on demand (__getServiceFactory()). - */ -public class XMergeBridge { - - private static XMultiServiceFactory xMSF; - private static XInputStream xInStream =null; - private static XOutputStream xOutStream=null; - private static String udJarPath=null; - private static XOutputStream xos = null; - private static String offMime=null; - private static String sdMime=null; - private static String sFileName=null; - private static String sURL=""; - - /** This inner class provides the component as a concrete implementation - * of the service description. It implements the needed interfaces. - */ - public static class _XMergeBridge implements - XImportFilter, - XExportFilter, - XServiceName, - XServiceInfo, - XDocumentHandler, - XTypeProvider { - - /** The component will be registered under this name. - */ - private static final String __serviceName = "com.sun.star.documentconversion.XMergeBridge"; - - public com.sun.star.uno.Type[] getTypes() { - Type[] typeReturn = {}; - - try { - typeReturn = new Type[] { - new Type( XTypeProvider.class ), - new Type( XImportFilter.class ), - new Type( XExportFilter.class ), - new Type( XServiceName.class ), - new Type( XServiceInfo.class ) }; - } - catch( Exception exception ) { - - } - - return typeReturn; - } - - private String getFileName(String origName) - { - String name; - if (origName !=null) - { - if(origName.equalsIgnoreCase("")) - name = "OutFile"; - else { - if (origName.lastIndexOf("/")>=0){ - origName=origName.substring(origName.lastIndexOf("/")+1,origName.length()); - } - if (origName.lastIndexOf(".")>=0){ - name = origName.substring(0, origName.lastIndexOf(".")); - } - else{ - name=origName; - } - } - } - else{ - name = "OutFile"; - } - return name; - } - - public boolean importer(com.sun.star.beans.PropertyValue[] aSourceData, - com.sun.star.xml.sax.XDocumentHandler xDocHandler, - String[] msUserData) throws com.sun.star.uno.RuntimeException { - - sFileName=""; - sURL=""; - udJarPath=msUserData[1]; - offMime =msUserData[4]; - sdMime = msUserData[5]; - com.sun.star.io.XInputStream xis=null; - com.sun.star.beans.PropertyValue[] pValue = aSourceData; - - for (int i = 0 ; i < pValue.length; i++) - { - - try{ - if (pValue[i].Name.equals("InputStream")){ - xis=(com.sun.star.io.XInputStream)AnyConverter.toObject(new Type(com.sun.star.io.XInputStream.class), pValue[i].Value); - } - if (pValue[i].Name.equals("FileName")){ - sFileName=(String)AnyConverter.toObject(new Type(String.class), pValue[i].Value); - } - - } - catch(com.sun.star.lang.IllegalArgumentException AnyExec){ - System.out.println("\nIllegalArgumentException "+AnyExec); - } - - } - - try{ - - Object xCfgMgrObj=xMSF.createInstance("com.sun.star.config.SpecialConfigManager"); - XConfigManager xCfgMgr = UnoRuntime.queryInterface( - XConfigManager.class , xCfgMgrObj ); - String PathString=xCfgMgr.substituteVariables("$(progurl)" ); - PathString= PathString.concat("/"); - udJarPath= PathString.concat(udJarPath); - - Object xPipeObj=xMSF.createInstance("com.sun.star.io.Pipe"); - xInStream = UnoRuntime.queryInterface( - XInputStream.class , xPipeObj ); - xOutStream = UnoRuntime.queryInterface( - XOutputStream.class , xPipeObj ); - convert (xis,xOutStream,false,udJarPath,sFileName,offMime,sdMime); - Object xSaxParserObj=xMSF.createInstance("com.sun.star.xml.sax.Parser"); - - XParser xParser = UnoRuntime.queryInterface( - XParser.class , xSaxParserObj ); - xOutStream.closeOutput(); - InputSource aInput = new InputSource(); - if (sFileName==null){ - sFileName=""; - } - aInput.sSystemId = sFileName; - aInput.aInputStream =xInStream; - xParser.setDocumentHandler ( xDocHandler ); - - xParser.parseStream ( aInput ); - xOutStream.closeOutput(); - xInStream.closeInput(); - - } - catch (IOException e){ - return false; - } - catch (Exception e){ - return false; - } - return true; - } - - public boolean exporter(com.sun.star.beans.PropertyValue[] aSourceData, - String[] msUserData) throws com.sun.star.uno.RuntimeException{ - - sFileName=null; - sURL=null; - udJarPath=msUserData[1]; - offMime =msUserData[4]; - sdMime = msUserData[5]; - - com.sun.star.beans.PropertyValue[] pValue = aSourceData; - for (int i = 0 ; i < pValue.length; i++) - { - - try{ - if (pValue[i].Name.equals("OutputStream")){ - xos=(com.sun.star.io.XOutputStream)AnyConverter.toObject(new Type(com.sun.star.io.XOutputStream.class), pValue[i].Value); - } - - if (pValue[i].Name.equals("FileName")){ - sFileName=(String)AnyConverter.toObject(new Type(String.class), pValue[i].Value); - } - - if (pValue[i].Name.equals("URL")){ - sURL=(String)AnyConverter.toObject(new Type(String.class), pValue[i].Value); - } - } - catch(com.sun.star.lang.IllegalArgumentException AnyExec){ - System.out.println("\nIllegalArgumentException "+AnyExec); - } - } - - if (sURL==null){ - sURL=""; - } - - try{ - - Object xCfgMgrObj=xMSF.createInstance("com.sun.star.config.SpecialConfigManager"); - XConfigManager xCfgMgr = UnoRuntime.queryInterface( - XConfigManager.class , xCfgMgrObj ); - - String PathString=xCfgMgr.substituteVariables("$(progurl)" ); - PathString= PathString.concat("/"); - udJarPath= PathString.concat(udJarPath); - - Object xPipeObj=xMSF.createInstance("com.sun.star.io.Pipe"); - xInStream = UnoRuntime.queryInterface( - XInputStream.class , xPipeObj ); - xOutStream = UnoRuntime.queryInterface( - XOutputStream.class , xPipeObj ); - } - catch (Exception e){ - System.out.println("Exception "+e); - return false; - } - - return true; - } - - private String needsMask(String origString){ - if (origString.contains("&")) { - origString = origString.replace("&","&"); - } - if (origString.contains("\"")) { - origString = origString.replace("\"","""); - } - if (origString.contains("<")) { - origString = origString.replace("<","<"); - } - if (origString.contains(">")) { - origString = origString.replace(">",">"); - } - return origString; - } - - public void startDocument () { - } - - public void endDocument()throws com.sun.star.uno.RuntimeException - { - - try{ - xOutStream.closeOutput(); - convert (xInStream,xos,true,udJarPath,sURL,offMime,sdMime); - - } - catch (IOException e){ - throw new com.sun.star.uno.RuntimeException(e); - - } - catch (Exception e){ - throw new com.sun.star.uno.RuntimeException(e); - - } - } - - public void startElement (String str, com.sun.star.xml.sax.XAttributeList xattribs) - { - - str="<".concat(str); - if (xattribs !=null) - { - str= str.concat(" "); - int len=xattribs.getLength(); - for (short i=0;i"); - - try{ - xOutStream.writeBytes(str.getBytes("UTF-8")); - } - catch (Exception e){ - System.out.println("\n"+e); - } - - } - - public void endElement(String str){ - - str=""); - try{ - xOutStream.writeBytes(str.getBytes("UTF-8")); - - } - catch (Exception e){ - System.out.println("\n"+e); - } - - } - public void characters(String str){ - str=needsMask(str); - try{ - xOutStream.writeBytes(str.getBytes("UTF-8")); - } - catch (Exception e){ - System.out.println("\n"+e); - } - - } - - public void ignorableWhitespace(String str){ - - } - public void processingInstruction(String aTarget, String aData){ - - } - - public void setDocumentLocator(com.sun.star.xml.sax.XLocator xLocator){ - - } - - private static void close(FileOutputStream c) throws IOException { - if (c == null) return; - c.close(); - } - - private void convert (com.sun.star.io.XInputStream xml,com.sun.star.io.XOutputStream device, - boolean convertFromOffice,String pluginUrl,String FileName,String offMime,String sdMime) throws com.sun.star.uno.RuntimeException, IOException { - - String jarName = pluginUrl; - String name= getFileName(FileName); - - Iterator ciEnum= null; - - XInputStreamToInputStreamAdapter xis =new XInputStreamToInputStreamAdapter(xml); - - XOutputStreamToOutputStreamAdapter newxos =new XOutputStreamToOutputStreamAdapter(device); - - /* make sure newxos and xis get closed */ - try{ - try{ - ConverterInfoReader cir = new ConverterInfoReader(jarName,false); - ciEnum =cir.getConverterInfoEnumeration(); - } - catch (ParserConfigurationException pexc){ - System.out.println("Error:"+pexc); - } - catch ( org.xml.sax.SAXException pexc){ - System.out.println("Error:"+pexc); - } - catch(Exception e){ - System.out.println("Error:"+e); - } - ConverterInfoMgr. removeByJar(jarName); - if (convertFromOffice) - { - - try { - - //Check to see if jar contains a plugin Impl - - ConverterInfoMgr.addPlugIn(ciEnum); - ConverterFactory cf = new ConverterFactory(); - - Convert cv = cf.getConverter(ConverterInfoMgr.findConverterInfo(sdMime,offMime),false); - if (cv == null) { - System.out.println("\nNo plug-in exists to convert from to "); - - } - else - { - cv.addInputStream(name,xis,false); - ConvertData dataOut = cv.convert(); - - Iterator docEnum = dataOut.getDocumentEnumeration(); - - if (docEnum.hasNext()){ - Document docOut = (Document)docEnum.next(); - docOut.write(newxos); - - newxos.flush(); - newxos.close(); - newxos = null; - - int i=1; - while (docEnum.hasNext() && sURL.startsWith("file:")) { - - URI uri=new URI(sURL); - String newFileName= getPath(uri); - - File newFile; - if (newFileName.lastIndexOf(".")!=-1){ - newFile =new File(newFileName.substring(0,newFileName.lastIndexOf("."))+String.valueOf(i)+newFileName.substring(newFileName.lastIndexOf("."))); - } - else{ - newFile =new File(newFileName.concat(String.valueOf(i))); - } - - FileOutputStream fos = null; - try { - fos = new FileOutputStream(newFile); - docOut = (Document)docEnum.next(); - docOut.write(fos); - fos.flush(); - } finally { - close(fos); - } - i++; - - } - - } - } - ConverterInfoMgr.removeByJar(jarName); - } - catch (Exception ex1) { - IOException ex2 = new IOException(); - ex2.initCause(ex1); - throw ex2; - } - } - else{ - - try { - //Check to see if jar contains a plugin Impl - ConverterInfoMgr.addPlugIn(ciEnum); - ConverterFactory cf = new ConverterFactory(); - Convert cv = cf.getConverter(ConverterInfoMgr.findConverterInfo(sdMime,offMime),true); - if (cv == null) { - System.out.println("\nNo plug-in exists to convert to from "); - } - else - { - - cv.addInputStream(name,xis,false); - ConvertData dataIn = cv.convert(); - Iterator docEnum = dataIn.getDocumentEnumeration(); - while (docEnum.hasNext()) { - OfficeDocument docIn = (OfficeDocument)docEnum.next(); - - docIn.write(newxos,false); - } - newxos.close(); - newxos = null; - } - ConverterInfoMgr.removeByJar(jarName); - } - catch (StackOverflowError sOE){ - System.out.println("\nERROR : Stack Overflow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n"); - } - catch (Exception ex1) { - IOException ex2 = new IOException(); - ex2.initCause(ex1); - throw ex2; - } - - } - } - finally{ - if (newxos != null){ - try { - newxos.flush(); - } catch (IOException e) { - } - newxos.close(); - } - xis.close(); - } - } - - private String getPath(URI uri){ - String path = uri.getPath(); - String opSys=System.getProperty("os.name"); - if(opSys.contains("Windows")){ - path= path.replace('/','\\'); - path = path.substring(1); - } - return path; - } - - // Implement methods from interface XTypeProvider - public byte[] getImplementationId() { - return new byte[0]; - } - - // Implement method from interface XServiceName - public String getServiceName() { - return __serviceName; - } - - // Implement methods from interface XServiceInfo - public boolean supportsService(String stringServiceName) { - return stringServiceName.equals( __serviceName ); - } - - public String getImplementationName() { - return _XMergeBridge.class.getName(); - } - - public String[] getSupportedServiceNames() { - String[] stringSupportedServiceNames = { __serviceName }; - return stringSupportedServiceNames; - } - } - - /** - * Returns a factory for creating the service. - * This method is called by the JavaLoader - * - * @return returns a XSingleServiceFactory for creating the - * component - * - * @param implName the name of the implementation for which a - * service is desired - * @param multiFactory the service manager to be used if needed - * @param regKey the registryKey - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static XSingleServiceFactory __getServiceFactory(String implName, - XMultiServiceFactory multiFactory, - XRegistryKey regKey) { - xMSF= multiFactory; - XSingleServiceFactory xSingleServiceFactory = null; - if (implName.equals(_XMergeBridge.class.getName()) ) { - xSingleServiceFactory = FactoryHelper.getServiceFactory(_XMergeBridge.class, - _XMergeBridge.__serviceName, - multiFactory, - regKey); - } - - return xSingleServiceFactory; - } -} diff --git a/xmerge/source/bridge/manifest.mf b/xmerge/source/bridge/manifest.mf deleted file mode 100644 index 1c63d9e6d76f..000000000000 --- a/xmerge/source/bridge/manifest.mf +++ /dev/null @@ -1,2 +0,0 @@ -RegistrationClassName: XMergeBridge -UNO-Type-Path: diff --git a/xmerge/source/xmerge/converter.dtd b/xmerge/source/xmerge/converter.dtd deleted file mode 100644 index 81ecbe69d80e..000000000000 --- a/xmerge/source/xmerge/converter.dtd +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/Convert.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/Convert.java deleted file mode 100644 index 728aa05ae120..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/Convert.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Iterator; - -import org.openoffice.xmerge.util.registry.ConverterInfo; - -/** - * The {@code Convert} class manages a conversion from one mime-type to another. - * - *

The {@code ConvertFactory} is responsible for returning the appropriate - * {@code Convert} class for a specified conversion. This class is responsible - * for all interactions with the {@code PluginFactory} implementation.

- * - * @see ConverterFactory - * @see PluginFactory - * @see org.openoffice.xmerge.util.registry.ConverterInfo - */ -public class Convert implements Cloneable { - - /** ConvertInfo that corresponds to the from-mime/to-mime conversion. */ - private final ConverterInfo ci; - - /** - * {@code true} if converting to the Office format, {@code false} if - * converting to the device format. - */ - private final boolean toOffice; - - /** Holds the convert input data. */ - private final ConvertData inputCD = new ConvertData(); - - /** - * Construct a Convert class with specified {@code ConvertInfo} registry - * information. - * - * @param ci A {@code ConvertInfo} object containing registry - * information corresponding to a specific plug-in. - * @param toOffice {@code true} if converting to the Office format, - * {@code false} if converting to the device format. - */ - public Convert(ConverterInfo ci, boolean toOffice) { - this.ci = ci; - this.toOffice = toOffice; - } - - /** - * Adds an {@code InputStream} to be used as input by the {@code Convert} - * class. - * - *

It is possible that many files need to be converted into a single - * output {@code Document}, so this function may be called more than one - * time. It is the plug-in's responsibility to know how to handle the input. - *

- * - * @param name The name corresponding to the {@code InputStream}. - * @param is {@code InputStream} to be used as input. - * - * @throws IOException If any I/O error occurs. - */ - public void addInputStream(String name, InputStream is) - throws IOException { - - Document inputDoc; - - if (toOffice) { - inputDoc = ci.getPluginFactory().createDeviceDocument(name, is); - } else { - inputDoc = ci.getPluginFactory().createOfficeDocument(name, is); - } - inputCD.addDocument(inputDoc); - } - - /** - * Adds an {@code InputStream} to be used as input by the {@code Convert} - * class. - * - *

It is possible that many files need to be converted into a single - * output {@code Document}, so this function may be called more than one - * time. It is the plug-in's responsibility to know how to handle the input. - *

- * - * @param name The name corresponding to the {@code InputStream}. - * @param is {@code InputStream} to be used as input. - * @param isZip {@code boolean} to identify that incoming stream is * zipped. - * - * @throws IOException If any I/O error occurs. - */ - public void addInputStream(String name, InputStream is,boolean isZip) - throws IOException { - - Document inputDoc; - - if (toOffice) { - inputDoc = ci.getPluginFactory().createDeviceDocument(name, is); - } else { - inputDoc = ci.getPluginFactory().createOfficeDocument(name, is, isZip); - } - inputCD.addDocument(inputDoc); - } - - - /** - * Returns a {@code DocumentMerger} for the given {@code Document}. - * - * @param origDoc The {@code Document} were later changes will be merged to. - * - * @return The {@code DocumentMerger} object for the given document. - * - * @throws IOException If any I/O error occurs. - */ - public DocumentMerger getDocumentMerger(Document origDoc) throws IOException { - DocumentMergerFactory myDocMergerFactory = ci.getDocMergerFactory(); - DocumentMerger merger = myDocMergerFactory.createDocumentMerger(origDoc); - return merger; - } - - /** - * Resets the input queue, so that the user can use this class to perform - * another conversion. - * - *

This causes the {@code addInputStream} method to accept input for the - * next conversion.

- */ - private void reset() { - inputCD.reset(); - } - - /** - * Clones a {@code Convert} object so another Convert object can do the same - * conversion. - * - *

{@code InputStream} objects passed in via calls to the - * {@code addInputStream} method are not copied.

- * - * @return The cloned {@code Convert} object. - */ - @Override - public Object clone() { - - Convert aClone = null; - - try { - aClone = (Convert) super.clone(); - aClone.reset(); - } - catch (CloneNotSupportedException e) { - System.out.println("Convert clone could not be created"); - } - return aClone; - } - - /** - * Convert the input specified in calls to the {@code addInputStream} - * method to the output format specified by this {@code Convert} class. - * - * @return The output data. - * - * @throws ConvertException If any conversion error occurs. - * @throws IOException If any I/O error occurs. - */ - public ConvertData convert() throws ConvertException, IOException { - - ConvertData dataOut = new ConvertData(); - - if (toOffice) { - - // From device format to Office format - - DocumentDeserializerFactory myDocDeserializerFactory = - ci.getDocDeserializerFactory(); - DocumentDeserializer deser = - myDocDeserializerFactory.createDocumentDeserializer(inputCD); - Document deviceDoc = deser.deserialize(); - - - dataOut.addDocument(deviceDoc); - return dataOut; - - } else { - - // From Office format to device format - - DocumentSerializerFactory myDocSerializerFactory = - ci.getDocSerializerFactory(); - - Iterator e = inputCD.getDocumentEnumeration(); - - Document doc = (Document) e.next(); - DocumentSerializer ser = myDocSerializerFactory.createDocumentSerializer(doc); - dataOut = ser.serialize(); - - return dataOut; - } - } - - /** - * Returns the appropriate "Office" {@code Document} object for - * this plug-in. - * - * @param name The name of the {@code Document} to create. - * @param is The {@code InputStream} corresponding to the - * {@code Document} to create. - * - * @return The appropriate "Office" {@code Document} object for - * this plug-in. - * - * @throws IOException If any I/O error occurs. - */ - public Document getOfficeDocument(String name, InputStream is) - throws IOException { - return ci.getPluginFactory().createOfficeDocument(name, is); - } -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertData.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertData.java deleted file mode 100644 index d8f276bc3610..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertData.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -import java.util.ArrayList; -import java.util.Iterator; - -/** - * {@code ConvertData} is used as a container for passing {@code Document} - * objects in and out of the {@code Convert} class. - * - *

The {@code ConvertData} contains a {@code String} name and a - * {@code Vector} of {@code Document} objects.

- */ -public class ConvertData { - - /** - * Vector of {@code Document} objects. - */ - private final ArrayList v = new ArrayList(); - - /** - * Name of the {@code ConvertData} object. - */ - private String name; - - /** - * Resets ConvertData. - * - *

This empties all {@code Document} objects from this class. This allows - * reuse of a {@code ConvertData}.

- */ - public void reset() { - name = null; - v.clear(); - } - - /** - * Returns the {@code Document} name. - * - * @return The {@code Document} name. - */ - public String getName() { - return name; - } - - /** - * Sets the {@code Document} name. - * - * @param docName The name of the {@code Document}. - */ - public void setName(String docName) { - name = docName; - } - - /** - * Adds a {@code Document} to the vector. - * - * @param doc The {@code Document} to add. - */ - public void addDocument(Document doc) { - v.add(doc); - } - - /** - * Gets an {@code Enumeration} to access the {@code Vector} of - * {@code Document} objects. - * - * @return The {@code Enumeration} to access the {@code Vector} of - * {@code Document} objects. - */ - public Iterator getDocumentEnumeration() { - Iterator enumerate = v.iterator(); - return enumerate; - } - - /** - * Gets the number of {@code Document} objects currently stored. - * - * @return The number of {@code Document} objects currently stored. - */ - public int getNumDocuments() { - return v.size(); - } -} diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertException.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertException.java deleted file mode 100644 index 6d05e8d26f5f..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConvertException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -/** - * This {@code Exception} is thrown by convert algorithms. - */ -public class ConvertException extends Exception { - - /** - * Exception thrown by convert algorithms. - * - * @param message Message to be included in the {@code Exception}. - */ - public ConvertException(String message) { - super(message); - } -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterCapabilities.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterCapabilities.java deleted file mode 100644 index da36f7da2cb4..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterCapabilities.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -/** - * A {@code ConverterCapabilities} object is used by {@code DocumentMerger} - * implementations. - * - *

The {@code ConverterCapabilities} indicates which "Office" XML - * tags are supported by the "Device" format.

- * - * @see org.openoffice.xmerge.PluginFactory - * @see org.openoffice.xmerge.DocumentMerger - */ -public interface ConverterCapabilities { - - /** - * Test to see if the device document format supports the tag in question. - * - * @param tag The tag to check. - * - * @return {@code true} if the device format supports the tag, - * {@code false} otherwise. - */ - boolean canConvertTag(String tag); - - /** - * Test to see if the device document format supports the tag attribute in - * question. - * - * @param tag The tag to check. - * @param attribute The tag attribute to check. - * - * @return {@code true} if the device format supports the attribute, - * {@code false} otherwise. - */ - boolean canConvertAttribute(String tag, String attribute); -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterFactory.java deleted file mode 100644 index 5c1c246cb066..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterFactory.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -import org.openoffice.xmerge.util.registry.ConverterInfo; -import org.openoffice.xmerge.util.registry.ConverterInfoMgr; - -/** - * Factory that provides access to {@code Convert} objects, which are used to do - * a conversion. - * - *

The {@code ConvertFactory} does this via the {@code ConvertInfoMgr} which - * maintains a list of which {@code Convert} objects are available and their - * capabilities.

- * - * @see Convert - * @see org.openoffice.xmerge.util.registry.ConverterInfoMgr - */ -public class ConverterFactory { - - /** - * Returns the {@code Convert} object that converts the specified device/office - * mime type conversion. - * - *

If there are multiple {@code Converter} objects registered that support - * this conversion, only the first is returned.

- * - * @param mimeTypeIn The mime input type. - * @param mimeTypeOut The mime output type. - * - * @return The first {@code Convert} object that supports the specified - * conversion. - */ - public Convert getConverter(String mimeTypeIn, String mimeTypeOut) { - - ConverterInfo foundInfo; - boolean toOffice; - - toOffice = ConverterInfo.isValidOfficeType(mimeTypeOut); - - // findConverterInfo expects the second parameter to be the - // destination MimeType - if (toOffice) - foundInfo = ConverterInfoMgr.findConverterInfo(mimeTypeIn, mimeTypeOut); - else - foundInfo = ConverterInfoMgr.findConverterInfo(mimeTypeOut, mimeTypeIn); - - if (foundInfo != null) - return getConverter(foundInfo, toOffice); - else - return null; - } - - /** - * Returns the {@code Convert} object that is described by the - * {@code ConverterInfo} parameter. - * - * @param ci The {@code ConverterInfo} describing the converter. - * @param toOffice {@code true} to convert to office, {@code false} to - * convert to device. - * - * @return The {@code Convert} object - */ - public Convert getConverter(ConverterInfo ci, boolean toOffice) { - - Convert myConvert = new Convert(ci, toOffice); - return myConvert; - } -} diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/Document.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/Document.java deleted file mode 100644 index 851c1539dfba..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/Document.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -import java.io.OutputStream; -import java.io.InputStream; -import java.io.IOException; - -/** - * A {@code Document} represents any {@code Document} to be converted and the - * resulting {@code Document} from any conversion. - * - *

It is created by the {@code PluginFactory} object's {@link - * org.openoffice.xmerge.PluginFactory#createOfficeDocument createOfficeDocument} - * method or the {@link org.openoffice.xmerge.PluginFactory#createDeviceDocument - * createDeviceDocument} method.

- * - * @see org.openoffice.xmerge.PluginFactory - */ -public interface Document { - - /** - * Writes out the {@code Document} content to the specified - * {@code OutputStream}. - * - *

This method may not be thread-safe. Implementations may or may not - * synchronize this method. User code (i.e. caller) must make sure that - * calls to this method are thread-safe.

- * - * @param os {@code OutputStream} to write out the {@code Document} - * content. - * - * @throws IOException If any I/O error occurs. - */ - void write(OutputStream os) throws IOException; - - /** - * Reads the content from the {@code InputStream} into the {@code Document}. - * - *

This method may not be thread-safe. Implementations may or may not - * synchronize this method. User code (i.e. caller) must make sure that - * calls to this method are thread-safe.

- * - * @param is {@code InputStream} to read in the {@code Document} content. - * - * @throws IOException If any I/O error occurs. - */ - void read(InputStream is) throws IOException; - - /** - * Returns the {@code Document} name with no file extension. - * - * @return The {@code Document} name with no file extension. - */ - String getName(); - - /** - * Returns the {@code Document} name with file extension. - * - * @return The {@code Document} name with file extension. - */ - String getFileName(); -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer.java deleted file mode 100644 index 1bfadfcfef28..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -import java.io.IOException; - -/** - * A {@code DocumentDeserializer} represents a converter that converts - * "Device" {@code Document} objects into the "Office" - * {@code Document} format. - * - *

The {@code DocumentDeserializer} object is created by the - * {@code PluginFactory} {@link - * org.openoffice.xmerge.DocumentDeserializerFactory#createDocumentDeserializer - * createDocumentDeserializer} method. When it is constructed, a - * {@code ConvertData} object is passed in to be used as input.

- * - * @see org.openoffice.xmerge.PluginFactory - * @see org.openoffice.xmerge.DocumentDeserializerFactory - */ -public interface DocumentDeserializer { - - /** - * Convert the data passed into the {@code DocumentDeserializer} constructor - * into the "Office" {@code Document} format. - * - *

This method may or may not be thread-safe. It is expected that the - * user code does not call this method in more than one thread. And for - * most cases, this method is only done once.

- * - * @return The resulting {@code Document} object from conversion. - * - * @throws ConvertException If any Convert error occurs. - * @throws IOException If any I/O error occurs. - */ - Document deserialize() throws ConvertException, IOException; -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer2.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer2.java deleted file mode 100644 index 95f34413ef31..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializer2.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -import java.io.IOException; - -/** - * A {@code DocumentDeserializer} represents a converter that converts - * "Device" {@code Document} objects into the "Office" - * {@code Document} format. - * - *

The {@code PluginFactory} {@link - * org.openoffice.xmerge.DocumentDeserializerFactory#createDocumentDeserializer - * createDocumentDeserializer} method creates a {@code DocumentDeserializer}, - * which may or may not implement {@code DocumentDeserializer2}. When it is - * constructed, a {@code ConvertData} object is passed in to be used as input. - *

- * - * @see org.openoffice.xmerge.PluginFactory - * @see org.openoffice.xmerge.DocumentDeserializerFactory - */ -public interface DocumentDeserializer2 extends DocumentSerializer { - - /** - * Convert the data passed into the {@code DocumentDeserializer2} - * constructor into the "Office" {@code Document} format. - * - *

The URL's passed may be used to resolve links and to choose the name - * of the output office document.

- * - *

This method may or may not be thread-safe. It is expected that the - * user code does not call this method in more than one thread. And for - * most cases, this method is only done once.

- * - * @return The resulting {@code Document} object from conversion. - * - * @param deviceURL URL of the device document (may be null if unknown) - * @param officeURL URL of the office document (may be null if unknown) - * - * @throws ConvertException If any Convert error occurs. - * @throws IOException If any I/O error occurs. - */ - Document deserialize(String deviceURL, String officeURL) throws - ConvertException, IOException; -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializerFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializerFactory.java deleted file mode 100644 index 3d10d03bfe5d..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentDeserializerFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -/** - * A {@code DocumentDeserializer} object is used to convert from the - * "Device" {@code Document} format to the "Office" - * {@code Document} format. - * - *

All plug-in implementations of the {@code PluginFactory} interface that - * also support deserialization must also implement this interface.

- * - * @see PluginFactory - * @see DocumentDeserializer - */ -public interface DocumentDeserializerFactory { - - /** - * The {@code DocumentDeserializer} is used to convert from the - * "Device" {@code Document} format to the "Office" - * {@code Document} format. - * - *

The {@code ConvertData} object is passed along to the created - * {@code DocumentDeserializer} via its constructor. The {@code ConvertData} - * is read and converted when the {@code DocumentDeserializer} object's - * {@code deserialize} method is called.

- * - * @param cd {@code ConvertData} object that the created - * {@code DocumentDeserializer} object uses as input. - * - * @return A {@code DocumentDeserializer} object. - */ - - DocumentDeserializer createDocumentDeserializer(ConvertData cd); -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMerger.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMerger.java deleted file mode 100644 index 3ec19e7484be..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMerger.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -/** - * A {@code DocumentMerger} can merge changes from a modified "Device" - * {@code Document} to the assigned original "Office" {@code Document}. - * - *

Merge is useful when an {@code OfficeDocument} is converted to a - * "Device" {@code Document} format, and the "Device" - * {@code Document} version is modified. Those changes can be merged back into - * the original {@code OfficeDocument} with the merger. The merger is capable - * of doing this even if the "Device" format is lossy in - * comparison to the {@code OfficeDocument} format.

- * - *

The {@code ConverterCapabilities} object is what the DocumentMerger - * utilizes to know how the "Office" {@code Document} tags are - * supported in the "Device" format.

- * - *

The {@code DocumentMerger} object is created by the - * {@code DocumentMergerFactory} {@link - * org.openoffice.xmerge.DocumentMergerFactory#createDocumentMerger - * createDocumenMerger} method. When it is constructed, the "Original - * Office" {@code Document} object is passed in to be used as input.

- * - * @see org.openoffice.xmerge.PluginFactory - * @see org.openoffice.xmerge.DocumentMergerFactory - * @see org.openoffice.xmerge.ConverterCapabilities - */ -public interface DocumentMerger { - - /** - * This method will find the changes that had happened in the - * {@code modifiedDoc} {@code Document} object given the designated original - * {@code Document}. - * - *

Note that this process may need the knowledge of the conversion - * process since some conversion process are lossy. Items/Data that are - * lost during the conversion process are not classified as changes. The - * main target of this method is to apply the changes done in - * {@code modifiedDoc} into the assigned original {@code Document} object, - * thus it also will try to preserve items that were originally in the - * original {@code Document}, but never got transferred during the - * {@link org.openoffice.xmerge.DocumentSerializer#serialize serialize} - * process/method call. After this method call, the original - * {@code Document} object will contain the changes applied.

- * - *

This method may or may not be thread-safe. Also, it is expected that - * the user uses only one instance of a {@code DocumentMerger} object per - * merge process. Create another {@code DocumentMerger} object for another - * merge process.

- * - * @param modifiedDoc device {@code Document} object. - * - * @throws MergeException If any merge error occurs. - */ - void merge(Document modifiedDoc) throws MergeException; -} diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMergerFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMergerFactory.java deleted file mode 100644 index e665d662a50c..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentMergerFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -/** - * All plug-in implementations of the {@code PluginFactory} interface that also - * support merging must also implement this interface. - * - *

Merge is useful when an {@code OfficeDocument} is converted to a - * "Device" {@code Document} format, and the "Device" - * {@code Document} version is modified.

- * - *

Those changes can be merged back into the original {@code OfficeDocument} - * with the merger. The merger is capable of doing this even if the - * "Device" format is lossy in comparison to the {@code OfficeDocument} - * format.

- * - * @see PluginFactory - * @see DocumentMerger - * @see ConverterCapabilities - */ -public interface DocumentMergerFactory { - - /** - * Create a {@code DocumentMerger} object given a {@code Document} object. - * - * @param doc {@code Document} object that the created - * {@code DocumentMerger} object uses as a base {@code Document} - * for merging changes into. - * - * @return A {@code DocumentMerger} object or {@code null} if none exists. - */ - DocumentMerger createDocumentMerger(Document doc); -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer.java deleted file mode 100644 index 87f5da1c2fe4..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -import java.io.IOException; - -/** - * A {@code DocumentSerializer} represents a converter that converts a - * "Office" {@code Document} to a "Device" {@code Document} - * format. - * - *

The {@code DocumentSerializer} object is created by the - * {@code PluginFactory} {@link - * org.openoffice.xmerge.DocumentSerializerFactory#createDocumentSerializer - * createDocumentSerializer} method. When it is constructed, an - * "Office" {@code Document} object is passed in to be used as input. - *

- * - * @see org.openoffice.xmerge.PluginFactory - * @see org.openoffice.xmerge.DocumentSerializerFactory - */ -public interface DocumentSerializer { - - /** - * Convert the data passed into the {@code DocumentSerializer} constructor - * into the "Device" {@code Document} format. - * - *

This method may or may not be thread-safe. It is expected that the - * user code does not call this method in more than one thread. And for - * most cases, this method is only done once.

- * - * @return {@code ConvertData} object to pass back the converted data. - * - * @throws ConvertException If any conversion error occurs. - * @throws IOException If any I/O error occurs. - */ - ConvertData serialize() throws ConvertException, IOException; -} diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer2.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer2.java deleted file mode 100644 index 56a1a1116411..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializer2.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -import java.io.IOException; - -/** - * A {@code DocumentSerializer2} represents a converter that converts a - * "Office" {@code Document} to a "Device" {@code Document} - * format. - * - *

The {@code PluginFactory} {@link - * org.openoffice.xmerge.DocumentSerializerFactory#createDocumentSerializer - * createDocumentSerializer} method creates a {@code DocumentSerializer}, which - * may or may not implement {@code DocumentSerializer2}. When it is constructed, - * a "Office" {@code Document} object is passed in to be used as - * input.

- * - * @see org.openoffice.xmerge.PluginFactory - * @see org.openoffice.xmerge.DocumentSerializerFactory - */ -public interface DocumentSerializer2 extends DocumentSerializer { - - /** - * Convert the data passed into the {@code DocumentSerializer2} constructor - * into the "Device" {@code Document} format. - * - *

The URL's passed may be used to resolve links and to name the output - * device document(s).

- * - *

This method may or may not be thread-safe. It is expected that the - * user code does not call this method in more than one thread. And for - * most cases, this method is only done once.

- * - * @return {@code ConvertData} object to pass back the converted data. - * - * @param officeURL URL of the office document (may be null if - * unknown) - * @param deviceURL URL of the device document (may be null if - * unknown) - * - * @throws ConvertException If any conversion error occurs. - * @throws IOException If any I/O error occurs. - */ - ConvertData serialize(String officeURL, String deviceURL) throws - ConvertException, IOException; -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializerFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializerFactory.java deleted file mode 100644 index e4852ff1e182..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/DocumentSerializerFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -/** - * A {@code DocumentSerializer} object is used to convert from the - * "Office" {@code Document} format to the "Device" - * {@code Document} format. - * - *

All plug-in implementations of the {@code PluginFactory} interface that - * also support serialization must also implement this interface.

- * - * @see PluginFactory - * @see DocumentSerializer - */ -public interface DocumentSerializerFactory { - - /** - * The {@code DocumentSerializer} is used to convert from the - * "Office" {@code Document} format to the "Device" - * {@code Document} format. - * - *

The {@code ConvertData} object is passed along to the created - * {@code DocumentSerializer} via its constructor. The {@code ConvertData} - * is read and converted when the {@code DocumentSerializer} object's - * {@code serialize} method is called.

- * - * @param doc {@code Document} object that the created - * {@code DocumentSerializer} object uses as input. - * - * @return A DocumentSerializer object. - */ - DocumentSerializer createDocumentSerializer(Document doc); -} diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/MergeException.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/MergeException.java deleted file mode 100644 index c592bfb6504d..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/MergeException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -/** - * This {@code Exception} is thrown by merge algorithms. - */ -public class MergeException extends Exception { - - /** - * Exception thrown by merge algorithms. - * - * @param message Message to be included in the {@code Exception}. - */ - public MergeException(String message) { - super(message); - } -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/PluginFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/PluginFactory.java deleted file mode 100644 index cb2e07a4a788..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/PluginFactory.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -import org.openoffice.xmerge.util.registry.ConverterInfo; -import java.io.InputStream; -import java.io.IOException; - -/** - * A {@code PluginFactory} encapsulates the conversions from one {@code Document} - * format to another. - * - *

It provides conversions in both directions. Refer to the - * package description - * for its usage.

- * - *

Conversion from the "Office" {@code Document} format to a - * "Device" {@code Document} format may be lossy, i.e. some - * information may be lost. If a plug-in implements the - * {@code DocumentMergerFactory} interface, then there is the possibility for - * merging the changes done on the "Device" {@code Document} back to - * the original "Office" {@code Document} via the {@code DocumentMerger} - * interface.

- * - *

Plug-ins that convert from the "Device" {@code Document} format - * to the "Office" {@code Document} format must implement the - * {@code DocumentDeserializerFactory} interface. Plug-ins that convert from - * the "Office" {@code Document} format to the "Device" - * format must implement the {@code DocumentSerializerFactory} interface.

- * - *

All plug-ins should have an associated Plug-in Configuration XML File which - * describes the capabilities of the plug-in. If the plug-in is bundled in a - * jarfile, then this XML file is also bundled with the jarfile. The data in - * the XML file is managed by the {@code ConverterInfo} object. The - * {@code ConverterInfoMgr} manages a registry of all {@code ConverterInfo} - * objects. For more information about this XML file, refer to - * org.openoffice.xmerge.util.registry. - *

- * - * @see Document - * @see DocumentSerializer - * @see DocumentSerializerFactory - * @see DocumentDeserializer - * @see DocumentDeserializerFactory - * @see DocumentMerger - * @see DocumentMergerFactory - * @see ConverterInfo - * @see org.openoffice.xmerge.util.registry.ConverterInfoMgr - */ - -public abstract class PluginFactory { - - /** - * Cached {@code ConvertInfo} object. - */ - private final ConverterInfo ciCache; - - /** - * Constructor that caches the {@code ConvertInfo} that corresponds to the - * registry information for this plug-in. - * - * @param ci {@code ConvertInfo} object. - */ - public PluginFactory(ConverterInfo ci) { - ciCache=ci; - } - - /** - * Returns the {@code ConvertInfo} that corresponds to this plug-in. - * - * @return The {@code ConvertInfo} that corresponds to this plug-in. - */ - public ConverterInfo getConverterInfo () { - return ciCache; - } - - /** - * Create a {@code Document} object that corresponds to the Office data - * passed in via the {@code InputStream} object. - * - *

This abstract method must be implemented for each plug-in.

- * - *

This method will read from the given {@code InputStream} object. The - * returned {@code Document} object will contain the necessary data for the - * other objects created by the {@code PluginFactory} to process, like a - * {@code DocumentSerializer} object and a {@code DocumentMerger} object.

- * - * @param name The {@code Document} name. - * @param is {@code InputStream} object corresponding to the - * {@code Document}. - * - * @return A {@code Document} object representing the particular - * {@code Document} format for the {@code PluginFactory}. - * - * @throws IOException If any I/O error occurs. - */ - public abstract Document createOfficeDocument(String name, InputStream is) - throws IOException; - - /** - * Create a {@code Document} object that corresponds to the Office data - * passed in via the {@code InputStream} object. - * - *

This abstract method must be implemented for each plug-in.

- * - *

This method will read from the given {@code InputStream} object. The - * returned {@code Document} object will contain the necessary data for the - * other objects created by the {@code PluginFactory} to process, like a - * {@code DocumentSerializer} object and a {@code DocumentMerger} object.

- * - * @param name The {@code Document} name. - * @param is {@code InputStream} object corresponding to the - * {@code Document}. - * @param isZip {@code boolean} to show that the created office document - * is to be zipped. - * - * @return A {@code Document} object representing the particular - * {@code Document} format for the {@code PluginFactory}. - * - * @throws IOException If any I/O error occurs. - */ - public abstract Document createOfficeDocument(String name, InputStream is, - boolean isZip) throws IOException; - - /** - * Create a {@code Document} object that corresponds to the device data - * passed in via the {@code InputStream} object. - * - *

This abstract method must be implemented for each plug-in.

- * - *

This method will read from the given {@code InputStream} object. The - * returned {@code Document} object will contain the necessary data for the - * other objects created by the {@code PluginFactory} to process, like a - * {@code DocumentSerializer} object and a {@code DocumentMerger} object.

- * - * @param name The {@code Document} name. - * @param is {@code InputStream} object corresponding to the - * {@code Document}. - * - * @return A {@code Document} object representing the particular - * {@code Document} format for the {@code PluginFactory}. - * - * @throws IOException If any I/O error occurs. - */ - public abstract Document createDeviceDocument(String name, InputStream is) - throws IOException; -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/Version.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/Version.java deleted file mode 100644 index 02d16eedfe83..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/Version.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge; - -/** - * This class provides a quick utility to check the version of the jar file. - * - *

It has a main method that prints out the version info. It also provides - * two static methods for runtime classes to query.

- */ -public final class Version { - - private static final Version version = new Version(); - - private static final Package pkg = version.getClass().getPackage(); - - /** - * Private constructor to provide a singleton instance. - */ - private Version() { - } - - /** - * Returns specification version. - * - * @return The specification version. - */ - public static String getSpecificationVersion() { - return pkg.getSpecificationVersion(); - } - - /** - * Returns implementation version. - * - * @return The implementation version. - */ - public static String getImplementationVersion() { - return pkg.getImplementationVersion(); - } - - /** - * Main method for printing out version info. - * - * @param args Array of arguments, not used. - */ - public static void main(String args[]) { - System.out.println("Specification-Title: " + pkg.getSpecificationTitle()); - System.out.println("Specification-Vendor: " + pkg.getSpecificationVendor()); - System.out.println("Specification-Version: " + pkg.getSpecificationVersion()); - System.out.println("Implementation-Version: " + pkg.getImplementationVersion()); - } -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java deleted file mode 100644 index c49b6560f192..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.dom; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.StringWriter; -import java.io.ByteArrayOutputStream; -import java.io.IOException; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.Transformer; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.dom.DOMSource; -import javax.xml.XMLConstants; - -import org.w3c.dom.Node; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; -import org.openoffice.xmerge.util.Debug; - -/** - * An implementation of {@code Document} for StarOffice documents. - */ -public class DOMDocument - implements org.openoffice.xmerge.Document { - - private static DocumentBuilderFactory makeFactory() { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - - try { - factory.setFeature("http://xml.org/sax/features/external-general-entities", false); - } catch (ParserConfigurationException e) { - Debug.log(Debug.ERROR, "Exception when calling setFeature: ", e); - } - - try { - factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); - } catch (ParserConfigurationException e) { - Debug.log(Debug.ERROR, "Exception when calling setFeature: ", e); - } - - try { - factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); - } catch (ParserConfigurationException e) { - Debug.log(Debug.ERROR, "Exception when calling setFeature: ", e); - } - - try { - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } catch (ParserConfigurationException e) { - Debug.log(Debug.ERROR, "Exception when calling setFeature: ", e); - } - - return factory; - } - - /** Factory for {@code DocumentBuilder} objects. */ - private static DocumentBuilderFactory factory = makeFactory(); - - /** DOM {@code Document} of content.xml. */ - private Document contentDoc = null; - - private String documentName = null; - private String fileName = null; - private String fileExt = null; - - /** - * Default constructor. - * - * @param name {@code Document} name. - * @param ext {@code Document} extension. - */ - public DOMDocument(String name,String ext) { - this(name,ext,true, false); - } - - /** - * Returns the file extension of the {@code Document} represented. - * - * @return file extension of the {@code Document}. - */ - private String getFileExtension() { - return fileExt; - } - - /** - * Constructor with arguments to set {@code namespaceAware} and - * {@code validating} flags. - * - * @param name {@code Document} name (may or may not contain - * extension). - * @param ext {@code Document} extension. - * @param namespaceAware Value for {@code namespaceAware} flag. - * @param validating Value for {@code validating} flag. - */ - private DOMDocument(String name, String ext,boolean namespaceAware, - boolean validating) { - - factory.setValidating(validating); - factory.setNamespaceAware(namespaceAware); - this.fileExt = ext; - this.documentName = trimDocumentName(name); - this.fileName = documentName + getFileExtension(); - } - - /** - * Removes the file extension from the {@code Document} name. - * - * @param name Full {@code Document} name with extension. - * - * @return Name of {@code Document} without the extension. - */ - private String trimDocumentName(String name) { - String temp = name.toLowerCase(); - String ext = getFileExtension(); - - if (temp.endsWith(ext)) { - // strip the extension - int nlen = name.length(); - int endIndex = nlen - ext.length(); - name = name.substring(0,endIndex); - } - - return name; - } - - /** - * Return a DOM {@code Document} object of the document content file. - * - *

Note that a content DOM is not created when the constructor is called. - * So, either the {@code read} method or the {@code initContentDOM} method - * will need to be called ahead on this object before calling this method. - *

- * - * @return DOM {@code Document} object. - */ - public Document getContentDOM() { - - return contentDoc; - } - - /** - * Sets the Content of the {@code Document} to the contents of the supplied - * {@code Node} list. - * - * @param newDom DOM {@code Document} object. - */ - public void setContentDOM( Node newDom) { - contentDoc=(Document)newDom; - } - - /** - * Return the name of the {@code Document}. - * - * @return The name of {@code Document}. - */ - public String getName() { - - return documentName; - } - - /** - * Return the file name of the {@code Document}, possibly with the standard - * extension. - * - * @return The file name of {@code Document}. - */ - public String getFileName() { - - return fileName; - } - - /** - * Read the Office {@code Document} from the specified {@code InputStream}. - * - * @param is Office document {@code InputStream}. - * - * @throws IOException If any I/O error occurs. - */ - public void read(InputStream is) throws IOException { - Debug.log(Debug.INFO, "reading file"); - try { - DocumentBuilder builder = factory.newDocumentBuilder(); - contentDoc = builder.parse(is); - } catch (ParserConfigurationException ex) { - System.out.println("Error:"+ ex); - } catch (SAXException ex) { - System.out.println("Error:"+ ex); - } - } - - /** - * Write out content to the supplied {@code OutputStream}. - * - * @param os XML {@code OutputStream}. - * - * @throws IOException If any I/O error occurs. - */ - public void write(OutputStream os) throws IOException { - - // set bytes for writing to output stream - byte contentBytes[] = docToBytes(contentDoc); - - os.write(contentBytes); - } - - /** - * Write out a {@code org.w3c.dom.Document} object into a {@code byte} array. - * - *

TODO: remove dependency on {@code com.sun.xml.tree.XmlDocument} package! - *

- * - * @param doc DOM {@code Document} object. - * - * @return {@code byte} array of DOM {@code Document} object. - * - * @throws IOException If any I/O error occurs. - */ - private byte[] docToBytes(Document doc) - throws IOException { - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - java.lang.reflect.Constructor con; - java.lang.reflect.Method meth; - - String domImpl = doc.getClass().getName(); - - System.err.println("type b " + domImpl); - - /* - * We may have multiple XML parsers in the Classpath. - * Depending on which one is first, the actual type of - * doc may vary. Need a way to find out which API is being - * used and use an appropriate serialization method. - */ - try { - // First of all try for JAXP 1.0 - if (domImpl.equals("com.sun.xml.tree.XmlDocument")) { - System.out.println("Using JAXP"); - Class jaxpDoc = Class.forName("com.sun.xml.tree.XmlDocument"); - - // The method is in the XMLDocument class itself, not a helper - meth = jaxpDoc.getMethod("write", - new Class[]{Class.forName("java.io.OutputStream")}); - - meth.invoke(doc, new Object[]{baos}); - } else if (domImpl.equals("org.apache.crimson.tree.XmlDocument")) { - System.out.println("Using Crimson"); - Class crimsonDoc = Class.forName("org.apache.crimson.tree.XmlDocument"); - // The method is in the XMLDocument class itself, not a helper - meth = crimsonDoc.getMethod("write", - new Class[]{Class.forName("java.io.OutputStream")}); - - meth.invoke(doc, new Object[]{baos}); - } else if (domImpl.equals("org.apache.xerces.dom.DocumentImpl") - || domImpl.equals("org.apache.xerces.dom.DeferredDocumentImpl")) { - System.out.println("Using Xerces"); - // Try for Xerces - Class xercesSer - = Class.forName("org.apache.xml.serialize.XMLSerializer"); - - // Get the OutputStream constructor - // May want to use the OutputFormat parameter at some stage too - con = xercesSer.getConstructor(new Class[]{Class.forName("java.io.OutputStream"), - Class.forName("org.apache.xml.serialize.OutputFormat")}); - - // Get the serialize method - meth = xercesSer.getMethod("serialize", - new Class[]{Class.forName("org.w3c.dom.Document")}); - - // Get an instance - Object serializer = con.newInstance(new Object[]{baos, null}); - - // Now call serialize to write the document - meth.invoke(serializer, new Object[]{doc}); - } else if (domImpl.equals("gnu.xml.dom.DomDocument")) { - System.out.println("Using GNU"); - - Class gnuSer = Class.forName("gnu.xml.dom.ls.DomLSSerializer"); - - // Get the serialize method - meth = gnuSer.getMethod("serialize", - new Class[]{Class.forName("org.w3c.dom.Node"), - Class.forName("java.io.OutputStream")}); - - // Get an instance - Object serializer = gnuSer.newInstance(); - - // Now call serialize to write the document - meth.invoke(serializer, new Object[]{doc, baos}); - } else { - // We don't have another parser - try { - DOMSource domSource = new DOMSource(doc); - StringWriter writer = new StringWriter(); - StreamResult result = new StreamResult(writer); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer transformer = tf.newTransformer(); - transformer.transform(domSource, result); - return writer.toString().getBytes(); - } catch (Exception e) { - // We don't have another parser - IOException ex2 = new IOException("No appropriate API (JAXP/Xerces) to serialize XML document: " + domImpl); - ex2.initCause(e); - throw ex2; - } - } - } - catch (Exception e) { - // We may get some other errors, but the bottom line is that - // the steps being executed no longer work - IOException newEx = new IOException(e.getMessage()); - newEx.initCause(e); - throw newEx; - } - - byte bytes[] = baos.toByteArray(); - - return bytes; - } -} diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/package-info.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/package-info.java deleted file mode 100644 index 79d5f797f39b..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/package-info.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -/** - * Provides classes for converting basic document types to/from a - * {@code DOMDocument} object, which can be used by the framework. - * - *

This package provides classes that handle the writing of data to an - * {@code OutputStream} object for the {@link - * org.openoffice.xmerge.DocumentSerializer DocumentSerializer} interface for; - * as well as the reading of data from an {@code InputStream} object for the - * framework's {@link org.openoffice.xmerge.DocumentDeserializer - * DocumentDeserializer} interface. Both these framework interfaces are simply - * converters from server-side documents to device specific documents and - * vice-versa.

- * - * - * - *

Important Note

- * - *

Methods in these classes are not thread safe for performance reasons. - * Users of these classes will have to make sure that the usage of these classes - * are done in a proper manner. Possibly more on this later.

- */ -package org.openoffice.xmerge.converter.dom; diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDB.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDB.java deleted file mode 100644 index 2f6ca011462b..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDB.java +++ /dev/null @@ -1,360 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.palm; - -import java.io.UnsupportedEncodingException; - -/** - * This class contains data for a single Palm database for use during a - * conversion process. - * - *

It contains zero or more {@code Record} objects stored in an array. The - * index of the {@code Record} object in the array is the {@code Record} id or - * number for that specific {@code Record} object. Note that this class does - * not check for maximum number of Records allowable in an actual PDB.

- * - *

This class also contains the PDB name associated with the Palm database - * it represents. A PDB name consists of 32 bytes of a certain encoding - * (extended ASCII in this case).

- * - *

The non default constructors take in a name parameter which may not be - * the exact PDB name to be used. The name parameter in {@code String} or - * {@code byte} array are converted to an exact {@code NAME_LENGTH} byte array. - * If the length of the name is less than {@code NAME_LENGTH}, it is padded - * with {@code '\0'} characters. If it is more, it gets truncated. The last - * character in the resulting byte array is always a {@code '\0'} character. - * The resulting byte array is stored in {@code bName}, and a corresponding - * {@code String} object {@code sName} that contains characters without the - * {@code '\0'} characters.

- * - *

The {@code write} method is called within the {@link - * org.openoffice.xmerge.converter.palm.PalmDocument#write - * PalmDocument.write} method for writing out its data to the - * {@code OutputStream} object.

- * - *

The {@code read} method is called within the {@link - * org.openoffice.xmerge.converter.palm.PalmDocument#read PalmDocument.read} - * method for reading in its data from the {@code InputStream} object.

- * - * @see PalmDocument - * @see Record - */ - -public final class PalmDB { - - /** Number of bytes for the name field in the PDB. */ - public static final int NAME_LENGTH = 32; - - /** List of {@code Record} objects. */ - private Record[] records; - - /** PDB name in bytes. */ - private byte[] bName = null; - - /** PDB name in String. */ - private String sName = null; - - /** Creator ID. */ - private int creatorID = 0; - - /** Type ID */ - private int typeID = 0; - - /** - * PDB version. Palm UInt16. - * It is treated as a number here, since there is no unsigned 16 bit in Java, - * {@code int} is used instead, but only 2 bytes are written out or read in. - */ - private int version = 0; - - /** - * PDB attribute - flags for the database. - * Palm UInt16. Unsignedness should be irrelevant. - */ - private short attribute = 0; - - /** - * Default constructor. - * - * @param creatorID The PDB Creator ID. - * @param typeID The PDB Type ID. - * @param version The PDB header version. - * @param attribute The PDB header attribute. - */ - public PalmDB(int creatorID, int typeID, int version, short attribute) { - records = new Record[0]; - setAttributes(creatorID, typeID, version, attribute); - } - - /** - * Constructor to create {@code PalmDB} object with {@code Record} objects. - * - *

{@code recs.length} can be zero for an empty PDB.

- * - * @param name Suggested PDB name in a {@code String}. - * @param creatorID The PDB Creator ID. - * @param typeID The PDB Type ID. - * @param version The PDB header version. - * @param attribute The PDB header attribute. - * @param recs Array of {@code Record} objects. - * - * @throws UnsupportedEncodingException If {@code name} is not properly - * encoded. - * @throws NullPointerException If {@code recs} is {@code null}. - */ - public PalmDB(String name, int creatorID, int typeID, int version, - short attribute, Record[] recs) - throws UnsupportedEncodingException { - - this(name.getBytes(PdbUtil.ENCODING), creatorID, typeID, version, - attribute, recs); - } - - /** - * Constructor to create object with {@code Record} objects. - * - *

{@code recs.length} can be zero for an empty PDB.

- * - * @param name Suggested PDB name in a {@code byte} array. - * @param creatorID The PDB Creator ID. - * @param typeID The PDB Type ID. - * @param version The PDB header version. - * @param attribute The PDB header attribute. - * @param recs Array of {@code Record} objects. - * - * @throws UnsupportedEncodingException If {@code name} is not properly - * encoded. - * @throws NullPointerException If {@code recs} is {@code null}. - */ - public PalmDB(byte[] name, int creatorID, int typeID, int version, - short attribute, Record[] recs) - throws UnsupportedEncodingException { - - store(name); - - records = new Record[recs.length]; - System.arraycopy(recs, 0, records, 0, recs.length); - setAttributes(creatorID, typeID, version, attribute); - } - - /** - * Set the attributes for the {@code PalmDB} object. - * - * @param creatorID The PDB Creator ID. - * @param typeID The PDB Type ID. - * @param version The PDB header version. - * @param attribute The PDB header attribute. - */ - private void setAttributes (int creatorID, int typeID, int version, - short attribute) { - this.creatorID = creatorID; - this.typeID = typeID; - this.version = version; - this.attribute = attribute; - } - - /** - * This private method is mainly used by the constructors above. - * - *

to store bytes into name and also create a {@code String} - * representation, and also by the {@code read} method.

- * - *

TODO: Note that this method assumes that the {@code byte} array - * parameter contains one character per {@code byte}, else it would - * truncate improperly.

- * - * @param bytes PDB name in {@code byte<} array. - * - * @throws UnsupportedEncodingException If ENCODING is not supported. - */ - private void store(byte[] bytes) throws UnsupportedEncodingException { - - // note that this will initialize all bytes in name to 0. - bName = new byte[NAME_LENGTH]; - - // determine minimum length to copy over from bytes to bName. - // Note that the last byte in bName has to be '\0'. - - int lastIndex = NAME_LENGTH - 1; - int len = (bytes.length < lastIndex)? bytes.length: lastIndex; - - int i; - for (i = 0; i < len; i++) { - - if (bytes[i] == 0) { - break; - } - - bName[i] = bytes[i]; - } - - // set sName, no need to include the '\0' character. - sName = new String(bName, 0, i, PdbUtil.ENCODING); - } - - /** - * Returns creator ID. - * - * @return The creator ID. - */ - public int getCreatorID() { - return creatorID; - } - - /** - * Returns type ID. - * - * @return The type ID. - */ - public int getTypeID() { - return typeID; - } - - /** - * Returns attribute flag. - * - * @return The attribute flag. - */ - public short getAttribute() { - return attribute; - } - - /** - * Returns version. - * - * @return The version. - */ - public int getVersion() { - return version; - } - - /** - * Return the number of Records contained in this PDB {@code PalmDB} object. - * - * @return Number of {@code Record} objects. - */ - public int getRecordCount() { - return records.length; - } - - /** - * Return the specific {@code Record} object associated with the - * {@code Record} number. - * - * @param index {@code Record} index number. - * - * @return The {@code Record} object in the specified index - * - * @throws ArrayIndexOutOfBoundsException If index is out of bounds. - */ - public Record getRecord(int index) { - return records[index]; - } - - /** - * Return the list of {@code Record} objects. - * - * @return The array of {@code Record} objects. - */ - public Record[] getRecords() { - return records; - } - - /** - * Return the PDB name associated with this object. - * - * @return The PDB name. - */ - public String getPDBNameString() { - return sName; - } - - /** - * Return the PDB name associated with this object in {@code byte} array of - * exact length of 32 bytes. - * - * @return The PDB name in {@code byte} array of length 32. - */ - public byte[] getPDBNameBytes() { - return bName; - } - - /** - * Override equals method of {@code Object}. - * - *

Two {@code PalmDB} objects are equal if they contain the same - * information, i.e. PDB name and Records.

- * - *

This is used primarily for testing purposes only for now.

- * - * @param obj A {@code PalmDB} {@code Object} to compare. - * - * @return {@code true} if {@code obj} is equal to this, otherwise - * {@code false}. - */ - @Override - public boolean equals(Object obj) { - - boolean bool = false; - - if (obj instanceof PalmDB) { - - PalmDB pdb = (PalmDB) obj; - - checkLabel: { - - // compare sName - if (!sName.equals(pdb.sName)) { - break checkLabel; - } - - // compare bName - if (bName.length != pdb.bName.length) { - break checkLabel; - } - for (int i = 0; i < bName.length; i++) { - if (bName[i] != pdb.bName[i]) { - break checkLabel; - } - } - - // compare each Record - if (records.length != pdb.records.length) { - break checkLabel; - } - for (int i = 0; i < records.length; i++) { - if (!records[i].equals(pdb.records[i])) { - break checkLabel; - } - } - - // all checks done - bool = true; - } - } - - return bool; - } - - @Override - public int hashCode() { - return 0; - } - -} diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDocument.java deleted file mode 100644 index b7fb67bcf886..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDocument.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.palm; - -import java.io.IOException; -import java.io.InputStream; -import java.io.ByteArrayOutputStream; - -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; - -import org.openoffice.xmerge.Document; - -/** - * A {@code PalmDocument} is palm implementation of the {@code Document} - * interface. - * - *

This implementation allows the Palm device format to be read via an - * {@code InputStream} and written via an {@code OutputStream}.

- */ -public class PalmDocument - implements Document { - - /** The internal representation of a pdb. */ - private PalmDB pdb; - - /** The file name. */ - private String fileName; - - /** - * Constructor to create a {@code PalmDocument} from an {@code InputStream}. - * - * @param is {@code InputStream} containing a PDB. - * - * @throws IOException If any I/O error occurs. - */ - public PalmDocument(InputStream is) throws IOException { - read(is); - } - - /** - * Constructor to create a {@code PalmDocument} with {@code Record} objects. - * - *

{@code recs.length} can be zero for an empty PDB.

- * - * @param name Suggested PDB name in {@code String}. - * @param creatorID The PDB Creator ID. - * @param typeID The PDB Type ID. - * @param version The PDB header version. - * @param attribute The PDB header attribute. - * @param recs Array of {@code Record} objects. - * - * @throws NullPointerException If {@code recs} is {@code null}. - */ - public PalmDocument(String name, int creatorID, int typeID, int version, - short attribute, Record[] recs) - throws UnsupportedEncodingException { - pdb = new PalmDB(name, creatorID, typeID, version, attribute, recs); - fileName = pdb.getPDBNameString(); - } - - /** - * Reads in a file from the {@code InputStream}. - * - * @param is {@code InputStream} to read in its content. - * - * @throws IOException If any I/O error occurs. - */ - public void read(InputStream is) throws IOException { - PdbDecoder decoder = new PdbDecoder(); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte[] buf = new byte[4096]; - int n; - while ((n = is.read(buf)) > 0) { - baos.write(buf, 0, n); - } - byte[] bytearr = baos.toByteArray(); - pdb = decoder.parse(bytearr); - fileName = pdb.getPDBNameString(); - } - - /** - * Writes the {@code PalmDocument} to an {@code OutputStream}. - * - * @param os The {@code OutputStream} to write the content. - * - * @throws IOException If any I/O error occurs. - */ - public void write(OutputStream os) throws IOException { - PdbEncoder encoder = new PdbEncoder(pdb); - encoder.write(os); - } - - /** - * Returns the {@code PalmDB} contained in this object. - * - * @return The {@code PalmDB}. - */ - public PalmDB getPdb() { - return pdb; - } - - /** - * Sets the {@code PalmDocument} to a new {@code PalmDB} value. - * - * @param pdb The new {@code PalmDB} value. - */ - public void setPdb(PalmDB pdb) { - this.pdb = pdb; - - String name = pdb.getPDBNameString(); - fileName = name; - } - - /** - * Returns the name of the file. - * - * @return The name of the file represented in the {@code PalmDocument}. - */ - public String getFileName() { - return fileName + ".pdb"; - } - - /** - * Returns the {@code Document} name. - * - * @return The {@code Document} name. - */ - public String getName() { - return fileName; - } -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbDecoder.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbDecoder.java deleted file mode 100644 index b3fbd4df0854..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbDecoder.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.palm; - -import java.io.IOException; -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; - -/** - * Provides functionality to decode a PDB formatted file into a {@code PalmDB} - * object given an {@code InputStream}. - * - *

This class is only used by the {@code PalmDB} object.

- * - *

Sample usage:

- *
{@code PdbDecoder decoder = new PdbDecoder("sample.pdb");
- * PalmDB palmDB = decoder.parse();}
- * - *

This decoder has the following assumptions on the PDB file:

- *
    - *
  1. There is only one RecordList section in the PDB.
  2. - *
  3. The {@code Record} indices in the RecordList are sorted in order, i.e. - * the first {@code Record} index refers to {@code Record} 0, and so - * forth.
  4. - *
  5. The raw {@code Record} in the {@code Record} section are sorted as - * well in order, i.e. first {@code Record} comes ahead of second - * {@code Record}, etc.
  6. - *
- * - *

Other decoders assume these as well.

- * - * @see PalmDB - * @see Record - */ -public final class PdbDecoder { - - /** - * This method decodes a PDB file into a {@code PalmDB} object. - * - *

First, the header data is read using the {@code PdbHeader.read} - * method. Next, the RecordList section is read and the {@code Record} - * offsets are stored for use when parsing the Records. Based on these - * offsets, the bytes corresponding to each {@code Record} are read and - * each is stored in a {@code Record} object. Lastly, the data is used - * to create a {@code PalmDB} object.

- * - * @param b {@code byte[]} containing PDB. - * - * @throws IOException If I/O error occurs. - */ - public PalmDB parse(byte[] b) throws IOException { - - ByteArrayInputStream bais = new ByteArrayInputStream(b); - DataInputStream dis = new DataInputStream(bais); - - // read the PDB header - PdbHeader header = new PdbHeader(); - header.read(dis); - - Record recArray[] = new Record[header.numRecords]; - if (header.numRecords != 0) { - - // read in the record indices + offsets - int recOffset[] = new int[header.numRecords]; - byte recAttrs[] = new byte[header.numRecords]; - - for (int i = 0; i < header.numRecords; i++) { - - recOffset[i] = dis.readInt(); - - // read in attributes (1 byte) + unique id (3 bytes) - // take away the unique id, store the attributes - int attr = dis.readInt(); - recAttrs[i] = (byte) (attr >>> 24); - } - - // read the records - int lastIndex = header.numRecords - 1; - - for (int i = 0; i < lastIndex; i++) { - - //dis.seek(recOffset[i]); - dis.reset(); - int nBytesToSkip = recOffset[i]; - while (nBytesToSkip > 0) { - nBytesToSkip -= dis.skip(nBytesToSkip); - } - int len = recOffset[i+1] - recOffset[i]; - byte[] bytes = new byte[len]; - dis.readFully(bytes); - recArray[i] = new Record(bytes, recAttrs[i]); - } - - // last record - dis.reset(); - int len = dis.available() - recOffset[lastIndex]; - int nBytesToSkip = recOffset[lastIndex]; - while (nBytesToSkip > 0) { - nBytesToSkip -= dis.skip(nBytesToSkip); - } - byte[] bytes = new byte[len]; - dis.readFully(bytes); - recArray[lastIndex] = new Record(bytes, recAttrs[lastIndex]); - } - - // create PalmDB and return it - PalmDB pdb = new PalmDB(header.pdbName, header.creatorID, - header.typeID, header.version, header.attribute, recArray); - - return pdb; - } -} diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbEncoder.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbEncoder.java deleted file mode 100644 index ba32aed20a21..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbEncoder.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.palm; - -import java.io.OutputStream; -import java.io.BufferedOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.Date; - -/** - * Provides functionality to encode a {@code PalmDB} object into a PDB - * formatted file given a file {@code OutputStream}. - * - *

This class is only used by the {@code PalmDB} object.

- * - *

One needs to create one {@code PdbEncoder} object per {@code PalmDB} - * object to be encoded. This class keeps the PDB header data and functionality - * in the {@code PdbHeader} class.

- * - *

Sample usage:

- *
{@code PdbEncoder encoder = new PdbEncoder(palmDB, "STRW", "data");
- * encoder.write(new FileOutputStream("sample.pdb"));}
- * - * @see PalmDB - * @see Record - */ -public final class PdbEncoder { - - /** PDB header. */ - private final PdbHeader header; - - /** the PalmDB object. */ - private final PalmDB db; - - /** The pattern for unique_id=0x00BABE(start). */ - private static final int START_UNIQUE_ID = 0x00BABE; - - - /** - * Constructor. - * - * @param db The {@code PalmDB} to be encoded. - */ - public PdbEncoder(PalmDB db) { - - header = new PdbHeader(); - header.version = db.getVersion(); - - header.attribute = db.getAttribute(); - - this.db = db; - - header.pdbName = db.getPDBNameBytes(); - header.creatorID = db.getCreatorID(); - header.typeID = db.getTypeID(); - - // set the following dates to current date - Date date = new Date(); - header.creationDate = (date.getTime() / 1000) + PdbUtil.TIME_DIFF; - header.modificationDate = header.creationDate; - - header.numRecords = db.getRecordCount(); - } - - /** - * Write out a PDB into the given {@code OutputStream}. - * - *

First, write out the header data by using the {@code PdbHeader.write} - * method. Next, calculate the RecordList section and write it out. Lastly, - * write out the bytes corresponding to each {@code Record}.

- * - *

The RecordList section contains a list of {@code Record} index info, - * where each {@code Record} index info contains:

- * - *
    - *
  • 4 bytes local offset of the {@code Record} from the top of the - * PDB.
  • - *
  • 1 byte of {@code Record} attribute.
  • - *
  • 3 bytes unique {@code Record} ID.
  • - *
- * - *

There should be a total of {@code header.numRecords} of {@code Record} - * index info.

- * - * @param os {@code OutputStream} to write out PDB. - * - * @throws IOException If I/O error occurs. - */ - public void write(OutputStream os) throws IOException { - - BufferedOutputStream bos = new BufferedOutputStream(os); - DataOutputStream dos = new DataOutputStream(bos); - - // write out the PDB header - header.write(dos); - - if (header.numRecords > 0) { - - // compute for recOffset[] - int recOffset[] = new int[header.numRecords]; - byte recAttr[] = new byte[header.numRecords]; - - // first recOffset will be at PdbUtil.HEADER_SIZE + all the - // record indices (@ 8 bytes each) - recOffset[0] = PdbUtil.HEADER_SIZE + (header.numRecords * 8); - - int lastIndex = header.numRecords - 1; - for (int i = 0; i < lastIndex; i++) { - - Record rec = db.getRecord(i); - int size = rec.getSize(); - recAttr[i] = rec.getAttributes(); - - recOffset[i+1] = recOffset[i] + size; - } - - // grab the last record's attribute. - Record lastRec = db.getRecord(lastIndex); - recAttr[lastIndex] = lastRec.getAttributes(); - - int uid = START_UNIQUE_ID; - for (int i = 0; i < header.numRecords; i++) { - - // write out each record offset - dos.writeInt(recOffset[i]); - - // write out record attribute (recAttr) and - // unique ID (uid) in 4 bytes (int) chunk. - // unique ID's have to be unique, thus - // increment each time. - int attr = (recAttr[i] << 24 ); - attr |= uid; - dos.writeInt(attr); - uid++; - } - - // write out the raw records - for (int i = 0; i < header.numRecords; i++) { - - Record rec = db.getRecord(i); - byte bytes[] = rec.getBytes(); - dos.write(bytes); - } - } else { - // placeholder bytes if there are no records in the list. - dos.writeShort(0); - } - - dos.flush(); - } -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbHeader.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbHeader.java deleted file mode 100644 index 280c6e3dbcf5..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbHeader.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.palm; - -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; - -/** - * Class used only internally by {@code PdbEncoder} and {@code PdbDecoder} to - * store, read and write a PDB header. - * - *

Note that fields are intended to be accessible only at the package - * level.

- * - *

Some of the fields are internally represented using a larger type since - * Java does not have unsigned types. Some are not since they are not relevant - * for now. The {@code read} and {@code write} methods should handle them - * properly.

- * - * @see PalmDB - * @see Record - */ -final class PdbHeader { - - /** Name of the database. 32 bytes. */ - byte[] pdbName = null; - - /** - * Flags for the database. Palm UInt16. Unsignedness should be irrelevant. - */ - short attribute = 0; - - /** Application-specific version for the database. Palm UInt16. */ - int version = 0; - - /** Date created. Palm UInt32. */ - long creationDate = 0; - - /** Date last modified. Palm UInt32. */ - long modificationDate = 0; - - /** Date last backup. Palm UInt32. */ - private long lastBackupDate = 0; - - /** - * Incremented every time a {@code Record} is added, deleted or modified. - * Palm UInt32. - */ - private long modificationNumber = 0; - - /** Optional field. Palm UInt32. Unsignedness should be irrelevant. */ - private int appInfoID = 0; - - /** Optional field. Palm UInt32. Unsignedness should be irrelevant. */ - private int sortInfoID = 0; - - /** Database type ID. Palm UInt32. Unsignedness should be irrelevant. */ - int typeID = 0; - - /** Database creator ID. Palm UInt32. Unsignedness should be irrelevant. */ - int creatorID = 0; - - /** ??? */ - private int uniqueIDSeed = 0; - - /** See numRecords. 4 bytes. */ - private int nextRecordListID = 0; - - /** - * Number of Records stored in the database header. - * If all the {@code Record} entries cannot fit in the header, then - * {@code nextRecordList} has the local ID of a RecordList that contains - * the next set of {@code Record}. - * Palm UInt16. - */ - int numRecords = 0; - - /** - * Read in the data for the PDB header. - * - *

Need to preserve the unsigned value for some of the fields.

- * - * @param in A {@code DataInput} object. - * - * @throws IOException If any I/O error occurs. - */ - public void read(DataInput in) throws IOException { - pdbName = new byte[PalmDB.NAME_LENGTH]; - in.readFully(pdbName); - attribute = in.readShort(); - version = in.readUnsignedShort(); - creationDate = in.readInt() & 0xffffffffL; - modificationDate = in.readInt() & 0xffffffffL; - lastBackupDate = in.readInt() & 0xffffffffL; - modificationNumber = in.readInt() & 0xffffffffL; - appInfoID = in.readInt(); - sortInfoID = in.readInt(); - creatorID = in.readInt(); - typeID = in.readInt(); - uniqueIDSeed = in.readInt(); - nextRecordListID = in.readInt(); - numRecords = in.readUnsignedShort(); - } - - /** - * Write out PDB header data. - * - * @param out A {@code DataOutput} object. - * - * @throws IOException If any I/O error occurs. - */ - public void write(DataOutput out) throws IOException { - out.write(pdbName); - out.writeShort(attribute); - out.writeShort(version); - out.writeInt((int) creationDate); - out.writeInt((int) modificationDate); - out.writeInt((int) lastBackupDate); - out.writeInt((int) modificationNumber); - out.writeInt(appInfoID); - out.writeInt(sortInfoID); - out.writeInt(typeID); - out.writeInt(creatorID); - out.writeInt(uniqueIDSeed); - out.writeInt(nextRecordListID); - out.writeShort(numRecords); - } -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbUtil.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbUtil.java deleted file mode 100644 index 829c1c733295..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbUtil.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.palm; - -/** - * Contains common static methods and constants for use within the package. - */ -public final class PdbUtil { - - /** Difference in seconds from Jan 01, 1904 to Jan 01, 1970. */ - static final long TIME_DIFF = 2082844800; - - /** Encoding scheme used. */ - static final String ENCODING = "8859_1"; - - /** Size of a PDB header in bytes. */ - static final int HEADER_SIZE = 78; - -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record.java deleted file mode 100644 index 12d7a0256c87..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.palm; - -import java.io.OutputStream; -import java.io.InputStream; -import java.io.DataOutputStream; -import java.io.DataInputStream; -import java.io.IOException; - -/** - * Contains the raw bytes for a {@code Record} in a PDB. - * - *

Note that it is not associated with a {@code Record} number or ID.

- * - * @see PalmDocument - * @see PalmDB - */ -public final class Record { - - /** {@code Record} {@code byte} array. */ - private byte[] data; - - /** {@code Record} attributes. */ - private byte attributes = 0; - - /** - * Default constructor. - */ - public Record() { - data = new byte[0]; - } - - /** - * Constructor to create a {@code Record} filled with bytes. - * - *

Note that this does not check for 64k {@code Record} sizes. User of - * this class must check for that.

- * - * @param d {@code byte} array contents for this object. - */ - public Record(byte[] d) { - this(d, (byte) 0); - } - - /** - * Constructor to create a {@code Record} filled with bytes and assign - * {@code Record} attributes. - * - *

Note that this does not check for 64k {@code Record} sizes. User of - * this class must check for that.

- * - * @param d {@code byte} array contents for this object. - * @param attrs {@code Record} attributes. - */ - public Record(byte[] d, byte attrs) { - data = new byte[d.length]; - attributes = attrs; - System.arraycopy(d, 0, data, 0, d.length); - } - - /** - * This method returns the number of bytes in this object. - * - * @return Number of bytes in this object. - */ - public int getSize() { - return data.length; - } - - /** - * This method returns the contents of this {@code Object}. - * - * @return Contents in {@code byte} array - */ - public byte[] getBytes() { - return data; - } - - /** - *

This method returns the {@code Record} attributes.

- * - *
{@code Record} attributes consists of (from high to low bit)
-     *
-     * delete (1) - dirty (1) - busy (1) - secret (1) - category (4)
- * - * @return {@code Record} attribute. - */ - public byte getAttributes() { - return attributes; - } - - /** - * Write out the {@code Record} attributes and {@code Record} length - * followed by the data in this {@code Record} object. - * - * @param outs The {@code OutputStream} to write the object. - * - * @throws IOException If any I/O error occurs. - */ - public void write(OutputStream outs) throws IOException { - DataOutputStream out = new DataOutputStream(outs); - out.writeByte(attributes); - out.writeShort(data.length); - out.write(data); - } - - /** - * Read the necessary data to create a PDB from the {@code InputStream}. - * - * @param ins The {@code InputStream} to read data from in order to - * restore the {@code object}. - * - * @throws IOException If any I/O error occurs. - */ - public void read(InputStream ins) throws IOException { - DataInputStream in = new DataInputStream(ins); - attributes = in.readByte(); - int len = in.readUnsignedShort(); - data = new byte[len]; - in.readFully(data); - } - - /** - * Override equals method of {@code Object}. - * - *

Two {@code Record} objects are equal if they contain the same bytes - * in the array and the same attributes.

- * - *

This is used primarily for testing purposes only for now.

- * - * @param obj A {@code Record} object to compare with - * - * @return {@code true} if {@code obj} is equal, otherwise {@code false}. - */ - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Record)) { - return false; - } - Record rec = (Record) obj; - if (rec.getAttributes() != attributes) { - return false; - } - if (rec.getSize() == data.length) { - for (int i = 0; i < data.length; i++) { - if (data[i] != rec.data[i]) { - return false; - } - } - } - return false; - } - - @Override - public int hashCode() { - return 0; - } - -} diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/package-info.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/package-info.java deleted file mode 100644 index 4cc9fcd90c86..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/package-info.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -/** - * Provides classes for converting Palm database data to/from a - * {@code PalmDocument} object, which can be used by the framework. - * - *

This package provides classes that handle the writing of data to an - * {@code OutputStream} object for the {@link - * org.openoffice.xmerge.DocumentSerializer DocumentSerializer} interface for; - * as well as the reading of data from an {@code InputStream} object for the - * framework's {@link org.openoffice.xmerge.DocumentDeserializer - * DocumentDeserializer} interface. Both these framework interfaces are simply - * converters from server-side documents to device specific documents and - * vice-versa. - * Since all Palm databases have a general record oriented format, a Palm - * database converter specific I/O stream format is specified for the Palm sync - * client application to handle the byte stream in a generic way. - * This also means that Palm database converters should read and/or write using - * this I/O stream format as specified in the next section.

- * - * - * - *

Palm database converter specific I/O stream format

- * - *

Note that the format of the byte stream is not exactly that of a PDB file - * encoding. It does not need to contain the PDB header information nor record - * indices section. Instead, it contains the following ...

- *
- *    set header
- *       4 bytes - creator id
- *       4 bytes - type id
- *       2 bytes - PDB header version
- *       2 bytes - PDB header attribute
- *       unsigned 2 bytes - number of PDB data to follow
- *
- *    for each PDB,
- *       32 bytes - name of PDB i
- *       unsigned 2 bytes - number of records in PDB i
- *
- *       for each record contained in PDB i,
- *          1 byte - record attributes
- *          unsigned 2 bytes - size of record j in PDB i
- *          x bytes - data
- * 
- * - *

Note that each PDB section is appended by another if there is more than - * one.

- * - *

Since the {@code PalmDocument} class takes care of the writing and reading - * of this format through its {@code write} and {@code read} methods, - * respectively, this format shall also be referred to as the PalmDocument - * stream format.

- * - *

Usage of the classes for the specified I/O stream

- * - *

When converting from a server document to device document(s), the - * framework requires writing the device document(s) to an {@code OutputStream} - * object via the {@code DocumentSerializer} interface. Note that a single - * server document may be converted into multiple PDB's on the Palm device. - * Each worksheet in the document is converted into a {@code PalmDocument}. - * Thus, if there is more than one worksheet in the document, more than one - * {@code PalmDocument} will be produced by the {@code DocumentSerializer}.

- * - *

A {@code DocumentSerializer} creates a {@code ConvertData} object, which - * contains all of the {@code PalmDocuments}. The {@link - * org.openoffice.xmerge.converter.palm.PalmDocument#write write} method to - * write to the given {@code OutputStream}. - * The {@code PalmDocument} object will take care of writing the data in the - * specified format.

- * - *

A {@code DocumentDeserializer} can use the {@code PalmDocument} object's - * {@link org.openoffice.xmerge.converter.palm.PalmDocument#read read} method - * to fill in all the {@code PalmDocument} object's data.

- * - *

PDB file encoding/decoding

- * - *

The {@code PalmDocument} object's read and write functions are provided by - * the {@code PdbDecoder} and {@code PdbEncoder} objects. - * The {@code PdbEncoder} class provides the functionality of encoding a - * {@code PalmDB} object into an {@code InputStream}, while the - * {@code PdbDecoder} class provides the functionality of decoding a PDB file - * into an {@code OutputStream}.

- * - *

Refer to the class description of each for usage.

- * - *

Important Note

- * - *

Methods in these classes are not thread safe for performance reasons. - * Users of these classes will have to make sure that the usage of these classes - * are done in a proper manner. Possibly more on this later.

- * - *

TODO list

- * - *
    - *
  1. Merge the PalmDB, PdbDecoder and PdbEncoder classes into the PalmDocument - * class.
  2. - *
  3. After reading more on the palm file format spec, I realized that there - * are certain optional fields that may need to be addressed still, like the - * appInfo block and sortInfo block.
  4. - *
  5. The current PdbDecoder only returns a PalmDB object. There are other - * information that we may want to expose from the PDB decoding process.
  6. - *
  7. Investigate on different language encoding on the Palm and how that - * affects the PDB name.
  8. - *
- */ -package org.openoffice.xmerge.converter.palm; diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedBinaryObject.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedBinaryObject.java deleted file mode 100644 index 6ac60f183f13..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedBinaryObject.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.xml; - -import org.w3c.dom.Document; -import org.w3c.dom.DOMException; -import org.w3c.dom.Element; - -/** - * This class represents embedded object's in an OpenOffice.org document that - * have a binary representation. - */ -public class EmbeddedBinaryObject extends EmbeddedObject { - - /** The object's binary representation. */ - private byte[] objData = null; - - /** - * Constructor for an embedded object stored using an XML representation. - * - * @param name The name of the object. - * @param type The mime-type of the object. See the class summary. - */ - public EmbeddedBinaryObject(String name, String type) { - super(name, type); - } - - /** - * Package private constructor for use when reading an object from a - * compressed SX? file. - * - * @param name The name of the object. - * @param type The mime-type of the object. See the class summary. - * @param source The OfficeZip representation of the SX? file that stores - * the object. - */ - EmbeddedBinaryObject(String name, String type, OfficeZip source) { - super(name, type, source); - } - - /** - * This method returns the data for this object. - * - * @return A {@code byte} array containing the object's data. - */ - public byte[] getBinaryData() { - - // See if we came from a Zip file - if (objData == null && zipFile != null) { - objData = zipFile.getNamedBytes(objName); - } - - return objData; - } - - /** - * Sets the data for this object. - * - * @param data A {@code byte} array containing data for the object. - */ - public void setBinaryData(byte[] data) { - objData = data; - hasChanged = true; - } - - /** - * Package private method for writing the data of the EmbeddedObject to a - * SX? file. - * - * @param zip An {@code OfficeZip} instance representing the file the - * data is to be written to. - */ - @Override - void write(OfficeZip zip) { - if (hasChanged) { - zip.setNamedBytes(objName, objData); - } - } - - /** - * Package private method that constructs the manifest.xml entries for this - * embedded object. - */ - @Override - void writeManifestData(Document manifestDoc) throws DOMException { - Element objNode = manifestDoc.createElement(OfficeConstants.TAG_MANIFEST_FILE); - - objNode.setAttribute(OfficeConstants.ATTRIBUTE_MANIFEST_FILE_TYPE, objType); - objNode.setAttribute(OfficeConstants.ATTRIBUTE_MANIFEST_FILE_PATH, objName); - - manifestDoc.getDocumentElement().appendChild(objNode); - } -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedObject.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedObject.java deleted file mode 100644 index fc05447b28d9..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedObject.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.xml; - -import java.io.IOException; - -import org.w3c.dom.Document; -import org.w3c.dom.DOMException; - -public abstract class EmbeddedObject { - protected String objName; - protected String objType; - - /** Representation of the file from which this object was read. */ - protected OfficeZip zipFile = null; - - /** Flag indicating if this document has changed since reading or is new. */ - protected boolean hasChanged = false; - - /** - * Constructor for an embedded object stored using an XML representation. - * - * @param name The name of the object. - * @param type The mime-type of the object. See the class summary. - */ - public EmbeddedObject(String name, String type) { - objName = name; - objType = type; - - hasChanged = true; - } - - /** - * Package private constructor for use when reading an object from a - * compressed SX? file. - * - * @param name The name of the object. - * @param type The mime-type of the object. See the class summary. - * @param source The OfficeZip representation of the SX? file that stores - * the object. - */ - EmbeddedObject(String name, String type, OfficeZip source) { - this(name, type); - zipFile = source; - } - - /** - * Retrieves the name of the embedded object represented by an instance of - * this class. - * - * N.B.The name refers to the name as found in the - * {@code META-INF/manifest.xml} file. - * - * @return The name of the object. - */ - public final String getName() { - return objName; - } - - /** - * Retrieves the type of the embedded object represented by an instance of - * this class. - * - * The {@code META-INF/manifest.xml} file currently represents the type of - * an object using MIME types. - */ - public final String getType() { - return objType; - } - - /** - * Package private method for writing the data of the EmbeddedObject to a - * SX? file. - * - * @param zip An {@code OfficeZip} instance representing the file the - * data is to be written to. - */ - abstract void write(OfficeZip zip) throws IOException; - - /** - * Package private method that constructs the manifest.xml entries for this - * embedded object. - */ - abstract void writeManifestData(Document manifestDoc) throws DOMException; -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedXMLObject.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedXMLObject.java deleted file mode 100644 index 8f8ac1bf7cf7..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/EmbeddedXMLObject.java +++ /dev/null @@ -1,280 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.xml; - -import java.io.IOException; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.w3c.dom.Document; -import org.w3c.dom.DOMException; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import org.xml.sax.SAXException; - -/** - * This class represents those embedded objects in an OpenOffice.org document - * that have an XML representation. - * - *

Currently, according to the OpenOffice.org File Format 1.0 document, - * there are 6 such objects:

- *
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
DescriptionObject
Formula created with Mathapplication/vnd.sun.xml.math
Charts created with Chartapplication/vnd.sun.xml.chart
Spreadsheets created with Calcapplication/vnd.sun.xml.calc
Text created with Writerapplication/vnd.sun.xml.writer
Drawings created with Drawapplication/vnd.sun.xml.draw
Presentations created with Impressapplication/vnd.sun.xml.impress
- * - *

These object types are stored using a combination of content, settings and - * styles XML files.

- */ -public class EmbeddedXMLObject extends EmbeddedObject { - - // Entries for the subdocuments that constitute this object; - private Document contentDOM = null; - private Document settingsDOM = null; - private Document stylesDOM = null; - - private DocumentBuilder builder = null; - - /** - * Constructor for an embedded object stored using an XML representation. - * - * @param name The name of the object. - * @param type The mime-type of the object. See the class summary. - */ - public EmbeddedXMLObject(String name, String type) { - super(name, type); - } - - /** - * Package private constructor for use when reading an object from a - * compressed SX? file. - * - * @param name The name of the object. - * @param type The mime-type of the object. See the class summary. - * @param source The OfficeZip representation of the SX? file that stores - * the object. - */ - EmbeddedXMLObject(String name, String type, OfficeZip source) { - super(name, type, source); - } - - /** - * Returns the content data for this embedded object. - * - * @return DOM representation of "content.xml". - * - * @throws SAXException If any parser error occurs. - * @throws IOException If any IO error occurs. - */ - public Document getContentDOM() throws SAXException, IOException { - - if (contentDOM == null) { - contentDOM = getNamedDOM("content.xml"); - } - - return contentDOM; - } - - /** - * Sets the content data for the embedded object. - * - * @param content DOM representation of the object's content. - */ - public void setContentDOM(Document content) { - contentDOM = content; - hasChanged = true; - } - - /** - * Returns the settings data for this embedded object. - * - * @return DOM representation of "settings.xml" - * - * @throws SAXException If any parser error occurs. - * @throws IOException If any IO error occurs. - */ - public Document getSettingsDOM() throws SAXException, IOException { - - if (settingsDOM == null) { - settingsDOM = getNamedDOM("settings.xml"); - } - - return settingsDOM; - } - - /** - * Sets the settings data for the embedded object. - * - * @param settings DOM representation of the object's styles. - */ - public void setSettingsDOM(Document settings) { - settingsDOM = settings; - hasChanged = true; - } - - /** - * Returns the style data for this embedded object. - * - * @return DOM representation of "styles.xml". - * - * @throws SAXException If any parser error occurs. - * @throws IOException If any IO error occurs. - */ - public Document getStylesDOM() throws SAXException, IOException { - - if (stylesDOM == null) { - stylesDOM = getNamedDOM("styles.xml"); - } - - return stylesDOM; - } - - /** - * Sets the styles data for the embedded object. - * - * @param styles DOM representation of the object's styles. - */ - public void setStylesDOM(Document styles) { - stylesDOM = styles; - hasChanged = true; - } - - /** - * This method extracts the data for the given XML file from the SX? file - * and creates a DOM representation of it. - * - * @param name The name of the XML file to retrieve. It is paired with - * the object name to access the SX? file. - * - * @return DOM representation of the named XML file. - * - * @throws SAXException If any parser error occurs. - * @throws IOException If any IO error occurs. - */ - private Document getNamedDOM(String name) throws SAXException, IOException { - if (zipFile == null) { - return null; - } - - try { - if (builder == null) { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); - factory.setValidating(false); - builder = factory.newDocumentBuilder(); - } - - byte[] data = zipFile.getNamedBytes((objName + "/" + name)); - if (data != null) { - return OfficeDocument.parse(builder, data); - } else { - return null; - } - - } catch (ParserConfigurationException pce) { - throw new SAXException(pce); - } - } - - /** - * Package private method for writing the data of the EmbeddedObject to a - * SX? file. - * - * @param zip An {@code OfficeZip} instance representing the file the data - * is to be written to. - */ - @Override - void write(OfficeZip zip) throws IOException { - if (hasChanged) { - if (contentDOM != null) { - zip.setNamedBytes((objName + "/content.xml"), - OfficeDocument.docToBytes(contentDOM)); - } - if (settingsDOM != null) { - zip.setNamedBytes((objName + "/settings.xml"), - OfficeDocument.docToBytes(settingsDOM)); - } - if (stylesDOM != null) { - zip.setNamedBytes((objName + "/styles.xml"), - OfficeDocument.docToBytes(stylesDOM)); - } - } - } - - /** - * Package private method that constructs the manifest.xml entries for this - * embedded object. - * - * @param manifestDoc {@code Document} containing the manifest entries. - */ - @Override - void writeManifestData(Document manifestDoc) throws DOMException { - Node root = manifestDoc.getDocumentElement(); - - if (contentDOM != null) { - Element contentNode = manifestDoc.createElement(OfficeConstants.TAG_MANIFEST_FILE); - - contentNode.setAttribute(OfficeConstants.ATTRIBUTE_MANIFEST_FILE_TYPE, "text/xml"); - contentNode.setAttribute(OfficeConstants.ATTRIBUTE_MANIFEST_FILE_PATH, (objName + "/content.xml")); - - root.appendChild(contentNode); - } - - if (settingsDOM != null) { - Element settingsNode = manifestDoc.createElement(OfficeConstants.TAG_MANIFEST_FILE); - - settingsNode.setAttribute(OfficeConstants.ATTRIBUTE_MANIFEST_FILE_TYPE, "text/xml"); - settingsNode.setAttribute(OfficeConstants.ATTRIBUTE_MANIFEST_FILE_PATH, (objName + "/settings.xml")); - - root.appendChild(settingsNode); - } - - if (stylesDOM != null) { - Element stylesNode = manifestDoc.createElement(OfficeConstants.TAG_MANIFEST_FILE); - - stylesNode.setAttribute(OfficeConstants.ATTRIBUTE_MANIFEST_FILE_TYPE, "text/xml"); - stylesNode.setAttribute(OfficeConstants.ATTRIBUTE_MANIFEST_FILE_PATH, (objName + "/styles.xml")); - } - - Element objectNode = manifestDoc.createElement(OfficeConstants.TAG_MANIFEST_FILE); - - objectNode.setAttribute(OfficeConstants.ATTRIBUTE_MANIFEST_FILE_TYPE, objType); - objectNode.setAttribute(OfficeConstants.ATTRIBUTE_MANIFEST_FILE_PATH, (objName + "/")); - - root.appendChild(objectNode); - } -} diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeConstants.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeConstants.java deleted file mode 100644 index 8605c6ad63ee..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeConstants.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.xml; - -/** - * This interface contains constants for StarOffice XML tags, attributes - * (StarCalc cell types, etc.). - */ -public interface OfficeConstants { - - /** Element tag for office:document, this is the root tag. */ - String TAG_OFFICE_DOCUMENT = "office:document"; - - /** - * Element tag for office:document-content, this is the root tag in - * content.xml. - */ - String TAG_OFFICE_DOCUMENT_CONTENT = "office:document-content"; - - /** - * Element tag for office:document-settings, this is the root tag in - * content.xml. - */ - String TAG_OFFICE_DOCUMENT_SETTINGS= "office:document-settings"; - - /** - * Element tag for office:document-meta, this is the root tag in - * content.xml. - */ - String TAG_OFFICE_DOCUMENT_META= "office:document-meta"; - - /** - * Element tag for office:document-styles, this is the root tag in - * styles.xml. - */ - String TAG_OFFICE_DOCUMENT_STYLES = "office:document-styles"; - - /** Element tag for office:styles. */ - String TAG_OFFICE_STYLES = "office:styles"; - - /** Element tag for office:meta. */ - String TAG_OFFICE_META = "office:meta"; - - /** Element tag for office:automatic-styles. */ - String TAG_OFFICE_AUTOMATIC_STYLES = "office:automatic-styles"; - - /** Element tag for office:master-styles. */ - String TAG_OFFICE_MASTER_STYLES = "office:master-styles"; - - /** Element tag for office:body. */ - String TAG_OFFICE_BODY = "office:body"; - - /** Element tag for office:settings. */ - String TAG_OFFICE_SETTINGS = "office:settings"; - - /** Element tag for office:font-decls. */ - String TAG_OFFICE_FONT_DECLS = "office:font-decls"; - - /** Element tag for style:font-decl. */ - String TAG_STYLE_FONT_DECL = "style:font-decl"; - - /** Attribute tag for style:name of element style:name. */ - String ATTRIBUTE_STYLE_NAME = "style:name"; - - /** - * Attribute tag for style:font-pitch of element - * style:font-pitch. - */ - String ATTRIBUTE_STYLE_FONT_PITCH = "style:font-pitch"; - - /** - * Attribute tag for fo:font-family of element - * fo:font-family. - */ - String ATTRIBUTE_FO_FONT_FAMILY = "fo:font-family"; - - /** - * Attribute tag for fo:font-family of element - * fo:font-family. - */ - String ATTRIBUTE_FO_FONT_FAMILY_GENERIC = "fo:font-family-generic"; - - /** Element tag for text:p. */ - String TAG_PARAGRAPH = "text:p"; - - /** Element tag for text:h. */ - String TAG_HEADING = "text:h"; - - /** Element tag for text:s. */ - String TAG_SPACE = "text:s"; - - /** Element tag for text:tab-stop. */ - String TAG_TAB_STOP = "text:tab-stop"; - - /** Element tag for text:line-break. */ - String TAG_LINE_BREAK = "text:line-break"; - - /** Element tag for text:span. */ - String TAG_SPAN = "text:span"; - - /** Element tag for text:a. */ - String TAG_HYPERLINK = "text:a"; - - /** Element tag for text:unordered-list. */ - String TAG_UNORDERED_LIST = "text:unordered-list"; - - /** Element tag for text:ordered-list. */ - String TAG_ORDERED_LIST = "text:ordered-list"; - - /** Element tag for text:list-header. */ - String TAG_LIST_HEADER = "text:list-header"; - - /** Element tag for text:list-item. */ - String TAG_LIST_ITEM = "text:list-item"; - - /** Attribute tag for text:c of element text:s. */ - String ATTRIBUTE_SPACE_COUNT = "text:c"; - - /** Element tag for table:table. */ - String TAG_TABLE = "table:table"; - - /** Element tag for table:named-expression. */ - String TAG_NAMED_EXPRESSIONS = "table:named-expressions"; - - /** Element tag for table:named-range. */ - String TAG_TABLE_NAMED_RANGE= "table:named-range"; - - /** Element tag for table:named-expression. */ - String TAG_TABLE_NAMED_EXPRESSION= "table:named-expression"; - - /** Attribute tag for table:name of element table:table. */ - String ATTRIBUTE_TABLE_NAME = "table:name"; - - /** - * Attribute tag for table:expression of element - * table:named-range. - */ - String ATTRIBUTE_TABLE_EXPRESSION = "table:expression"; - - /** - * Attribute tag for table:base-cell-address of element - * table:named-range. - */ - String ATTRIBUTE_TABLE_BASE_CELL_ADDRESS = "table:base-cell-address"; - - /** - * Attribute tag for table:cell-range-address of element - * table:named-range. - */ - String ATTRIBUTE_TABLE_CELL_RANGE_ADDRESS = "table:cell-range-address"; - - /** Element tag for table:table-row. */ - String TAG_TABLE_ROW = "table:table-row"; - - /** Element tag for table:table-column. */ - String TAG_TABLE_COLUMN = "table:table-column"; - - /** - * Attribute tag for table:default-cell-style-name of element - * table:table-column. - */ - String ATTRIBUTE_DEFAULT_CELL_STYLE = "table:default-cell-style-name"; - - /** Element tag for table:scenario. */ - String TAG_TABLE_SCENARIO = "table:scenario"; - - /** Element tag for table:table-cell. */ - String TAG_TABLE_CELL = "table:table-cell"; - - /** - * Attribute tag for table:value-type of element - * table:table-cell. - */ - String ATTRIBUTE_TABLE_VALUE_TYPE = "table:value-type"; - - /** - * Attribute tag for table:number-columns-repeated of element - * table:table-cell. - */ - String ATTRIBUTE_TABLE_NUM_COLUMNS_REPEATED = - "table:number-columns-repeated"; - - /** - * Attribute tag for table:number-rows-repeated of element - * table:table-row. - */ - String ATTRIBUTE_TABLE_NUM_ROWS_REPEATED = "table:number-rows-repeated"; - - /** - * Attribute tag for table:formula of element - * table:table-cell. - */ - String ATTRIBUTE_TABLE_FORMULA = "table:formula"; - - /** - * Attribute tag for table:value of element table:table-cell. - */ - String ATTRIBUTE_TABLE_VALUE = "table:value"; - - /** - * Attribute tag for table:date-value of element - * table:table-cell. - */ - String ATTRIBUTE_TABLE_DATE_VALUE = "table:date-value"; - - /** - * Attribute tag for table:time-value of element - * table:table-cell. - */ - String ATTRIBUTE_TABLE_TIME_VALUE = "table:time-value"; - - /** - * Attribute tag for table:string-value of element - * table:table-cell. - */ - String ATTRIBUTE_TABLE_STRING_VALUE = "table:string-value"; - - /** - * Attribute tag for table:time-boolean-value of element - * table:table-cell. - */ - String ATTRIBUTE_TABLE_BOOLEAN_VALUE = "table:boolean-value"; - - /** Attribute tag for table:style-name of table elements. */ - String ATTRIBUTE_TABLE_STYLE_NAME = "table:style-name"; - - /** - * Attribute tag for table:currency of element - * table:table-cell. - */ - String ATTRIBUTE_TABLE_CURRENCY = "table:currency"; - - /** The cell contains data of type string. */ - String CELLTYPE_STRING = "string"; - - /** The cell contains data of type float. */ - String CELLTYPE_FLOAT = "float"; - - /** The cell contains data of type time. */ - String CELLTYPE_TIME = "time"; - - /** The cell contains data of type date. */ - String CELLTYPE_DATE = "date"; - - /** The cell contains data of type currency. */ - String CELLTYPE_CURRENCY = "currency"; - - /** The cell contains data of type boolean. */ - String CELLTYPE_BOOLEAN = "boolean"; - - /** The cell contains data of type percent. */ - String CELLTYPE_PERCENT = "percentage"; - - /** StarWriter XML file extension. */ - String SXW_FILE_EXTENSION = ".sxw"; - - /** StarWriter XML office:class value. */ - String SXW_TYPE = "text"; - - /** StarCalc XML file extension. */ - String SXC_FILE_EXTENSION = ".sxc"; - - /** StarCalc XML office:class value. */ - String SXC_TYPE = "spreadsheet"; - - /** Element tag for manifest:manifestentry in Manifest XML */ - String TAG_MANIFEST_ROOT = "manifest:manifest"; - - /** Element tag for manifest:file-entry entry in Manifest XML. */ - String TAG_MANIFEST_FILE = "manifest:file-entry"; - - /** - * Attribute tag for manifest:media-type of element - * manifest:file-entry. - */ - String ATTRIBUTE_MANIFEST_FILE_TYPE = "manifest:media-type"; - - /** - * Attribute tag for manifest:full-path of element - * manifest:file-entry. - */ - String ATTRIBUTE_MANIFEST_FILE_PATH = "manifest:full-path"; - - // Tags and Elements for the settings.xml - - /** Element tag for config:config-item. */ - String TAG_CONFIG_ITEM = "config:config-item"; - - /** Element tag for config:config-item-set. */ - String TAG_CONFIG_ITEM_SET = "config:config-item-set"; - - /** Element tag for config:config-item-map-indexed. */ - String TAG_CONFIG_ITEM_MAP_INDEXED = "config:config-item-map-indexed"; - - /** Element tag for config:config-item-map-named. */ - String TAG_CONFIG_ITEM_MAP_NAMED = "config:config-item-map-named"; - - /** Element tag for config:config-item-map-entry. */ - String TAG_CONFIG_ITEM_MAP_ENTRY= "config:config-item-map-entry"; - - /** - * Attribute tag for config:name of element config:config-item. - */ - String ATTRIBUTE_CONFIG_NAME = "config:name"; - - /** - * Attribute tag for config:type of element config:config-item. - */ - String ATTRIBUTE_CONFIG_TYPE = "config:type"; - - /** StarWriter XML MIME type. */ - String SXW_MIME_TYPE = "application/vnd.sun.xml.writer"; - - /** StarCalc XML MIME type. */ - String SXC_MIME_TYPE = "application/vnd.sun.xml.calc"; - -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java deleted file mode 100644 index 1fd074cccd5d..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java +++ /dev/null @@ -1,1143 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.xml; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.BufferedReader; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.InputStreamReader; -import java.io.ByteArrayOutputStream; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.Iterator; -import java.util.Map; -import java.util.HashMap; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.XMLConstants; - -import org.w3c.dom.Node; -import org.w3c.dom.Element; -import org.w3c.dom.Document; -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.DocumentType; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.w3c.dom.NamedNodeMap; -import org.xml.sax.SAXException; - -import javax.xml.transform.*; -import javax.xml.transform.dom.*; -import javax.xml.transform.stream.*; - -import org.openoffice.xmerge.util.Debug; - -/** - * An implementation of {@code Document} for StarOffice documents. - */ -public abstract class OfficeDocument - implements org.openoffice.xmerge.Document, OfficeConstants { - - private static DocumentBuilderFactory makeFactory() { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - - try { - factory.setFeature("http://xml.org/sax/features/external-general-entities", false); - } catch (ParserConfigurationException e) { - Debug.log(Debug.ERROR, "Exception when calling setFeature: ", e); - } - - try { - factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); - } catch (ParserConfigurationException e) { - Debug.log(Debug.ERROR, "Exception when calling setFeature: ", e); - } - - try { - factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); - } catch (ParserConfigurationException e) { - Debug.log(Debug.ERROR, "Exception when calling setFeature: ", e); - } - - try { - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } catch (ParserConfigurationException e) { - Debug.log(Debug.ERROR, "Exception when calling setFeature: ", e); - } - - return factory; - } - - /** Factory for {@code DocumentBuilder} objects. */ - private static DocumentBuilderFactory factory = makeFactory(); - - /** DOM {@code Document} of content.xml. */ - private Document contentDoc = null; - - /** DOM {@code Document} of meta.xml. */ - private Document metaDoc = null; - - /** DOM {@code Document} of settings.xml. */ - private Document settingsDoc = null; - - /** DOM {@code Document} of content.xml. */ - private Document styleDoc = null; - - /** DOM {@code Document} of @code META-INF/manifest.xml. */ - private Document manifestDoc = null; - - private String documentName = null; - private String fileName = null; - - /** - * {@code OfficeZip} object to store zip contents from read - * {@code InputStream}. - * - *

Note that this member will still be null if it was initialized using - * a template file instead of reading from a StarOffice zipped XML file.

- */ - private OfficeZip zip = null; - - /** Collection to keep track of the embedded objects in the document. */ - private Map embeddedObjects = null; - - /** - * Default constructor. - * - * @param name {@code Document} name. - */ - public OfficeDocument(String name) { - this(name, true, false); - } - - /** - * Constructor with arguments to set {@code namespaceAware} and - * {@code validating} flags. - * - * @param name {@code Document} name (may or may not contain - * extension). - * @param namespaceAware Value for {@code namespaceAware} flag. - * @param validating Value for {@code validating} flag. - */ - public OfficeDocument(String name, boolean namespaceAware, boolean validating) { - factory.setValidating(validating); - factory.setNamespaceAware(namespaceAware); - this.documentName = trimDocumentName(name); - this.fileName = documentName + getFileExtension(); - } - - /** - * Removes the file extension from the {@code Document} name. - * - * @param name Full {@code Document} name with extension. - * - * @return Name of {@code Document} without the extension. - */ - private String trimDocumentName(String name) { - String temp = name.toLowerCase(); - String ext = getFileExtension(); - - if (temp.endsWith(ext)) { - // strip the extension - int nlen = name.length(); - int endIndex = nlen - ext.length(); - name = name.substring(0,endIndex); - } - - return name; - } - - /** - * Return a DOM {@code Document} object of the content.xml file. - * - *

Note that a content DOM is not created when the constructor is called. - * So, either the {@code read} method or the {@code initContentDOM} method - * will need to be called ahead on this object before calling this method.

- * - * @return DOM {@code Document} object. - */ - public Document getContentDOM() { - - return contentDoc; - } - - /** - * Return a DOM {@code Document} object of the meta.xml file. - * - *

Note that a content DOM is not created when the constructor is called. - * So, either the {@code read} method or the {@code initContentDOM} method - * will need to be called ahead on this object before calling this method.

- * - * @return DOM Document object. - */ - public Document getMetaDOM() { - - return metaDoc; - } - - /** - * Return a DOM {@code Document} object of the settings.xml file. - * - *

Note that a content DOM is not created when the constructor is called. - * So, either the {@code read} method or the {@code initContentDOM} method - * will need to be called ahead on this object before calling this method.

- * - * @return DOM {@code Document} object. - */ - public Document getSettingsDOM() { - - return settingsDoc; - } - - /** - * Sets the content tree of the document. - * - * @param newDom {@code Node} containing the new content tree. - */ - public void setContentDOM( Node newDom) { - contentDoc = (Document)newDom; - } - - /** - * Sets the meta tree of the document. - * - * @param newDom {@code Node} containing the new meta tree. - */ - public void setMetaDOM (Node newDom) { - metaDoc = (Document)newDom; - } - - /** - * Sets the settings tree of the document. - * - * @param newDom {@code Node} containing the new settings tree. - */ - public void setSettingsDOM (Node newDom) { - settingsDoc = (Document)newDom; - } - - /** - * Sets the style tree of the document. - * - * @param newDom {@code Node} containing the new style tree. - */ - public void setStyleDOM (Node newDom) { - styleDoc = (Document)newDom; - } - - /** - * Return a DOM {@code Document} object of the style.xml file. - * - *

Note that this may return {@code null} if there is no style DOM.

- *

Note that a style DOM is not created when the constructor is called. - * Depending on the {@code InputStream}, a {@code read} method may or may - * not build a style DOM. When creating a new style DOM, call the - * {@code initStyleDOM} method first.

- * - * @return DOM {@code Document} object. - */ - public Document getStyleDOM() { - - return styleDoc; - } - - /** - * Return the name of the {@code Document}. - * - * @return The name of {@code Document}. - */ - public String getName() { - - return documentName; - } - - /** - * Return the file name of the {@code Document}, possibly with the standard - * extension. - * - * @return The file name of {@code Document}. - */ - public String getFileName() { - - return fileName; - } - - /** - * Returns the file extension for this type of {@code Document}. - * - * @return The file extension of {@code Document}. - */ - protected abstract String getFileExtension(); - - /** - * Returns all the embedded objects (graphics, formulae, etc.) present in - * this document. - * - * @return An {@code Iterator} of {@code EmbeddedObject} objects. - */ - private Iterator getEmbeddedObjects() { - - if (embeddedObjects == null && manifestDoc != null) { - embeddedObjects = new HashMap(); - - // Need to read the manifest file and construct a list of objects - NodeList nl = manifestDoc.getElementsByTagName(TAG_MANIFEST_FILE); - - // Don't create the HashMap if there are no embedded objects - int len = nl.getLength(); - for (int i = 0; i < len; i++) { - Node n = nl.item(i); - - NamedNodeMap attrs = n.getAttributes(); - - String type = attrs.getNamedItem(ATTRIBUTE_MANIFEST_FILE_TYPE).getNodeValue(); - String path = attrs.getNamedItem(ATTRIBUTE_MANIFEST_FILE_PATH).getNodeValue(); - - /* - * According to OpenOffice.org XML File Format document (ver. 1) - * there are only two types of embedded object: - * - * Objects with an XML representation. - * Objects without an XML representation. - * - * The former are represented by one or more XML files. - * The latter are in binary form. - */ - if (type.startsWith("application/vnd.sun.xml")) - { - if (path.equals("/")) { - // Exclude the main document entries - continue; - } - // Take off the trailing '/' - String name = path.substring(0, path.length() - 1); - embeddedObjects.put(name, new EmbeddedXMLObject(name, type, zip)); - } - else if (type.equals("text/xml")) { - // XML entries are either embedded StarOffice doc entries or main - // document entries - continue; - } - else { // FIX (HJ): allows empty MIME type - embeddedObjects.put(path, new EmbeddedBinaryObject(path, type, zip)); - } - } - } - - if (embeddedObjects == null) { - return null; - } - - return embeddedObjects.values().iterator(); - } - - /** - * Read the Office {@code Document} from the given {@code InputStream}. - * - * @param is Office document {@code InputStream}. - * - * @throws IOException If any I/O error occurs. - */ - public void read(InputStream is) throws IOException { - - Debug.log(Debug.INFO, "reading Office file"); - DocumentBuilder builder = null; - - try { - builder = factory.newDocumentBuilder(); - } catch (ParserConfigurationException ex) { - throw new OfficeDocumentException(ex); - } - - // read in Office zip file format - zip = new OfficeZip(); - zip.read(is); - - // grab the content.xml and - // parse it into contentDoc. - byte contentBytes[] = zip.getContentXMLBytes(); - if (contentBytes == null) { - throw new OfficeDocumentException("Entry content.xml not found in file"); - } - try { - contentDoc = parse(builder, contentBytes); - } catch (SAXException ex) { - throw new OfficeDocumentException(ex); - } - - // if style.xml exists, grab the style.xml - // parse it into styleDoc. - byte styleBytes[] = zip.getStyleXMLBytes(); - if (styleBytes != null) { - try { - styleDoc = parse(builder, styleBytes); - } catch (SAXException ex) { - throw new OfficeDocumentException(ex); - } - } - - byte metaBytes[] = zip.getMetaXMLBytes(); - if (metaBytes != null) { - try { - metaDoc = parse(builder, metaBytes); - } catch (SAXException ex) { - throw new OfficeDocumentException(ex); - } - } - - byte settingsBytes[] = zip.getSettingsXMLBytes(); - if (settingsBytes != null) { - try { - settingsDoc = parse(builder, settingsBytes); - - } catch (SAXException ex) { - throw new OfficeDocumentException(ex); - } - } - - // Read in the META-INF/manifest.xml file - byte manifestBytes[] = zip.getManifestXMLBytes(); - if (manifestBytes != null) { - try { - manifestDoc = parse(builder, manifestBytes); - } catch (SAXException ex) { - throw new OfficeDocumentException(ex); - } - } - } - - /** - * Read the Office {@code Document} from the given {@code InputStream}. - * - * @param is Office document {@code InputStream}. - * @param isZip {@code boolean} Identifies whether a file is zipped or not. - * - * @throws IOException If any I/O error occurs. - */ - public void read(InputStream is, boolean isZip) throws IOException { - - Debug.log(Debug.INFO, "reading Office file"); - - DocumentBuilder builder = null; - - try { - builder = factory.newDocumentBuilder(); - } catch (ParserConfigurationException ex) { - throw new OfficeDocumentException(ex); - } - - if (isZip) { - read(is); - } else { - try { - Reader r = secondHack(is); - InputSource ins = new InputSource(r); - org.w3c.dom.Document newDoc = builder.parse(ins); - Element rootElement = newDoc.getDocumentElement(); - - NodeList nodeList; - Node tmpNode; - Node rootNode = rootElement; - - /* content */ - contentDoc = createDOM(TAG_OFFICE_DOCUMENT_CONTENT); - rootElement = contentDoc.getDocumentElement(); - rootNode = rootElement; - - // FIX (HJ): Include office:font-decls in content DOM - nodeList = newDoc - .getElementsByTagName(TAG_OFFICE_FONT_DECLS); - if (nodeList.getLength() > 0) { - tmpNode = contentDoc.importNode(nodeList.item(0), true); - rootNode.appendChild(tmpNode); - } - - nodeList = newDoc - .getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES); - if (nodeList.getLength() > 0) { - tmpNode = contentDoc.importNode(nodeList.item(0), true); - rootNode.appendChild(tmpNode); - } - - nodeList = newDoc.getElementsByTagName(TAG_OFFICE_BODY); - if (nodeList.getLength() > 0) { - tmpNode = contentDoc.importNode(nodeList.item(0), true); - rootNode.appendChild(tmpNode); - } - - /* Styles */ - styleDoc = createDOM(TAG_OFFICE_DOCUMENT_STYLES); - rootElement = styleDoc.getDocumentElement(); - rootNode = rootElement; - - // FIX (HJ): Include office:font-decls in styles DOM - nodeList = newDoc - .getElementsByTagName(TAG_OFFICE_FONT_DECLS); - if (nodeList.getLength() > 0) { - tmpNode = styleDoc.importNode(nodeList.item(0), true); - rootNode.appendChild(tmpNode); - } - - nodeList = newDoc.getElementsByTagName(TAG_OFFICE_STYLES); - if (nodeList.getLength() > 0) { - tmpNode = styleDoc.importNode(nodeList.item(0), true); - rootNode.appendChild(tmpNode); - } - - // FIX (HJ): Include office:automatic-styles in styles DOM - nodeList = newDoc - .getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES); - if (nodeList.getLength() > 0) { - tmpNode = styleDoc.importNode(nodeList.item(0), true); - rootNode.appendChild(tmpNode); - } - - // FIX (HJ): Include office:master-styles in styles DOM - nodeList = newDoc - .getElementsByTagName(TAG_OFFICE_MASTER_STYLES); - if (nodeList.getLength() > 0) { - tmpNode = styleDoc.importNode(nodeList.item(0), true); - rootNode.appendChild(tmpNode); - } - - /* Settings */ - settingsDoc = createDOM(TAG_OFFICE_DOCUMENT_SETTINGS); - rootElement = settingsDoc.getDocumentElement(); - rootNode = rootElement; - nodeList = newDoc.getElementsByTagName(TAG_OFFICE_SETTINGS); - if (nodeList.getLength() > 0) { - tmpNode = settingsDoc - .importNode(nodeList.item(0), true); - rootNode.appendChild(tmpNode); - } - /* Meta */ - metaDoc = createDOM(TAG_OFFICE_DOCUMENT_META); - rootElement = metaDoc.getDocumentElement(); - rootNode = rootElement; - nodeList = newDoc.getElementsByTagName(TAG_OFFICE_META); - if (nodeList.getLength() > 0) { - tmpNode = metaDoc.importNode(nodeList.item(0), true); - rootNode.appendChild(tmpNode); - } - } catch (SAXException ex) { - throw new OfficeDocumentException(ex); - } - } - - } - - /** - * Parse given {@code byte} array into a DOM {@code Document} object using - * the {@code DocumentBuilder} object. - * - * @param builder {@code DocumentBuilder} object for parsing. - * @param bytes {@code byte} array for parsing. - * - * @return Resulting DOM {@code Document} object. - * - * @throws SAXException If any parsing error occurs. - */ - static Document parse(DocumentBuilder builder, byte bytes[]) - throws SAXException, IOException { - - Document doc = null; - - ByteArrayInputStream is = new ByteArrayInputStream(bytes); - - // TODO: replace hack with a more appropriate fix. - - Reader r = hack(is); - InputSource ins = new InputSource(r); - doc = builder.parse(ins); - - return doc; - } - - /** - * Method to return the MIME type of the document. - * - * @return String The document's MIME type. - */ - protected abstract String getDocumentMimeType(); - - /** - * Write out Office ZIP file format. - * - * @param os XML {@code OutputStream}. - * - * @throws IOException If any I/O error occurs. - */ - public void write(OutputStream os) throws IOException { - if (zip == null) { - zip = new OfficeZip(); - } - - initManifestDOM(); - - Element domEntry; - Element manifestRoot = manifestDoc.getDocumentElement(); - - // The EmbeddedObjects come first. - Iterator embObjs = getEmbeddedObjects(); - if (embObjs != null) { - while (embObjs.hasNext()) { - EmbeddedObject obj = embObjs.next(); - obj.writeManifestData(manifestDoc); - - obj.write(zip); - } - } - - // Add in the entry for the Pictures directory. Always present. - domEntry = manifestDoc.createElement(TAG_MANIFEST_FILE); - domEntry.setAttribute(ATTRIBUTE_MANIFEST_FILE_PATH, "Pictures/"); - domEntry.setAttribute(ATTRIBUTE_MANIFEST_FILE_TYPE, ""); - manifestRoot.appendChild(domEntry); - - // Write content to the Zip file and then write any of the optional - // data, if it exists. - zip.setContentXMLBytes(docToBytes(contentDoc)); - - domEntry = manifestDoc.createElement(TAG_MANIFEST_FILE); - domEntry.setAttribute(ATTRIBUTE_MANIFEST_FILE_PATH, "content.xml"); - domEntry.setAttribute(ATTRIBUTE_MANIFEST_FILE_TYPE, "text/xml"); - - manifestRoot.appendChild(domEntry); - - if (styleDoc != null) { - zip.setStyleXMLBytes(docToBytes(styleDoc)); - - domEntry = manifestDoc.createElement(TAG_MANIFEST_FILE); - domEntry.setAttribute(ATTRIBUTE_MANIFEST_FILE_PATH, "styles.xml"); - domEntry.setAttribute(ATTRIBUTE_MANIFEST_FILE_TYPE, "text/xml"); - manifestRoot.appendChild(domEntry); - } - - if (metaDoc != null) { - zip.setMetaXMLBytes(docToBytes(metaDoc)); - - domEntry = manifestDoc.createElement(TAG_MANIFEST_FILE); - domEntry.setAttribute(ATTRIBUTE_MANIFEST_FILE_PATH, "meta.xml"); - domEntry.setAttribute(ATTRIBUTE_MANIFEST_FILE_TYPE, "text/xml"); - manifestRoot.appendChild(domEntry); - } - - if (settingsDoc != null) { - zip.setSettingsXMLBytes(docToBytes(settingsDoc)); - - domEntry = manifestDoc.createElement(TAG_MANIFEST_FILE); - domEntry.setAttribute(ATTRIBUTE_MANIFEST_FILE_PATH, "settings.xml"); - domEntry.setAttribute(ATTRIBUTE_MANIFEST_FILE_TYPE, "text/xml"); - manifestRoot.appendChild(domEntry); - } - - zip.setManifestXMLBytes(docToBytes(manifestDoc)); - - zip.write(os); - } - - /** - * Write out Office ZIP file format. - * - * @param os XML {@code OutputStream}. - * @param isZip {@code boolean} - * - * @throws IOException If any I/O error occurs. - */ - public void write(OutputStream os, boolean isZip) throws IOException { - - // Create an OfficeZip object if one does not exist. - if (isZip){ - write(os); - } else { - try { - DocumentBuilderFactory builderFactory = makeFactory(); - DocumentBuilder builder= builderFactory.newDocumentBuilder(); - DOMImplementation domImpl = builder.getDOMImplementation(); - domImpl.createDocumentType("office:document","-//OpenOffice.org//DTD OfficeDocument 1.0//EN",null); - org.w3c.dom.Document newDoc = domImpl.createDocument("http://openoffice.org/2000/office","office:document",null); - - Element rootElement=newDoc.getDocumentElement(); - rootElement.setAttribute("xmlns:office","http://openoffice.org/2000/office"); - rootElement.setAttribute("xmlns:style","http://openoffice.org/2000/style" ); - rootElement.setAttribute("xmlns:text","http://openoffice.org/2000/text"); - rootElement.setAttribute("xmlns:table","http://openoffice.org/2000/table"); - - rootElement.setAttribute("xmlns:draw","http://openoffice.org/2000/drawing"); - rootElement.setAttribute("xmlns:fo","http://www.w3.org/1999/XSL/Format" ); - rootElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink" ); - rootElement.setAttribute("xmlns:dc","http://purl.org/dc/elements/1.1/" ); - rootElement.setAttribute("xmlns:meta","http://openoffice.org/2000/meta" ); - rootElement.setAttribute("xmlns:number","http://openoffice.org/2000/datastyle" ); - rootElement.setAttribute("xmlns:svg","http://www.w3.org/2000/svg" ); - rootElement.setAttribute("xmlns:chart","http://openoffice.org/2000/chart" ); - rootElement.setAttribute("xmlns:dr3d","http://openoffice.org/2000/dr3d" ); - rootElement.setAttribute("xmlns:math","http://www.w3.org/1998/Math/MathML" ); - rootElement.setAttribute("xmlns:form","http://openoffice.org/2000/form" ); - rootElement.setAttribute("xmlns:script","http://openoffice.org/2000/script" ); - rootElement.setAttribute("xmlns:config","http://openoffice.org/2001/config" ); - // #i41033# OASIS format needs the "office:class" set. - if(getDocumentMimeType().equals(SXC_MIME_TYPE)) - rootElement.setAttribute("office:class","spreadsheet" ); - else if(getDocumentMimeType().equals(SXW_MIME_TYPE)) - rootElement.setAttribute("office:class","text" ); - rootElement.setAttribute("office:version","1.0"); - - NodeList nodeList; - Node tmpNode; - Node rootNode = rootElement; - if (metaDoc !=null) { - nodeList= metaDoc.getElementsByTagName(TAG_OFFICE_META); - if (nodeList.getLength()>0) { - tmpNode = newDoc.importNode(nodeList.item(0),true); - rootNode.appendChild(tmpNode); - } - } if (styleDoc !=null) { - nodeList= styleDoc.getElementsByTagName(TAG_OFFICE_STYLES); - if (nodeList.getLength()>0){ - tmpNode = newDoc.importNode(nodeList.item(0),true); - rootNode.appendChild(tmpNode); - } - } if (settingsDoc !=null) { - nodeList= settingsDoc.getElementsByTagName(TAG_OFFICE_SETTINGS); - if (nodeList.getLength()>0){ - tmpNode = newDoc.importNode(nodeList.item(0),true); - rootNode.appendChild(tmpNode); - } - } if (contentDoc !=null) { - nodeList= contentDoc.getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES); - if (nodeList.getLength()>0){ - tmpNode = newDoc.importNode(nodeList.item(0),true); - rootNode.appendChild(tmpNode); - } - nodeList= contentDoc.getElementsByTagName(TAG_OFFICE_BODY); - if (nodeList.getLength()>0){ - tmpNode = newDoc.importNode(nodeList.item(0),true); - rootNode.appendChild(tmpNode); - } - } - - byte contentBytes[] = docToBytes(newDoc); - os.write(contentBytes); - } catch(Exception exc){ - System.out.println("\nException in OfficeDocument.write():" +exc); - } - } - } - - - /** - * Write out a {@code org.w3c.dom.Document} object into a {@code byte} - * array. - * - *

TODO: remove dependency on {@code com.sun.xml.tree.XmlDocument} - * package!

- * - * @param doc DOM {@code Document} object. - * - * @return {@code byte} array of DOM {@code Document} object. - * - * @throws IOException If any I/O error occurs. - */ - static byte[] docToBytes(Document doc) - throws IOException { - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - java.lang.reflect.Constructor con; - java.lang.reflect.Method meth; - - String domImpl = doc.getClass().getName(); - - /* - * We may have multiple XML parsers in the Classpath. - * Depending on which one is first, the actual type of - * doc may vary. Need a way to find out which API is being - * used and use an appropriate serialization method. - */ - - try { - // First of all try for JAXP 1.0 - if (domImpl.equals("com.sun.xml.tree.XmlDocument")) { - - Debug.log(Debug.INFO, "Using JAXP"); - - Class jaxpDoc = Class.forName("com.sun.xml.tree.XmlDocument"); - - // The method is in the XMLDocument class itself, not a helper - meth = jaxpDoc.getMethod("write", - new Class[] { Class.forName("java.io.OutputStream") } ); - - meth.invoke(doc, new Object [] { baos } ); - } else if (domImpl.equals("org.apache.crimson.tree.XmlDocument")) { - Debug.log(Debug.INFO, "Using Crimson"); - - Class crimsonDoc = Class.forName("org.apache.crimson.tree.XmlDocument"); - // The method is in the XMLDocument class itself, not a helper - meth = crimsonDoc.getMethod("write", - new Class[] { Class.forName("java.io.OutputStream") } ); - - meth.invoke(doc, new Object [] { baos } ); - } else if (domImpl.equals("org.apache.xerces.dom.DocumentImpl") - || domImpl.equals("org.apache.xerces.dom.DeferredDocumentImpl")) { - - Debug.log(Debug.INFO, "Using Xerces"); - - // Try for Xerces - Class xercesSer = - Class.forName("org.apache.xml.serialize.XMLSerializer"); - - // Get the OutputStream constructor - // May want to use the OutputFormat parameter at some stage too - con = xercesSer.getConstructor(new Class [] - { Class.forName("java.io.OutputStream"), - Class.forName("org.apache.xml.serialize.OutputFormat") } ); - - // Get the serialize method - meth = xercesSer.getMethod("serialize", - new Class [] { Class.forName("org.w3c.dom.Document") } ); - - // Get an instance - Object serializer = con.newInstance(new Object [] { baos, null } ); - - // Now call serialize to write the document - meth.invoke(serializer, new Object [] { doc } ); - } else if (domImpl.equals("gnu.xml.dom.DomDocument")) { - Debug.log(Debug.INFO, "Using GNU"); - - Class gnuSer = Class.forName("gnu.xml.dom.ls.DomLSSerializer"); - - // Get the serialize method - meth = gnuSer.getMethod("serialize", - new Class [] { Class.forName("org.w3c.dom.Node"), - Class.forName("java.io.OutputStream") } ); - - // Get an instance - Object serializer = gnuSer.newInstance(); - - // Now call serialize to write the document - meth.invoke(serializer, new Object [] { doc, baos } ); - } else { - try { - DOMSource domSource = new DOMSource(doc); - StringWriter writer = new StringWriter(); - StreamResult result = new StreamResult(writer); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer transformer = tf.newTransformer(); - transformer.transform(domSource, result); - return writer.toString().getBytes(); - } catch (Exception e) { - // We don't have another parser - IOException newEx = new IOException("No appropriate API (JAXP/Xerces) to serialize XML document: " + domImpl); - newEx.initCause(e); - throw newEx; - } - } - } - catch (Exception e) { - // We may get some other errors, but the bottom line is that - // the steps being executed no longer work - IOException newEx = new IOException(e.getMessage()); - newEx.initCause(e); - throw newEx; - } - - byte bytes[] = baos.toByteArray(); - - return bytes; - } - - /** - * Initializes a new DOM {@code Document} with the content containing - * minimum OpenOffice XML tags. - * - * @throws IOException If any I/O error occurs. - */ - public final void initContentDOM() throws IOException { - - contentDoc = createDOM(TAG_OFFICE_DOCUMENT_CONTENT); - - // this is a work-around for a bug in Office6.0 - not really - // needed but StarCalc 6.0 will crash without this tag. - Element root = contentDoc.getDocumentElement(); - - Element child = contentDoc.createElement(TAG_OFFICE_FONT_DECLS); - root.appendChild(child); - - child = contentDoc.createElement(TAG_OFFICE_AUTOMATIC_STYLES); - root.appendChild(child); - - child = contentDoc.createElement(TAG_OFFICE_BODY); - root.appendChild(child); - } - - /** - * Initializes a new DOM {@code Document} with the content containing - * minimum OpenOffice XML tags. - * - * @throws IOException If any I/O error occurs. - */ - public final void initSettingsDOM() throws IOException { - - settingsDoc = createSettingsDOM(TAG_OFFICE_DOCUMENT_SETTINGS); - - // this is a work-around for a bug in Office6.0 - not really - // needed but StarCalc 6.0 will crash without this tag. - Element root = settingsDoc.getDocumentElement(); - - Element child = settingsDoc.createElement(TAG_OFFICE_SETTINGS); - root.appendChild(child); - } - - /** - * Initializes a new DOM Document with styles containing minimum OpenOffice - * XML tags. - * - * @throws IOException If any I/O error occurs. - */ - public final void initStyleDOM() throws IOException { - - styleDoc = createDOM(TAG_OFFICE_DOCUMENT_STYLES); - } - - /** - * Creates a new DOM {@code Document} containing minimum OpenOffice XML tags. - * - *

This method uses the subclass {@code getOfficeClassAttribute} method - * to get the attribute for office:class.

- * - * @param rootName root name of {@code Document}. - * - * @throws IOException If any I/O error occurs. - */ - private final Document createSettingsDOM(String rootName) throws IOException { - - Document doc = null; - - try { - DocumentBuilder builder = factory.newDocumentBuilder(); - doc = builder.newDocument(); - } catch (ParserConfigurationException ex) { - throw new OfficeDocumentException(ex); - } - - Element root = doc.createElement(rootName); - doc.appendChild(root); - - root.setAttribute("xmlns:office", "http://openoffice.org/2000/office"); - root.setAttribute("xmlns:xlink", "http://openoffice.org/1999/xlink"); - root.setAttribute("xmlns:config", "http://openoffice.org/2001/config"); - root.setAttribute("office:version", "1.0"); - - return doc; - } - - /** - * Creates a new DOM {@code Document} containing minimum OpenOffice XML tags. - * - *

This method uses the subclass {@code getOfficeClassAttribute} method - * to get the attribute for office:class.

- * - * @param rootName root name of Document. - * - * @throws IOException If any I/O error occurs. - */ - private final Document createDOM(String rootName) throws IOException { - - Document doc = null; - - try { - DocumentBuilder builder = factory.newDocumentBuilder(); - doc = builder.newDocument(); - } catch (ParserConfigurationException ex) { - throw new OfficeDocumentException(ex); - } - - Element root = doc.createElement(rootName); - doc.appendChild(root); - - root.setAttribute("xmlns:office", "http://openoffice.org/2000/office"); - root.setAttribute("xmlns:style", "http://openoffice.org/2000/style"); - root.setAttribute("xmlns:text", "http://openoffice.org/2000/text"); - root.setAttribute("xmlns:table", "http://openoffice.org/2000/table"); - root.setAttribute("xmlns:draw", "http://openoffice.org/2000/drawing"); - root.setAttribute("xmlns:fo", "http://www.w3.org/1999/XSL/Format"); - root.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); - root.setAttribute("xmlns:number", "http://openoffice.org/2000/datastyle"); - root.setAttribute("xmlns:svg", "http://www.w3.org/2000/svg"); - root.setAttribute("xmlns:chart", "http://openoffice.org/2000/chart"); - root.setAttribute("xmlns:dr3d", "http://openoffice.org/2000/dr3d"); - root.setAttribute("xmlns:math", "http://www.w3.org/1998/Math/MathML"); - root.setAttribute("xmlns:form", "http://openoffice.org/2000/form"); - root.setAttribute("xmlns:script", "http://openoffice.org/2000/script"); - root.setAttribute("office:class", getOfficeClassAttribute()); - root.setAttribute("office:version", "1.0"); - - return doc; - } - - /** - * Return the office:class attribute value. - * - * @return The attribute value. - */ - protected abstract String getOfficeClassAttribute(); - - /** - * Hacked code to filter {@literal } tag before sending stream to - * parser. - * - *

This hacked code needs to be changed later on.

- * - *

Issue: using current jaxp1.0 parser, there is no way to turn off - * processing of dtds. Current set of dtds have bugs, processing them will - * throw exceptions.

- * - *

This is a simple hack that assumes the whole {@literal } tag - * are all in the same line. This is sufficient for current StarOffice 6.0 - * generated XML files. Since this hack really needs to go away, I don't - * want to spend too much time in making it a perfect hack.

- * - * FIX (HJ): Removed requirement for DOCTYPE to be in one line - * FIX (HJ): No longer removes newlines - * - * @param is {@code InputStream} to be filtered. - * - * @return Reader value without the {@literal } tag. - * - * @throws IOException If any I/O error occurs. - */ - private static Reader hack(InputStream is) throws IOException { - - BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8")); - StringBuffer buffer = new StringBuffer(); - - String str; - while ((str = br.readLine()) != null) { - - int sIndex = str.indexOf(" -1) { - - buffer.append(str.substring(0, sIndex)); - - int eIndex = str.indexOf('>', sIndex + 8 ); - if (eIndex > -1) { - - buffer.append(str.substring(eIndex + 1, str.length())); - // FIX (HJ): Preserve the newline - buffer.append("\n"); - - } else { - - // FIX (HJ): More than one line. Search for '>' in following lines - boolean bOK = false; - while ((str = br.readLine())!=null) { - eIndex = str.indexOf('>'); - if (eIndex>-1) { - buffer.append(str.substring(eIndex+1)); - // FIX (HJ): Preserve the newline - buffer.append("\n"); - bOK = true; - break; - } - } - - if (!bOK) { throw new IOException("Invalid XML"); } - } - - } else { - - buffer.append(str); - // FIX (HJ): Preserve the newline - buffer.append("\n"); - } - } - - StringReader r = new StringReader(buffer.toString()); - return r; - } - - /** - * Transform the {@code InputStream} to a Reader Stream. - * - *

This hacked code needs to be changed later on.

- * - *

Issue: the new oasis input file stream means that the old input stream - * fails. see #i33702#

- * - * @param is {@code InputStream} to be filtered. - * - * @return Reader value of the {@code InputStream()}. - * - * @throws IOException If any I/O error occurs. - */ - private static Reader secondHack(InputStream is) throws IOException { - - BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8")); - char[] charArray = new char[4096]; - StringBuffer sBuf = new StringBuffer(); - int n; - while ((n=br.read(charArray, 0, charArray.length)) > 0) { - sBuf.append(charArray, 0, n); - } - - // ensure there is no trailing garbage after the end of the stream. - int sIndex = sBuf.lastIndexOf(""); - sBuf.delete(sIndex, sBuf.length()); - sBuf.append(""); - StringReader r = new StringReader(sBuf.toString()); - return r; - } - - /** - * Method to create the initial entries in the manifest.xml file stored - * in an SX? file. - */ - private void initManifestDOM() throws IOException { - - try { - DocumentBuilder builder = factory.newDocumentBuilder(); - DOMImplementation domImpl = builder.getDOMImplementation(); - - DocumentType docType = domImpl.createDocumentType(TAG_MANIFEST_ROOT, - "-//OpenOffice.org//DTD Manifest 1.0//EN", - "Manifest.dtd"); - manifestDoc = domImpl.createDocument("manifest", TAG_MANIFEST_ROOT, docType); - } catch (ParserConfigurationException ex) { - throw new OfficeDocumentException(ex); - } - - // Add the entry - Element manifestRoot = manifestDoc.getDocumentElement(); - - manifestRoot.setAttribute("xmlns:manifest", "http://openoffice.org/2001/manifest"); - - Element docRoot = manifestDoc.createElement(TAG_MANIFEST_FILE); - - docRoot.setAttribute(ATTRIBUTE_MANIFEST_FILE_PATH, "/"); - docRoot.setAttribute(ATTRIBUTE_MANIFEST_FILE_TYPE, getDocumentMimeType()); - - manifestRoot.appendChild(docRoot); - } -} diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException.java deleted file mode 100644 index 12799065b50b..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.xml; - -import java.io.IOException; - -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import org.openoffice.xmerge.util.Resources; - -/** - * Used by OfficeDocument to encapsulate exceptions. - * - *

It will add more details to the message string if it is of type - * {@code SAXParseException}.

- */ -public final class OfficeDocumentException extends IOException { - - /** - * Constructor, capturing additional information from the {@code SAXException}. - * - * @param e The {@code SAXException}. - */ - public OfficeDocumentException(SAXException e) { - super(constructMessage(e)); - if (e.getException() != null) { - initCause(e.getException()); - } else { - initCause(e); - } - } - - private static String constructMessage(SAXException e) { - StringBuffer message = new StringBuffer(); - if (e instanceof SAXParseException) { - String msgParseError = - Resources.getInstance().getString("PARSE_ERROR"); - String msgLine = - Resources.getInstance().getString("LINE"); - String msgColumn = - Resources.getInstance().getString("COLUMN"); - String msgPublicId = - Resources.getInstance().getString("PUBLIC_ID"); - String msgSystemId = - Resources.getInstance().getString("SYSTEM_ID"); - SAXParseException spe = (SAXParseException) e; - message.append(msgParseError); - message.append(": "); - message.append(msgLine); - message.append(": "); - message.append(spe.getLineNumber()); - message.append(", "); - message.append(msgColumn); - message.append(": "); - message.append(spe.getColumnNumber()); - message.append(", "); - message.append(msgSystemId); - message.append(": "); - message.append(spe.getSystemId()); - message.append(", "); - message.append(msgPublicId); - message.append(": "); - message.append(spe.getPublicId()); - message.append("\n"); - } - - // if there exists an embedded exception - Exception ex = e.getException(); - if (ex != null) { - message.append(ex.getMessage()); - } - return message.toString(); - } - - /** - * Constructor, creates exception with provided message. - * - * @param s Message value for the exception. - */ - public OfficeDocumentException(String s) { - super(s); - } - - /** - * Constructor, creates exception with the message corresponding to the - * message value of the provided exception. - * - * @param e The {@code Exception}. - */ - public OfficeDocumentException(Exception e) { - super(e.getMessage()); - initCause(e); - } - -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeZip.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeZip.java deleted file mode 100644 index 4965885b4a22..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeZip.java +++ /dev/null @@ -1,424 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.xml; - -import java.util.List; -import java.util.ListIterator; -import java.util.LinkedList; -import java.util.zip.ZipInputStream; -import java.util.zip.ZipOutputStream; -import java.util.zip.ZipEntry; -import java.util.zip.CRC32; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.IOException; -import java.io.ByteArrayOutputStream; - -import org.openoffice.xmerge.util.Debug; - -/** - * Class used by {@link org.openoffice.xmerge.converter.xml.OfficeDocument - * OfficeDocument} to handle reading and writing from a ZIP file, as well as - * storing ZIP entries. - */ -class OfficeZip { - - /** File name of the XML file in a zipped document. */ - private static final String CONTENTXML = "content.xml"; - - private static final String STYLEXML = "styles.xml"; - private static final String METAXML = "meta.xml"; - private static final String SETTINGSXML = "settings.xml"; - private static final String MANIFESTXML = "META-INF/manifest.xml"; - - private static final int BUFFERSIZE = 1024; - - private final List entryList; - - private int contentIndex = -1; - private int styleIndex = -1; - private int metaIndex = -1; - private int settingsIndex = -1; - private int manifestIndex = -1; - - /** Default constructor. */ - OfficeZip() { - - entryList = new LinkedList(); - } - - /** - * Read each zip entry in the {@code InputStream} object and store in - * entryList both the {@code ZipEntry} object as well as the bits of each - * entry. - * - *

Call this method before calling the {@code getContentXMLBytes} method - * or the {@code getStyleXMLBytes} method.

- * - *

Keep track of the {@code CONTENTXML} and {@code STYLEXML} using - * {@code contentIndex} and {@code styleIndex}, respectively.

- * - * @param is {@code InputStream} object to read. - * - * @throws IOException If any I/O error occurs. - */ - void read(InputStream is) throws IOException { - - ZipInputStream zis = new ZipInputStream(is); - ZipEntry ze; - int i = -1; - - while ((ze = zis.getNextEntry()) != null) { - - String name = ze.getName(); - - Debug.log(Debug.TRACE, "reading entry: " + name); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - int len; - byte buffer[] = new byte[BUFFERSIZE]; - - while ((len = zis.read(buffer)) > 0) { - baos.write(buffer, 0, len); - } - - byte bytes[] = baos.toByteArray(); - Entry entry = new Entry(ze,bytes); - - entryList.add(entry); - - i++; - - if (name.equalsIgnoreCase(CONTENTXML)) { - contentIndex = i; - } - else if (name.equalsIgnoreCase(STYLEXML)) { - styleIndex = i; - } - else if (name.equalsIgnoreCase(METAXML)) { - metaIndex = i; - } - else if (name.equalsIgnoreCase(SETTINGSXML)) { - settingsIndex = i; - } - else if (name.equalsIgnoreCase(MANIFESTXML)) { - manifestIndex = i; - } - - } - - zis.close(); - } - - /** - * This method returns the CONTENTXML file in a {@code byte} array. - * - *

It returns null if there is no {@code CONTENTXML} in this zip file.

- * - * @return CONTENTXML in a {@code byte} array. - */ - byte[] getContentXMLBytes() { - - return getEntryBytes(contentIndex); - } - - /** - * This method returns the {@code STYLEXML} file in a {@code byte} array. - * - *

It returns {@code null} if there is no {@code STYLEXML} in this zip - * file.

- * - * @return STYLEXML in a {@code byte} array. - */ - byte[] getStyleXMLBytes() { - - return getEntryBytes(styleIndex); - } - - /** - * This method returns the METAXML file in a {@code byte} array. - * - *

It returns {@code null} if there is no {@code METAXML} in this zip - * file.

- * - * @return METAXML in a {@code byte} array. - */ - byte[] getMetaXMLBytes() { - return getEntryBytes(metaIndex); - } - - /** - * This method returns the {@code SETTINGSXML} file in a {@code byte} array. - * - *

It returns {@code null} if there is no {@code SETTINGSXML} in this zip - * file.

- * - * @return SETTINGSXML in a byte array. - */ - byte[] getSettingsXMLBytes() { - return getEntryBytes(settingsIndex); - } - - /** - * This method returns the {@code MANIFESTXML} file in a {@code byte} array. - * - *

It returns {@code null} if there is no {@code MANIFESTXML} in this zip - * file.

- * - * @return MANIFESTXML in a {@code byte} array. - */ - byte[] getManifestXMLBytes() { - return getEntryBytes(manifestIndex); - } - - /** - * This method returns the bytes corresponding to the entry named in the - * parameter. - * - * @param name The name of the entry in the Zip file to retrieve. - * - * @return The data for the named entry in a {@code byte} array or - * {@code null} if no entry is found. - */ - byte[] getNamedBytes(String name) { - - // The list is not sorted, and sorting it for a binary search would - // invalidate the indices stored for the main files. - - // Could improve performance by caching the name and index when - // iterating through the ZipFile in read(). - for (int i = 0; i < entryList.size(); i++) { - Entry e = entryList.get(i); - - if (e.zipEntry.getName().equals(name)) { - return getEntryBytes(i); - } - } - - return null; - } - - /** - * This method sets the bytes for the named entry. - * - *

It searches for a matching entry in the LinkedList. If no entry is - * found, a new one is created.

- * - *

Writing of data is deferred to {@code setEntryBytes()}.

- * - * @param name The name of the entry to search for. - * @param bytes The new data to write. - */ - void setNamedBytes(String name, byte[] bytes) { - for (int i = 0; i < entryList.size(); i++) { - Entry e = entryList.get(i); - - if (e.zipEntry.getName().equals(name)) { - setEntryBytes(i, bytes, name); - return; - } - } - - // If we're here, no entry was found. Call setEntryBytes with an index - // of -1 to insert a new entry. - setEntryBytes(-1, bytes, name); - } - - /** - * Used by the {@code getContentXMLBytes} method and the - * {@code getStyleXMLBytes} method to return the {@code byte} array from the - * corresponding {@code Entry} in the {@code entryList}. - * - * @param index Index of {@code Entry} object in {@code entryList}. - * - * @return {@code byte} array associated in that {@code Entry} object or - * {@code null}, if there is not such {@code Entry}. - */ - private byte[] getEntryBytes(int index) { - - byte[] bytes = null; - - if (index > -1) { - Entry entry = entryList.get(index); - bytes = entry.bytes; - } - return bytes; - } - - /** - * Set or replace the byte array for the {@code CONTENTXML} file. - * - * @param bytes {@code byte} array for the {@code CONTENTXML} file. - */ - void setContentXMLBytes(byte bytes[]) { - - contentIndex = setEntryBytes(contentIndex, bytes, CONTENTXML); - } - - /** - * Set or replace the {@code byte} array for the {@code STYLEXML} file. - * - * @param bytes {@code byte} array for the {@code STYLEXML} file. - */ - void setStyleXMLBytes(byte bytes[]) { - - styleIndex = setEntryBytes(styleIndex, bytes, STYLEXML); - } - - /** - * Set or replace the {@code byte} array for the {@code METAXML} file. - * - * @param bytes {@code byte} array for the {@code METAXML} file. - */ - void setMetaXMLBytes(byte bytes[]) { - - metaIndex = setEntryBytes(metaIndex, bytes, METAXML); - } - - /** - * Set or replace the {@code byte} array for the {@code SETTINGSXML} file. - * - * @param bytes {@code byte} array for the {@code SETTINGSXML} file. - */ - void setSettingsXMLBytes(byte bytes[]) { - - settingsIndex = setEntryBytes(settingsIndex, bytes, SETTINGSXML); - } - - /** - * Set or replace the {@code byte} array for the {@code MANIFESTXML} file. - * - * @param bytes {@code byte} array for the {@code MANIFESTXML} file. - */ - void setManifestXMLBytes(byte bytes[]) { - manifestIndex = setEntryBytes(manifestIndex, bytes, MANIFESTXML); - } - - /** - * Used by the {@code setContentXMLBytes} method and the - * {@code setStyleXMLBytes} to either replace an existing {@code Entry}, or - * create a new entry in {@code entryList}. - * - *

If there is an {@code Entry} object within {@code entryList} that - * corresponds to the index, replace the {@code ZipEntry} info.

- * - * @param index Index of Entry to modify. - * @param bytes Entry value. - * @param name Name of Entry. - * - * @return Index of value added or modified in entryList - */ - private int setEntryBytes(int index, byte bytes[], String name) { - - if (index > -1) { - // replace existing entry in entryList - Entry entry = entryList.get(index); - name = entry.zipEntry.getName(); - int method = entry.zipEntry.getMethod(); - - ZipEntry ze = createZipEntry(name, bytes, method); - - entry.zipEntry = ze; - entry.bytes= bytes; - - } else { - // add a new entry into entryList - ZipEntry ze = createZipEntry(name, bytes, ZipEntry.DEFLATED); - Entry entry = new Entry(ze, bytes); - entryList.add(entry); - index = entryList.size() - 1; - } - - return index; - } - - /** - * Write out the ZIP entries into the {@code OutputStream} object. - * - * @param os OutputStream object to write ZIP. - * - * @throws IOException If any ZIP I/O error occurs. - */ - void write(OutputStream os) throws IOException { - - Debug.log(Debug.TRACE, "Writing out the following entries into zip."); - - ZipOutputStream zos = new ZipOutputStream(os); - - ListIterator iterator = entryList.listIterator(); - while (iterator.hasNext()) { - - Entry entry = iterator.next(); - ZipEntry ze = entry.zipEntry; - - String name = ze.getName(); - - Debug.log(Debug.TRACE, "... " + name); - - zos.putNextEntry(ze); - zos.write(entry.bytes); - } - - zos.close(); - } - - /** - * Creates a {@code ZipEntry} object based on the given parameters. - * - * @param name Name for the {@code ZipEntry}. - * @param bytes {@code byte} array for {@code ZipEntry}. - * @param method ZIP method to be used for {@code ZipEntry}. - * - * @return A {@code ZipEntry} object. - */ - private ZipEntry createZipEntry(String name, byte bytes[], int method) { - - ZipEntry ze = new ZipEntry(name); - - ze.setMethod(method); - ze.setSize(bytes.length); - - CRC32 crc = new CRC32(); - crc.reset(); - crc.update(bytes); - ze.setCrc(crc.getValue()); - - ze.setTime(System.currentTimeMillis()); - - return ze; - } - - /** - * This inner class is used as a data structure for holding a {@code ZipEntry} - * info and its corresponding bytes. - * - *

These are stored in {@code entryList}.

- */ - private static class Entry { - - ZipEntry zipEntry = null; - byte bytes[] = null; - - Entry(ZipEntry zipEntry, byte bytes[]) { - this.zipEntry = zipEntry; - this.bytes = bytes; - } - } -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/ParaStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/ParaStyle.java deleted file mode 100644 index 786e82b77cf9..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/ParaStyle.java +++ /dev/null @@ -1,528 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.xml; - -import org.w3c.dom.NodeList; -import org.w3c.dom.Node; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Element; - -import org.openoffice.xmerge.util.Debug; - -abstract class conversionAlgorithm { - abstract int I(String val); -} - -/** - * This algorithm expects only values in millimeters, e.g. {@literal "20.3mm"}. - */ -class horizSize extends conversionAlgorithm { - @Override - int I(String value) { - if (value.endsWith("mm")) { - float size = (float)0.0; - String num = value.substring(0, value.length() - 2); - try { - size = Float.parseFloat(num); - } catch (Exception e) { - Debug.log(Debug.ERROR, "Error parsing " + value, e); - } - size *= 100; - return (int)size; - } else { - Debug.log(Debug.ERROR, "Unexpected value (" + value - + ") in horizSize.I()"); - return 0; - } - } -} - -/** - * This algorithm does line height {@literal -} can be either millimeters or a - * percentage. - */ -class lineHeight extends conversionAlgorithm { - @Override - int I(String value) { - if (value.endsWith("mm")) { - float size = (float)0.0; - String num = value.substring(0, value.length() - 2); - try { - size = Float.parseFloat(num); - } catch (Exception e) { - Debug.log(Debug.ERROR, "Error parsing " + value, e); - } - size *= 100; - return (int)size; - } else if (value.endsWith("%")) { - float size = (float)0.0; - String num = value.substring(0, value.length() - 1); - try { - size = Float.parseFloat(num); - } catch (Exception e) { - Debug.log(Debug.ERROR, "Error parsing " + value, e); - } - int retval = (int) size; - retval |= ParaStyle.LH_PCT; - return retval; - } - return 0; - } -} - -/** - * This class converts alignment values. - */ -class alignment extends conversionAlgorithm { - @Override - int I(String value) { - if (value.equals("end")) - return ParaStyle.ALIGN_RIGHT; - if (value.equals("right")) - return ParaStyle.ALIGN_RIGHT; - if (value.equals("center")) - return ParaStyle.ALIGN_CENTER; - if (value.equals("justify")) - return ParaStyle.ALIGN_JUST; - if (value.equals("justified")) - return ParaStyle.ALIGN_JUST; - if (value.equals("start")) - return ParaStyle.ALIGN_LEFT; - if (value.equals("left")) - return ParaStyle.ALIGN_LEFT; - Debug.log(Debug.ERROR, "Unknown string (" - + value + ") in alignment.I()"); - return ParaStyle.ALIGN_LEFT; - } -} - -/** - * This class represents a paragraph {@code Style}. - * - *
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Table with all paragraph style attributes and their values
AttributeValue
MARGIN_LEFTmm * 100
MARGIN_RIGHTmm * 100
MARGIN_TOPmm * 100 (space on top of paragraph)
MARGIN_BOTTOMmm * 100
TEXT_INDENTmm * 100 (first line indent)
LINE_HEIGHTmm * 100, unless or'ed with LH_PCT, in which case it is a percentage - * (e.g. 200% for double spacing) Can also be or'ed with LH_ATLEAST. - * Value is stored in bits indicated by LH_VALUEMASK.
TEXT_ALIGNALIGN_RIGHT, ALIGN_CENTER, ALIGN_JUST, ALIGN_LEFT
- */ -public class ParaStyle extends Style implements Cloneable { - - /** Indent left property. */ - private static final int TEXT_INDENT = 4; - /** Indent right property. */ - private static final int LINE_HEIGHT = 5; - /** Align text property. */ - private static final int TEXT_ALIGN = 6; - // This must always be one more than highest property - /** Total number of properties. */ - private static final int NR_PROPERTIES = 7; - - /** - * Array of flags indicating which attributes are set for this paragraph - * {@code Style}. - */ - private boolean isSet[] = new boolean[NR_PROPERTIES]; - /** Array of attribute values for this paragraph {@code Style}. */ - private int value[] = new int[NR_PROPERTIES]; - /** Array of attribute names for this paragraph {@code Style}. */ - private final String attrName[] = { - "fo:margin-left", - "fo:margin-right", - "fo:margin-top", - "fo:margin-bottom", - "fo:text-indent", - "fo:line-height", - "fo:text-align" - }; - - /** Array of attribute structures for this paragraph {@code Style}. */ - private final Class algor[] = { - horizSize.class, - horizSize.class, - horizSize.class, - horizSize.class, - horizSize.class, - lineHeight.class, - alignment.class - }; - - /** Align right. */ - public static final int ALIGN_RIGHT = 1; - /** Align center. */ - public static final int ALIGN_CENTER = 2; - /** Align justified. */ - public static final int ALIGN_JUST = 3; - /** Align left. */ - public static final int ALIGN_LEFT = 4; - - /** Line height percentage. */ - public static final int LH_PCT = 0x40000000; - - /** Line height mask. */ - private static final int LH_VALUEMASK = 0x00FFFFFF; - - /** Ignored tags. */ - private static String[] ignored = { - "style:font-name", "fo:font-size", "fo:font-weight", "fo:color", - "fo:language", "fo:country", "style:font-name-asian", - "style:font-size-asian", "style:language-asian", - "style:country-asian", "style:font-name-complex", - "style:font-size-complex", "style:language-complex", - "style:country-complex", "style:text-autospace", "style:punctuation-wrap", - "style:line-break", "fo:keep-with-next", "fo:font-style", - "text:number-lines", "text:line-number" - }; - - /** - * Constructor for use when going from DOM to client device format. - * - * @param node A style:style {@code Node} which, which is assumed - * to have family attribute of paragraph. - * @param sc The {@code StyleCatalog}, which is used for looking up - * ancestor {@code Style} objects. - */ - public ParaStyle(Node node, StyleCatalog sc) { - - super(node, sc); - - // Look for children. Only ones we care about are "style:properties" - // nodes. If any are found, recursively traverse them, passing - // along the style element to add properties to. - - if (node.hasChildNodes()) { - NodeList children = node.getChildNodes(); - int len = children.getLength(); - for (int i = 0; i < len; i++) { - Node child = children.item(i); - String nodeName = child.getNodeName(); - if (nodeName.equals("style:properties")) { - NamedNodeMap childAttrNodes = child.getAttributes(); - if (childAttrNodes != null) { - int nChildAttrNodes = childAttrNodes.getLength(); - for (int j = 0; j < nChildAttrNodes; j++) { - Node attr = childAttrNodes.item(j); - setAttribute(attr.getNodeName(), attr.getNodeValue()); - } - } - } - } - } - } - - /** - * Constructor for use when going from client device format to DOM. - * - * @param name Name of the {@code Style}. Can be {@code null}. - * @param familyName Family of the {@code Style} {@literal -} usually - * paragraph, text, etc. Can be {@code null}. - * @param parentName Name of the parent {@code Style}, or {@code null} - * if none. - * @param attribs Array of attributes to set. - * @param values Array of values to set. - * @param sc The {@code StyleCatalog}, which is used for looking up - * ancestor {@code Style} objects. - */ - public ParaStyle(String name, String familyName, String parentName, - String attribs[], String values[], StyleCatalog sc) { - super(name, familyName, parentName, sc); - if (attribs != null) - for (int i = 0; i < attribs.length; i++) - setAttribute(attribs[i], values[i]); - } - - /** - * Alternate constructor for use when going from client device format to DOM. - * - * @param name Name of the {@code Style}. Can be {@code null}. - * @param familyName Family of the {@code Style} {@literal -} usually - * paragraph, text, etc. Can be {@code null}. - * @param parentName Name of the parent {@code Style}, or null if none. - * @param attribs Array of attributes indices to set. - * @param values Array of values to set. - * @param lookup The {@code StyleCatalog}, which is used for looking - * up ancestor {@code Style} objects. - */ - public ParaStyle(String name, String familyName, String parentName, - int attribs[], String values[], StyleCatalog lookup) { - super(name, familyName, parentName, lookup); - if (attribs != null) - for (int i = 0; i < attribs.length; i++) - setAttribute(attribs[i], values[i]); - } - - /** - * This code checks whether an attribute is one that we intentionally ignore. - * - * @param attribute The attribute to check. - * - * @return {@code true} if attribute can be ignored, {@code false} otherwise. - */ - private boolean isIgnored(String attribute) { - for (int i = 0; i < ignored.length; i++) { - if (ignored[i].equals(attribute)) - return true; - } - return false; - } - - /** - * Set an attribute for this paragraph {@code Style}. - * - * @param attr The attribute to set. - * @param value The attribute value to set. - */ - private void setAttribute(String attr, String value) { - for (int i = 0; i < NR_PROPERTIES; i++) { - if (attr.equals(attrName[i])) { - setAttribute(i, value); - return; - } - } - if (!isIgnored(attr)) - Debug.log(Debug.INFO, "ParaStyle Unhandled: " + attr + "=" + value); - } - - /** - * Set an attribute for this paragraph {@code Style}. - * - * @param attr The attribute index to set. - * @param value The attribute value to set. - */ - private void setAttribute(int attr, String value) { - isSet[attr] = true; - try { - this.value[attr] = ((conversionAlgorithm)algor[attr].newInstance()).I(value); - } catch (Exception e) { - Debug.log(Debug.ERROR, "Instantiation error", e); - } - } - - /** - * Return the {@code Style} in use. - * - * @return The fully-resolved copy of the {@code Style} in use. - */ - @Override - public Style getResolved() { - ParaStyle resolved = null; - try { - resolved = (ParaStyle)this.clone(); - } catch (Exception e) { - Debug.log(Debug.ERROR, "Can't clone", e); - } - - // Look up the parent style. (If there is no style catalog - // specified, we can't do any lookups). - ParaStyle parentStyle = null; - if (sc != null) { - if (parent != null) { - parentStyle = (ParaStyle)sc.lookup(parent, family, null, - this.getClass()); - if (parentStyle == null) - Debug.log(Debug.ERROR, "parent style lookup of " - + parent + " failed!"); - else - parentStyle = (ParaStyle)parentStyle.getResolved(); - } else if (!name.equals("DEFAULT_STYLE")) { - parentStyle = (ParaStyle)sc.lookup("DEFAULT_STYLE", null, null, - this.getClass()); - } - } - - // If we found a parent, for any attributes which we don't have - // set, try to get the values from the parent. - if (parentStyle != null) { - parentStyle = (ParaStyle)parentStyle.getResolved(); - for (int i = 0; i < NR_PROPERTIES; i++) { - if (!isSet[i] && parentStyle.isSet[i]) { - resolved.isSet[i] = true; - resolved.value[i] = parentStyle.value[i]; - } - } - } - return resolved; - } - - /** - * Private function to return the value as an element in a Comma Separated - * Value (CSV) format. - * - * @param value The value to format. - * - * @return The formatted value. - */ - private static String toCSV(String value) { - if (value != null) - return "\"" + value + "\","; - else - return "\"\","; - } - - /** - * Private function to return the value as a last element in a Comma - * Separated Value (CSV) format. - * - * @param value The value to format. - * - * @return The formatted value. - */ - private static String toLastCSV(String value) { - if (value != null) - return "\"" + value + "\""; - else - return "\"\""; - } - - /** - * Print a Comma Separated Value (CSV) header line for the spreadsheet dump. - */ - public static void dumpHdr() { - System.out.println(toCSV("Name") + toCSV("Family") + toCSV("parent") - + toCSV("left mgn") + toCSV("right mgn") - + toCSV("top mgn") + toCSV("bottom mgn") + toCSV("txt indent") - + toCSV("line height") + toLastCSV("txt align")); - } - - /** - * Dump this {@code Style} as a Comma Separated Value (CSV) line. - */ - public void dumpCSV() { - String attributes = ""; - for (int index = 0; index <= 6; index++) { - if (isSet[index]) { - attributes += toCSV("" + value[index]); - } - else - attributes += toCSV(null); // unspecified - } - System.out.println(toCSV(name) + toCSV(family) + toCSV(parent) - + attributes + toLastCSV(null)); - } - - /** - * Create the {@code Node} with the specified elements. - * - * @param parentDoc Parent {@code Document} of the {@code Node} to create. - * @param name Name of the {@code Node}. - * - * @return The created {@code Node}. - */ - @Override - public Node createNode(org.w3c.dom.Document parentDoc, String name) { - Element node = parentDoc.createElement(name); - writeAttributes(node); - return node; - } - - /** - * Return {@code true} if {@code style} is a subset of the {@code Style}. - * - * @param style {@code Style} to check. - * - * @return {@code true} if style is a subset, {@code false} - * otherwise. - */ - @Override - public boolean isSubset(Style style) { - - if (!super.isSubset(style)) - return false; - if (!this.getClass().isAssignableFrom(style.getClass())) - return false; - ParaStyle ps = (ParaStyle)style; - - for (int i = 0; i < NR_PROPERTIES; i++) { - if (ps.isSet[i]) { - if (i < NR_PROPERTIES - 1) { - // Compare the actual values. We allow a margin of error - // here because the conversion loses precision. - int diff; - if (value[i] > ps.value[i]) - diff = value[i] - ps.value[i]; - else - diff = ps.value[i] - value[i]; - if (diff > 32) - return false; - } else { - if (i == TEXT_ALIGN) - if ((value[i] == 0) && (ps.value[i] == 4)) - continue; - if (value[i] != ps.value[i]) - return false; - } - } - } - return true; - } - - /** - * Add {@code Style} attributes to the given {@code Node}. - * - *

This may involve writing child {@code Node} objects as well.

- * - * @param node The {@code Node} to add {@code Style} attributes. - */ - private void writeAttributes(Element node) { - for (int i = 0; i <= TEXT_INDENT; i++) { - if (isSet[i]) { - double temp = value[i] / 100.0; - String stringVal = Double.toString(temp) + "mm"; - node.setAttribute(attrName[i], stringVal); - } - } - - if (isSet[LINE_HEIGHT]) { - String stringVal; - if ((value[LINE_HEIGHT] & LH_PCT) != 0) - stringVal = Integer.toString(value[LINE_HEIGHT] & LH_VALUEMASK) + "%"; - else { - double temp = (value[LINE_HEIGHT] & LH_VALUEMASK) / 100.0; - stringVal = Double.toString(temp) + "mm"; - } - node.setAttribute(attrName[LINE_HEIGHT], stringVal); - } - - if (isSet[TEXT_ALIGN]) { - String val; - switch (value[TEXT_ALIGN]) { - case ALIGN_RIGHT: val = "end"; break; - case ALIGN_CENTER: val = "center"; break; - case ALIGN_JUST: val = "justify"; break; - case ALIGN_LEFT: val = "left"; break; - default: val = "unknown"; break; - } - node.setAttribute(attrName[TEXT_ALIGN], val); - } - } -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/Style.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/Style.java deleted file mode 100644 index d28d6a45fd1d..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/Style.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.xml; - -import org.w3c.dom.Node; -import org.w3c.dom.NamedNodeMap; - -/** - * An object of class {@code Style} represents a style in an OpenOffice - * document. - * - *

In practice subclasses of this {@code Style}, such as {@code TextStyle}, - * {@code ParaStyle} are used.

- * - * @see TextStyle - * @see ParaStyle - */ -public class Style { - - /** Name of the {@code Style}. */ - protected String name = null; - /** Family of the {@code Style}. */ - protected String family = null; - /** Parent of the {@code Style}. */ - protected String parent = null; - - /** - * A reference to the {@code StyleCatalog} to be used for looking up ancestor - * {@code Style} objects. - */ - protected StyleCatalog sc; - - /** - * Constructor for use when going from DOM to client device format. - * - * @param node A style:style or style:default-style - * {@code Node} from the document being parsed. No checking of - * {@code Node} is done, so if it is not of the proper type - * the results will be unpredictable. - * @param sc The {@code StyleCatalog}, which is used for looking up - * ancestor {@code Style} objects. - */ - public Style(Node node, StyleCatalog sc) { - - this.sc = sc; - - // Run through the attributes of this node, saving - // the ones we're interested in. - if (node.getNodeName().equals("style:default-style")) - name = "DEFAULT_STYLE"; - NamedNodeMap attrNodes = node.getAttributes(); - if (attrNodes != null) { - int len = attrNodes.getLength(); - for (int i = 0; i < len; i++) { - Node attr = attrNodes.item(i); - if (attr.getNodeName().equals("style:family")) - family = attr.getNodeValue(); - else if (attr.getNodeName().equals("style:name")) { - name = attr.getNodeValue(); - } else if (attr.getNodeName().equals("style:parent-style-name")) - parent = attr.getNodeValue(); - - } - } - } - - /** - * Constructor for use when going from client device format to DOM. - * - * @param name Name of the {@code Style}. Can be {@code null}. - * @param family Family of the {@code Style} {@literal -} usually - * paragraph, text, etc. Can be {@code null}. - * @param parent Name of the parent {@code Style}, or {@code null} if none. - * @param sc The {@code StyleCatalog}, which is used for looking up - * ancestor {@code Style} objects. - */ - public Style(String name, String family, String parent, StyleCatalog sc) { - this.sc = sc; - this.name = name; - this.family = family; - this.parent = parent; - } - - /** - * Set the {@code StyleCatalog} to be used when looking up the {@code Style} - * parent. - * - * @param sc The {@code StyleCatalog}, which is used for looking up - * ancestor {@code Style} objects. - */ - public void setCatalog(StyleCatalog sc) { - this.sc = sc; - } - - /** - * Returns the name of this {@code Style}. - * - * @return The name of this {@code Style}. - */ - public String getName() { - return name; - } - - /** - * Sets the name of this {@code Style}. - * - * @param newName The new name of this {@code Style}. - */ - public void setName(String newName) { - name = newName; - } - - /** - * Return the family of this {@code Style}. - * - * @return The family of this {@code Style}. - */ - public String getFamily() { - return family; - } - - /** - * Return the name of the parent of this {@code Style}. - * - * @return The parent of this {@code Style}. - */ - public String getParent() { - return parent; - } - - /** - * Return a {@code Style} object corresponding to this one, but with all of - * the inherited information from parent {@code Style} objects filled in. - * - *

The object returned will be a new object, not a reference to this - * object, even if it does not need any information added.

- * - * @return A resolved {@code Style} object in which to look up ancestors. - */ - public Style getResolved() { - return new Style(name, family, parent, sc); - } - - /** - * Write a {@code Node} in {@code parentDoc} representing this {@code Style}. - * - *

Note that the {@code Node} is returned unconnected.

- * - * @param parentDoc Document to which new {@code Node} will belong. - * @param name Name to use for new {@code Node}. - */ - public Node createNode(org.w3c.dom.Document parentDoc, String name) { - // DJP: write this! Should call writeAttributes() - return null; - } - - /** - * Return {@code true} if {@code Style} is a subset of this one. - * - *

Note that this will return true even if {@code Style} is less specific - * than this {@code Style}, so long as it does not contradict this - * {@code Style} in any way.

- * - *

This always returns true since only subclasses of {@code Style} - * contain any actual {@code Style} information.

- * - * @param style The {@code Style} to check. - * - * @return {@code true} if the {@code Style} is a subset, {@code false} - * otherwise. - */ - public boolean isSubset(Style style) { - return true; - } -} \ No newline at end of file diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java deleted file mode 100644 index f08d664d9a3d..000000000000 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.xmerge.converter.xml; - -import java.lang.reflect.Constructor; -import java.util.ArrayList; - -import org.openoffice.xmerge.util.Debug; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * A {@code StyleCatalog} holds a collection of {@code Style} objects. - * - *

It is intended for use when parsing or building a DOM document.

- * - *

Each entry in the {@code StyleCatalog} represents a {@code Style}, and is - * an object which is a subclass of {@code Style}.

- * - * @see Style - */ -public class StyleCatalog { - - private final ArrayList