avmedia/source/macavf/framegrabber.hxx | 1 avmedia/source/macavf/framegrabber.mm | 18 -- cui/source/inc/border.hxx | 1 cui/source/tabpages/border.cxx | 32 +++- cui/source/tabpages/borderconn.cxx | 17 +- cui/source/tabpages/borderconn.hxx | 2 desktop/source/lib/init.cxx | 3 editeng/source/editeng/impedit.cxx | 3 extensions/source/ole/unoobjw.cxx | 11 + include/comphelper/windowsdebugoutput.hxx | 27 +++ include/editeng/editids.hrc | 2 include/sfx2/controlwrapper.hxx | 7 + include/sfx2/itemconnect.hxx | 17 +- include/vcl/dialog.hxx | 7 - oox/source/export/drawingml.cxx | 87 ++++++++++-- oox/source/export/shapes.cxx | 1 sc/source/ui/app/inputhdl.cxx | 8 - sc/source/ui/unoobj/docuno.cxx | 24 +-- sd/qa/unit/data/pptx/tdf111789.pptx |binary sd/qa/unit/export-tests-ooxml2.cxx | 39 +++++ sd/qa/unit/tiledrendering/data/cut_selection_change.odp |binary sd/qa/unit/tiledrendering/data/paste_text_onslide.odp |binary sd/qa/unit/tiledrendering/tiledrendering.cxx | 109 ++++++++++++++++ sd/source/ui/unoidl/unomodel.cxx | 20 +- sd/source/ui/view/sdview2.cxx | 8 + sfx2/source/control/unoctitm.cxx | 1 sfx2/source/dialog/tabdlg.cxx | 93 ++++++++----- sfx2/source/doc/docfile.cxx | 51 +++++-- sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 6 sw/source/core/bastyp/init.cxx | 4 sw/source/ui/envelp/envfmt.cxx | 4 sw/source/uibase/app/docst.cxx | 6 sw/source/uibase/inc/uitool.hxx | 10 - sw/source/uibase/shells/textsh1.cxx | 4 sw/source/uibase/uno/unotxdoc.cxx | 19 +- sw/source/uibase/utlui/uitool.cxx | 92 ++++--------- uui/inc/strings.hrc | 1 uui/source/iahndl-locking.cxx | 5 uui/source/trylater.cxx | 29 +++- uui/source/trylater.hxx | 2 vcl/source/gdi/sallayout.cxx | 4 vcl/source/window/dialog.cxx | 26 +++ vcl/source/window/msgbox.cxx | 1 vcl/source/window/window.cxx | 2 44 files changed, 560 insertions(+), 244 deletions(-)
New commits: commit 07c2d891cb6d83e47624104107226f20b9c2b4f3 Author: martinb214 <bakosmar...@gmail.com> Date: Wed Dec 6 20:58:45 2017 +0100 tdf#111790: Shadow imported from a PPTX file is not overriden by the settings while saving back to PPTX Reviewed-on: https://gerrit.libreoffice.org/45989 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 7f42b0f96a2798ae99aa65b84b0db3b2af2b282b) Change-Id: I958f1987d0123bcf89ef37b13807f407781f3c15 diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index b13d79ac8169..1067240fbe81 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3220,25 +3220,25 @@ sal_Int32 lcl_CalculateDir(const double dX, const double dY) void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet ) { + if( !GetProperty( rXPropSet, "InteropGrabBag" ) ) + return; + Sequence< PropertyValue > aGrabBag, aEffects, aOuterShdwProps; - if( GetProperty( rXPropSet, "InteropGrabBag" ) ) + mAny >>= aGrabBag; + for( sal_Int32 i=0; i < aGrabBag.getLength(); ++i ) { - mAny >>= aGrabBag; - for( sal_Int32 i=0; i < aGrabBag.getLength(); ++i ) + if( aGrabBag[i].Name == "EffectProperties" ) { - if( aGrabBag[i].Name == "EffectProperties" ) + aGrabBag[i].Value >>= aEffects; + for( sal_Int32 j=0; j < aEffects.getLength(); ++j ) { - aGrabBag[i].Value >>= aEffects; - for( sal_Int32 j=0; j < aEffects.getLength(); ++j ) + if( aEffects[j].Name == "outerShdw" ) { - if( aEffects[j].Name == "outerShdw" ) - { - aEffects[j].Value >>= aOuterShdwProps; - break; - } + aEffects[j].Value >>= aOuterShdwProps; + break; } - break; } + break; } } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 4240f7530f7c..3e8a6e0fe333 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -170,7 +170,7 @@ DECLARE_OOXMLEXPORT_TEST(testShapeEffectPreservation, "shape-effect-preservation "dir", "2700000"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw", - "dist", "38100"); + "dist", "37674"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw", "rotWithShape", "0"); @@ -193,7 +193,7 @@ DECLARE_OOXMLEXPORT_TEST(testShapeEffectPreservation, "shape-effect-preservation "dir", "2700000"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw", - "dist", "203200"); + "dist", "203137"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw", "rotWithShape", "0"); @@ -440,7 +440,7 @@ DECLARE_OOXMLEXPORT_TEST(testPictureEffectPreservation, "picture-effects-preserv // second picture: shadow and reflection effects assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:outerShdw", - "dir", "8100000"); + "dir", "8076614"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:outerShdw/a:srgbClr", "val", "000000"); commit b8adff2c5342623eafa3fa5d1e89d6e06b2aa571 Author: Tamás Zolnai <tamas.zol...@collabora.com> Date: Tue Feb 27 06:54:16 2018 +0100 tdf#111789: TextBox shadow propeties are not saved to PPTX Reviewed-on: https://gerrit.libreoffice.org/50402 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit f41a08183504a59d6ffc7a00ed7f24e6b19995ab) Change-Id: I0c858676e1fc02a72b4b6bfd10f512d8e9166061 diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 25d4e23fbb5c..b13d79ac8169 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3208,25 +3208,45 @@ void DrawingML::WriteShapeEffect( const OUString& sName, const Sequence< Propert } } -void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet ) +sal_Int32 lcl_CalculateDist(const double dX, const double dY) { - if( !GetProperty( rXPropSet, "InteropGrabBag" ) ) - return; + return static_cast< sal_Int32 >(sqrt(dX*dX + dY*dY) * 360); +} - Sequence< PropertyValue > aGrabBag, aEffects; - mAny >>= aGrabBag; - for( sal_Int32 i=0; i < aGrabBag.getLength(); ++i ) +sal_Int32 lcl_CalculateDir(const double dX, const double dY) +{ + return (static_cast< sal_Int32 >(atan2(dY,dX) * 180 * 60000 / M_PI) + 21600000) % 21600000; +} + +void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet ) +{ + Sequence< PropertyValue > aGrabBag, aEffects, aOuterShdwProps; + if( GetProperty( rXPropSet, "InteropGrabBag" ) ) { - if( aGrabBag[i].Name == "EffectProperties" ) + mAny >>= aGrabBag; + for( sal_Int32 i=0; i < aGrabBag.getLength(); ++i ) { - aGrabBag[i].Value >>= aEffects; - break; + if( aGrabBag[i].Name == "EffectProperties" ) + { + aGrabBag[i].Value >>= aEffects; + for( sal_Int32 j=0; j < aEffects.getLength(); ++j ) + { + if( aEffects[j].Name == "outerShdw" ) + { + aEffects[j].Value >>= aOuterShdwProps; + break; + } + } + break; + } } } + if( aEffects.getLength() == 0 ) { bool bHasShadow = false; - rXPropSet->getPropertyValue( "Shadow" ) >>= bHasShadow; + if( GetProperty( rXPropSet, "Shadow" ) ) + mAny >>= bHasShadow; if( bHasShadow ) { Sequence< PropertyValue > aShadowGrabBag( 3 ); @@ -3237,9 +3257,9 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet ) rXPropSet->getPropertyValue( "ShadowYDistance" ) >>= dY; aShadowAttribsGrabBag[0].Name = "dist"; - aShadowAttribsGrabBag[0].Value <<= static_cast< sal_Int32 >(sqrt(dX*dX + dY*dY) * 360); + aShadowAttribsGrabBag[0].Value <<= lcl_CalculateDist(dX, dY); aShadowAttribsGrabBag[1].Name = "dir"; - aShadowAttribsGrabBag[1].Value <<= (static_cast< sal_Int32 >(atan2(dY,dX) * 180 * 60000 / M_PI) + 21600000) % 21600000; + aShadowAttribsGrabBag[1].Value <<= lcl_CalculateDir(dX, dY);; aShadowGrabBag[0].Name = "Attribs"; aShadowGrabBag[0].Value <<= aShadowAttribsGrabBag; @@ -3252,19 +3272,60 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet ) WriteShapeEffect( "outerShdw", aShadowGrabBag ); mpFS->endElementNS(XML_a, XML_effectLst); } - return; } + else + { + for( sal_Int32 i=0; i < aOuterShdwProps.getLength(); ++i ) + { + if( aOuterShdwProps[i].Name == "Attribs" ) + { + Sequence< PropertyValue > aAttribsProps; + aOuterShdwProps[i].Value >>= aAttribsProps; - mpFS->startElementNS(XML_a, XML_effectLst, FSEND); + double dX = +0.0, dY = +0.0; + rXPropSet->getPropertyValue( "ShadowXDistance" ) >>= dX; + rXPropSet->getPropertyValue( "ShadowYDistance" ) >>= dY; - for( sal_Int32 i=0; i < aEffects.getLength(); ++i ) - { - Sequence< PropertyValue > aEffectProps; - aEffects[i].Value >>= aEffectProps; - WriteShapeEffect( aEffects[i].Name, aEffectProps ); - } + for( sal_Int32 j=0; j < aAttribsProps.getLength(); ++j ) + { + if( aAttribsProps[j].Name == "dist" ) + { + aAttribsProps[j].Value <<= lcl_CalculateDist(dX, dY); + } + else if( aAttribsProps[j].Name == "dir" ) + { + aAttribsProps[j].Value <<= lcl_CalculateDir(dX, dY); + } + } - mpFS->endElementNS(XML_a, XML_effectLst); + aOuterShdwProps[i].Value <<= aAttribsProps; + } + else if( aOuterShdwProps[i].Name == "RgbClr" ) + { + aOuterShdwProps[i].Value = rXPropSet->getPropertyValue( "ShadowColor" ); + } + else if( aOuterShdwProps[i].Name == "RgbClrTransparency" ) + { + aOuterShdwProps[i].Value = rXPropSet->getPropertyValue( "ShadowTransparence" ); + } + } + + mpFS->startElementNS(XML_a, XML_effectLst, FSEND); + for( sal_Int32 i=0; i < aEffects.getLength(); ++i ) + { + if( aEffects[i].Name == "outerShdw" ) + { + WriteShapeEffect( aEffects[i].Name, aOuterShdwProps ); + } + else + { + Sequence< PropertyValue > aEffectProps; + aEffects[i].Value >>= aEffectProps; + WriteShapeEffect( aEffects[i].Name, aEffectProps ); + } + } + mpFS->endElementNS(XML_a, XML_effectLst); + } } void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index a80809c663e2..3fcd9d714df7 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1846,6 +1846,7 @@ ShapeExport& ShapeExport::WriteTextShape( const Reference< XShape >& xShape ) uno::Reference<beans::XPropertySet> xPropertySet(xShape, UNO_QUERY); WriteBlipOrNormalFill(xPropertySet, "GraphicURL"); WriteOutline(xPropertySet); + WriteShapeEffects(xPropertySet); pFS->endElementNS( mnXmlNamespace, XML_spPr ); WriteTextBox( xShape, mnXmlNamespace ); diff --git a/sd/qa/unit/data/pptx/tdf111789.pptx b/sd/qa/unit/data/pptx/tdf111789.pptx new file mode 100755 index 000000000000..32d7d754a0c2 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf111789.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index f09345d9e9cc..95c37031ade3 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -129,6 +129,7 @@ public: void testFontScale(); void testTdf115394(); void testTdf115394Zero(); + void testTdf111789(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -183,6 +184,7 @@ public: CPPUNIT_TEST(testFontScale); CPPUNIT_TEST(testTdf115394); CPPUNIT_TEST(testTdf115394Zero); + CPPUNIT_TEST(testTdf111789); CPPUNIT_TEST_SUITE_END(); @@ -1433,6 +1435,43 @@ void SdOOXMLExportTest2::testTdf115394Zero() xDocShRef->DoClose(); } +void SdOOXMLExportTest2::testTdf111789() +{ + // Shadow properties were not exported for text shapes. + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf111789.pptx"), PPTX); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + // First text shape has some shadow + { + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); + bool bHasShadow = false; + xShape->getPropertyValue("Shadow") >>= bHasShadow; + CPPUNIT_ASSERT(bHasShadow); + double fShadowDist = 0.0; + xShape->getPropertyValue("ShadowXDistance") >>= fShadowDist; + CPPUNIT_ASSERT_EQUAL(static_cast<double>(273), fShadowDist); + xShape->getPropertyValue("ShadowYDistance") >>= fShadowDist; + CPPUNIT_ASSERT_EQUAL(static_cast<double>(273), fShadowDist); + sal_Int32 nColor = 0; + xShape->getPropertyValue("ShadowColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xFF0000), nColor); + sal_Int32 nTransparency = 0; + xShape->getPropertyValue("ShadowTransparence") >>= nTransparency; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(7), nTransparency); + } + + // Second text shape has no shadow + { + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 1, 0, xDocShRef ) ); + bool bHasShadow = false; + xShape->getPropertyValue("Shadow") >>= bHasShadow; + CPPUNIT_ASSERT(!bHasShadow); + } + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); commit 83067815810a78591556214de5ee2825f89e1de7 Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Wed Feb 21 00:45:04 2018 +0300 tdf#115742: allow ignoring stale lockfile on save This change reuses TryLaterQueryBox, but only uses the new option to ignore the lock and save. Other options ("Try Again" and "Save As") are not used, because this functionality is not implemented currently (TODO/LATER). Change-Id: Idf825be23cf97d2b338c0cf5d532f8460843bf48 Reviewed-on: https://gerrit.libreoffice.org/50371 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit a30f8c4daaab5bfc850c18b2b0bce3fdb2281a1f) diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 2d06bdf86ef6..8ae94f175b6a 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/document/XDocumentRevisionListPersistence.hpp> #include <com/sun/star/document/LockedDocumentRequest.hpp> +#include <com/sun/star/document/LockedOnSavingRequest.hpp> #include <com/sun/star/document/OwnLockOnDocumentRequest.hpp> #include <com/sun/star/document/LockFileIgnoreRequest.hpp> #include <com/sun/star/document/LockFileCorruptRequest.hpp> @@ -65,6 +66,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/security/DocumentSignatureInformation.hpp> #include <com/sun/star/security/DocumentDigitalSignatures.hpp> +#include <o3tl/make_unique.hxx> #include <tools/urlobj.hxx> #include <unotools/configmgr.hxx> #include <unotools/tempfile.hxx> @@ -838,7 +840,7 @@ SfxMedium::ShowLockResult SfxMedium::ShowLockedDocumentDialog( const LockFileEnt // show the interaction regarding the document opening uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler(); - if ( ::svt::DocumentLockFile::IsInteractionAllowed() && xHandler.is() && ( bIsLoading || bOwnLock ) ) + if ( ::svt::DocumentLockFile::IsInteractionAllowed() && xHandler.is() && ( bIsLoading || !bHandleSysLocked || bOwnLock ) ) { OUString aDocumentURL = GetURLObject().GetLastName(); OUString aInfo; @@ -853,27 +855,32 @@ SfxMedium::ShowLockResult SfxMedium::ShowLockedDocumentDialog( const LockFileEnt xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny( document::OwnLockOnDocumentRequest( OUString(), uno::Reference< uno::XInterface >(), aDocumentURL, aInfo, !bIsLoading ) ) ); } - else /*logically therefore bIsLoading is set */ + else { + // Use a fourth continuation in case there's no filesystem lock: + // "Ignore lock file and open/replace the document" + if (!bHandleSysLocked) + nContinuations = 4; + if ( !aData[LockFileComponent::OOOUSERNAME].isEmpty() ) aInfo = aData[LockFileComponent::OOOUSERNAME]; else aInfo = aData[LockFileComponent::SYSUSERNAME]; if ( !aInfo.isEmpty() && !aData[LockFileComponent::EDITTIME].isEmpty() ) + aInfo += " ( " + aData[LockFileComponent::EDITTIME] + " )"; + + if (!bIsLoading) // so, !bHandleSysLocked { - aInfo += " ( " ; - aInfo += aData[LockFileComponent::EDITTIME]; - aInfo += " )"; + xInteractionRequestImpl = new ::ucbhelper::InteractionRequest(uno::makeAny( + document::LockedOnSavingRequest(OUString(), uno::Reference< uno::XInterface >(), aDocumentURL, aInfo))); + // Currently, only the last "Retry" continuation (meaning ignore the lock and try overwriting) can be returned. + } + else /*logically therefore bIsLoading is set */ + { + xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny( + document::LockedDocumentRequest( OUString(), uno::Reference< uno::XInterface >(), aDocumentURL, aInfo ) ) ); } - - xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny( - document::LockedDocumentRequest( OUString(), uno::Reference< uno::XInterface >(), aDocumentURL, aInfo ) ) ); - - // Use a fourth continuation in case there's no filesystem lock: - // "Ignore lock file and open the document" - if (!bHandleSysLocked) - nContinuations = 4; } uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations(nContinuations); @@ -883,7 +890,7 @@ SfxMedium::ShowLockResult SfxMedium::ShowLockedDocumentDialog( const LockFileEnt if (nContinuations > 3) { // We use InteractionRetry to reflect that user wants to - // ignore the (stale?) alien lock file and open the document + // ignore the (stale?) alien lock file and open/overwrite the document aContinuations[3] = new ::ucbhelper::InteractionRetry(xInteractionRequestImpl.get()); } xInteractionRequestImpl->setContinuations( aContinuations ); @@ -1214,6 +1221,22 @@ SfxMedium::LockFileResult SfxMedium::LockOrigFileOnDemand( bool bLoading, bool b // if system lock is used the writeable stream should be available bool bHandleSysLocked = ( bLoading && bUseSystemLock && !pImpl->xStream.is() && !pImpl->m_pOutStream ); + // The file is attempted to get locked for the duration of lockfile creation on save + std::unique_ptr<osl::File> pFileLock; + if (!bLoading && bUseSystemLock && pImpl->pTempFile) + { + INetURLObject aDest(GetURLObject()); + OUString aDestURL(aDest.GetMainURL(INetURLObject::DecodeMechanism::NONE)); + + if (comphelper::isFileUrl(aDestURL) || !aDest.removeSegment()) + { + pFileLock = o3tl::make_unique<osl::File>(aDestURL); + auto rc = pFileLock->open(osl_File_OpenFlag_Write); + if (rc == osl::FileBase::E_ACCES) + bHandleSysLocked = true; + } + } + do { try diff --git a/uui/inc/strings.hrc b/uui/inc/strings.hrc index 590a582eba06..a47412520bca 100644 --- a/uui/inc/strings.hrc +++ b/uui/inc/strings.hrc @@ -59,6 +59,7 @@ #define STR_TRYLATER_TITLE NC_("STR_TRYLATER_TITLE", "Document in Use") #define STR_TRYLATER_MSG NC_("STR_TRYLATER_MSG", "Document file '$(ARG1)' is locked for editing by:\n\n$(ARG2)\n\nTry again later to save document or save a copy of that document.\n\n") +#define STR_OVERWRITE_IGNORELOCK_MSG NC_("STR_OVERWRITE_IGNORELOCK_MSG", "Document file '$(ARG1)' is locked for editing by:\n\n$(ARG2)\n\nYou may try to ignore the file locking and overwrite the existing document.\n\n") #define STR_TRYLATER_RETRYSAVING_BTN NC_("STR_TRYLATER_RETRYSAVING_BTN", "~Retry Saving") #define STR_TRYLATER_SAVEAS_BTN NC_("STR_TRYLATER_SAVEAS_BTN", "~Save As...") diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx index 08b5b5c7fd99..ecd49ea55baf 100644 --- a/uui/source/iahndl-locking.cxx +++ b/uui/source/iahndl-locking.cxx @@ -105,11 +105,12 @@ handleLockedDocumentRequest_( ? aInfo : Translate::get( STR_UNKNOWNUSER, aResLocale ) ); - aMessage = Translate::get(STR_TRYLATER_MSG, aResLocale); + aMessage = Translate::get(xRetry.is() ? STR_OVERWRITE_IGNORELOCK_MSG : STR_TRYLATER_MSG, + aResLocale); aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); - ScopedVclPtrInstance< TryLaterQueryBox > xDialog(pParent, aResLocale, aMessage); + ScopedVclPtrInstance< TryLaterQueryBox > xDialog(pParent, aResLocale, aMessage, xRetry.is()); nResult = xDialog->Execute(); } else if ( nMode == UUI_DOC_OWN_LOAD_LOCK || diff --git a/uui/source/trylater.cxx b/uui/source/trylater.cxx index d61f2e653bf8..e2c21049e498 100644 --- a/uui/source/trylater.cxx +++ b/uui/source/trylater.cxx @@ -21,18 +21,33 @@ #include <strings.hrc> #include "trylater.hxx" -TryLaterQueryBox::TryLaterQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage) +TryLaterQueryBox::TryLaterQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage, bool bEnableOverride) : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_TRYLATER_TITLE, rResLocale), aMessage) { SetImage( QueryBox::GetStandardImage() ); - AddButton(Translate::get(STR_TRYLATER_RETRYSAVING_BTN, rResLocale), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - AddButton(Translate::get(STR_TRYLATER_SAVEAS_BTN, rResLocale), RET_NO); - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); + // Currently we don't have the retry/save-as functionality implemented for cases when file is locked. + // So threat them mutually exclusive with overwrite here. TODO/LATER: just add the overwrite option + // as third option when retrying and saving with another name would be possible along with overwriting + if (bEnableOverride) + { + AddButton(Translate::get(STR_FILECHANGED_SAVEANYWAY_BTN, rResLocale), RET_IGNORE, + ButtonDialogFlags::OK); + AddButton(StandardButtonType::Cancel, RET_CANCEL, + ButtonDialogFlags::Default | ButtonDialogFlags::Cancel | ButtonDialogFlags::Focus); - SetButtonHelpText( RET_YES, OUString() ); - SetButtonHelpText( RET_NO, OUString() ); + SetButtonHelpText(RET_IGNORE, OUString()); + } + else + { + AddButton(Translate::get(STR_TRYLATER_RETRYSAVING_BTN, rResLocale), RET_YES, + ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); + AddButton(Translate::get(STR_TRYLATER_SAVEAS_BTN, rResLocale), RET_NO); + AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); + + SetButtonHelpText( RET_YES, OUString() ); + SetButtonHelpText( RET_NO, OUString() ); + } } TryLaterQueryBox::~TryLaterQueryBox() diff --git a/uui/source/trylater.hxx b/uui/source/trylater.hxx index 23d0a0c78841..f03f3cf92187 100644 --- a/uui/source/trylater.hxx +++ b/uui/source/trylater.hxx @@ -24,7 +24,7 @@ class TryLaterQueryBox : public MessBox { public: - TryLaterQueryBox(vcl::Window* pParent, const std::locale& rLocale, const OUString& aMessage); + TryLaterQueryBox(vcl::Window* pParent, const std::locale& rLocale, const OUString& aMessage, bool bEnableOverride); virtual ~TryLaterQueryBox() override; }; commit c8d7f1f3938897b869fc4956c6085028fd807bae Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Feb 21 19:58:11 2018 +0100 sc lok: Make the Validation "Invalid value." message box working. Change-Id: Ic0131fa6fc397ae440efed834266b8396aa9e619 Reviewed-on: https://gerrit.libreoffice.org/50160 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Jan Holesovsky <ke...@collabora.com> (cherry picked from commit b8d5061f54408960177992d0f4be312b7d123167) diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index c2c7c2fe9870..0ba15407ae08 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -61,7 +61,6 @@ private: SAL_DLLPRIVATE void RemoveFromDlgList(); SAL_DLLPRIVATE void ImplInitDialogData(); SAL_DLLPRIVATE void ImplInitSettings(); - SAL_DLLPRIVATE inline void ImplLOKNotifier(vcl::Window* pParent); SAL_DLLPRIVATE VclPtr<vcl::Window> AddBorderWindow(vcl::Window* pParent, WinBits nBits); virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; @@ -75,6 +74,9 @@ protected: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag = InitFlag::Default ); + /// Find and set the LOK notifier according to the pParent. + void ImplLOKNotifier(vcl::Window* pParent); + public: SAL_DLLPRIVATE bool IsInClose() const { return mbInClose; } virtual void doDeferredInit(WinBits nBits) override; diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 94f3464c783f..e3393140670c 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -2665,8 +2665,12 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) if ( pActiveViewSh ) // If it came from MouseButtonDown pActiveViewSh->StopMarking(); // (the InfoBox consumes the MouseButtonUp) - //FIXME: We still run into problems if the input is triggered by activating another View - vcl::Window* pParent = Application::GetDefDialogParent(); + vcl::Window* pParent = nullptr; + if (pActiveViewSh) + pParent = &pActiveViewSh->GetViewFrame()->GetWindow(); + else + pParent = Application::GetDefDialogParent(); + if ( pData->DoError( pParent, aString, aCursorPos ) ) bForget = true; // Do not take over input } diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index e45dfd0dee4f..2a99d25ac2ee 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -130,6 +130,7 @@ MessBox::MessBox(vcl::Window* pParent, MessBoxStyle nMessBoxStyle, WinBits nWinB mnMessBoxStyle( nMessBoxStyle ), maMessText( rMessage ) { + ImplLOKNotifier(pParent); ImplInit(pParent, nWinBits | WB_MOVEABLE | WB_HORZ | WB_CENTER); ImplInitButtons(); commit 207ea7c8637112f6fb0eaf8b45a32bb37d5d25be Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Sun Feb 25 21:00:07 2018 +0300 tdf#116020: use actual whichIds in dialogs for character properties ... instead of converting back and forth between character-specific whichIds and generic. This eliminates creating duplicate properties in the set passed to dialog. A temporary GrabBag entry "DialogUseCharAttr" is used to indicate that dialogs should use character-specific Ids. This simplifies and unifies preparation of the set for different dialogs. Reviewed-on: https://gerrit.libreoffice.org/50339 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 074fc4a1499aac6eb67cd0b2dca00a51071cff0e) Change-Id: I41b982ff05d54b0dfc283c07aef806f51c87209c diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx index 6502549ac6d7..b8fb44b4021e 100644 --- a/cui/source/inc/border.hxx +++ b/cui/source/inc/border.hxx @@ -107,6 +107,7 @@ private: long nMinValue; ///< minimum distance SwBorderModes nSWMode; ///< table, textframe, paragraph + sal_uInt16 mnBoxSlot; bool mbHorEnabled; ///< true = Inner horizontal border enabled. bool mbVerEnabled; ///< true = Inner vertical border enabled. diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index ce41f82989e7..e1e3cbcad398 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -40,6 +40,7 @@ #include <vcl/settings.hxx> #include <svx/flagsdef.hxx> #include <sfx2/request.hxx> +#include <svl/grabbagitem.hxx> #include <svl/intitem.hxx> #include <svl/ilstitem.hxx> #include <svl/int64item.hxx> @@ -97,6 +98,7 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore : SfxTabPage(pParent, "BorderPage", "cui/ui/borderpage.ui", &rCoreAttrs) , nMinValue(0) , nSWMode(SwBorderModes::NONE) + , mnBoxSlot(SID_ATTR_BORDER_OUTER) , mbHorEnabled(false) , mbVerEnabled(false) , mbTLBREnabled(false) @@ -317,9 +319,25 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore FillLineListBox_Impl(); // connections - bool bSupportsShadow = !SfxItemPool::IsSlot( GetWhich( SID_ATTR_BORDER_SHADOW ) ); + sal_uInt16 nShadowSlot = SID_ATTR_BORDER_SHADOW; + if (rCoreAttrs.HasItem(GetWhich(SID_ATTR_CHAR_GRABBAG), &pItem)) + { + const SfxGrabBagItem* pGrabBag = static_cast<const SfxGrabBagItem*>(pItem); + auto it = pGrabBag->GetGrabBag().find("DialogUseCharAttr"); + if (it != pGrabBag->GetGrabBag().end()) + { + bool bDialogUseCharAttr = false; + it->second >>= bDialogUseCharAttr; + if (bDialogUseCharAttr) + { + nShadowSlot = SID_ATTR_CHAR_SHADOW; + mnBoxSlot = SID_ATTR_CHAR_BOX; + } + } + } + bool bSupportsShadow = !SfxItemPool::IsSlot( GetWhich( nShadowSlot ) ); if( bSupportsShadow ) - AddItemConnection( svx::CreateShadowConnection( rCoreAttrs, *m_pWndShadows, *m_pEdShadowSize, *m_pLbShadowColor ) ); + AddItemConnection( svx::CreateShadowConnection( nShadowSlot, rCoreAttrs, *m_pWndShadows, *m_pEdShadowSize, *m_pLbShadowColor ) ); else HideShadowControls(); @@ -428,10 +446,10 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet ) const SvxBoxItem* pBoxItem; const SvxBoxInfoItem* pBoxInfoItem; - sal_uInt16 nWhichBox = GetWhich(SID_ATTR_BORDER_OUTER); + sal_uInt16 nWhichBox = GetWhich(mnBoxSlot); MapUnit eCoreUnit; - pBoxItem = static_cast<const SvxBoxItem*>(GetItem( *rSet, SID_ATTR_BORDER_OUTER )); + pBoxItem = static_cast<const SvxBoxItem*>(GetItem( *rSet, mnBoxSlot )); pBoxInfoItem = static_cast<const SvxBoxInfoItem*>(GetItem( *rSet, SID_ATTR_BORDER_INNER, false )); @@ -649,12 +667,12 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) bool bAttrsChanged = SfxTabPage::FillItemSet( rCoreAttrs ); bool bPut = true; - sal_uInt16 nBoxWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + sal_uInt16 nBoxWhich = GetWhich( mnBoxSlot ); sal_uInt16 nBoxInfoWhich = rCoreAttrs->GetPool()->GetWhich( SID_ATTR_BORDER_INNER, false ); const SfxItemSet& rOldSet = GetItemSet(); SvxBoxItem aBoxItem ( nBoxWhich ); SvxBoxInfoItem aBoxInfoItem ( nBoxInfoWhich ); - const SvxBoxItem* pOldBoxItem = static_cast<const SvxBoxItem*>(GetOldItem( *rCoreAttrs, SID_ATTR_BORDER_OUTER )); + const SvxBoxItem* pOldBoxItem = static_cast<const SvxBoxItem*>(GetOldItem( *rCoreAttrs, mnBoxSlot )); MapUnit eCoreUnit = rOldSet.GetPool()->GetMetric( nBoxWhich ); @@ -1226,7 +1244,7 @@ void SvxBorderTabPage::UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset ) return; const SfxItemSet& rOldSet = GetItemSet(); const SvxBoxInfoItem* pOldBoxInfoItem = static_cast<const SvxBoxInfoItem*>(GetOldItem( rOldSet, SID_ATTR_BORDER_INNER )); - const SvxBoxItem* pOldBoxItem = static_cast<const SvxBoxItem*>(GetOldItem( rOldSet, SID_ATTR_BORDER_OUTER )); + const SvxBoxItem* pOldBoxItem = static_cast<const SvxBoxItem*>(GetOldItem( rOldSet, mnBoxSlot )); if( !pOldBoxInfoItem || !pOldBoxItem ) return; std::pair<svx::FrameBorderType, SvxBoxInfoItemValidFlags> eTypes1[] = { diff --git a/cui/source/tabpages/borderconn.cxx b/cui/source/tabpages/borderconn.cxx index 7b49f35022f1..78d2c3ba637e 100644 --- a/cui/source/tabpages/borderconn.cxx +++ b/cui/source/tabpages/borderconn.cxx @@ -254,13 +254,13 @@ void ShadowControlsWrapper::SetControlValue( SvxShadowItem aItem ) class ShadowConnection : public sfx::ItemControlConnection< ShadowItemWrapper, ShadowControlsWrapper > { public: - explicit ShadowConnection( const SfxItemSet& rItemSet, + explicit ShadowConnection( sal_uInt16 nSlot, const SfxItemSet& rItemSet, ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ); }; -ShadowConnection::ShadowConnection( const SfxItemSet& rItemSet, +ShadowConnection::ShadowConnection( sal_uInt16 nSlot, const SfxItemSet& rItemSet, ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ) : - ItemControlConnectionType( SID_ATTR_BORDER_SHADOW, new ShadowControlsWrapper( rVsPos, rMfSize, rLbColor ), ItemConnFlags::NONE ) + ItemControlConnectionType( nSlot, new ShadowControlsWrapper( rVsPos, rMfSize, rLbColor ), ItemConnFlags::NONE ) { mxCtrlWrp->SetDefaultValue( maItemWrp.GetDefaultItem( rItemSet ) ); } @@ -279,10 +279,10 @@ sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet, return new MarginConnection( rItemSet, rMfLeft, rMfRight, rMfTop, rMfBottom ); } -sfx::ItemConnectionBase* CreateShadowConnection( const SfxItemSet& rItemSet, +sfx::ItemConnectionBase* CreateShadowConnection( sal_uInt16 nSlot, const SfxItemSet& rItemSet, ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ) { - return new ShadowConnection( rItemSet, rVsPos, rMfSize, rLbColor ); + return new ShadowConnection( nSlot, rItemSet, rVsPos, rMfSize, rLbColor ); } diff --git a/cui/source/tabpages/borderconn.hxx b/cui/source/tabpages/borderconn.hxx index b04d4a8b0c1f..01b404667f49 100644 --- a/cui/source/tabpages/borderconn.hxx +++ b/cui/source/tabpages/borderconn.hxx @@ -46,7 +46,7 @@ sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet, /** Creates an item connection object that connects an SvxShadowItem with the controls of the SvxBorderTabPage. */ -sfx::ItemConnectionBase* CreateShadowConnection( const SfxItemSet& rItemSet, +sfx::ItemConnectionBase* CreateShadowConnection( sal_uInt16 nSlot, const SfxItemSet& rItemSet, ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ); diff --git a/include/editeng/editids.hrc b/include/editeng/editids.hrc index f728255f4285..531fca271521 100644 --- a/include/editeng/editids.hrc +++ b/include/editeng/editids.hrc @@ -132,6 +132,8 @@ #define SID_ATTR_PARA_OUTLINE_LEVEL ( SID_EDIT_START + 73 ) #define SID_ATTR_CHAR_PREVIEW_FONT ( SID_EDIT_START + 74 ) #define SID_ATTR_CHAR_ENDPREVIEW_FONT ( SID_EDIT_START + 75 ) +#define SID_ATTR_CHAR_BOX ( SID_EDIT_START + 76 ) +#define SID_ATTR_CHAR_SHADOW ( SID_EDIT_START + 77 ) #if 95 > (SID_EDIT_END-SID_EDIT_START) diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index a17a1d31b98c..f14ae78a62e1 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -304,8 +304,8 @@ SfxItemInfo aSlotTab[] = { SID_ATTR_CHAR_HIDDEN, true }, // RES_CHRATR_HIDDEN { SID_ATTR_CHAR_OVERLINE, true }, // RES_CHRATR_OVERLINE { 0, true }, // RES_CHRATR_RSID - { 0, true }, // RES_CHRATR_BOX - { 0, true }, // RES_CHRATR_SHADOW + { SID_ATTR_CHAR_BOX, true }, // RES_CHRATR_BOX + { SID_ATTR_CHAR_SHADOW, true }, // RES_CHRATR_SHADOW { 0, true }, // RES_CHRATR_HIGHLIGHT { SID_ATTR_CHAR_GRABBAG, true }, // RES_CHRATR_GRABBAG { 0, true }, // RES_CHRATR_BIDIRTL diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index bedd8bb47fd9..841f0787ec25 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -276,7 +276,7 @@ IMPL_LINK( SwEnvFormatPage, EditHdl, MenuButton *, pButton, void ) // In order for the background color not to get ironed over: SfxAllItemSet aTmpSet(*pCollSet); - ::ConvertAttrCharToGen(aTmpSet, CONV_ATTR_ENV); + ::ConvertAttrCharToGen(aTmpSet); SwAbstractDialogFactory* pFact = swui::GetFactory(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); @@ -287,7 +287,7 @@ IMPL_LINK( SwEnvFormatPage, EditHdl, MenuButton *, pButton, void ) if (pDlg->Execute() == RET_OK) { SfxItemSet aOutputSet( *pDlg->GetOutputItemSet() ); - ::ConvertAttrGenToChar(aOutputSet, aTmpSet, CONV_ATTR_ENV); + ::ConvertAttrGenToChar(aOutputSet, aTmpSet); pCollSet->Put(aOutputSet); } } diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index ab91f5e13f26..9b785bf31c9a 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -601,7 +601,7 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void) SfxItemSet aTmpSet( *m_pDlg->GetOutputItemSet() ); if( SfxStyleFamily::Char == m_nFamily ) { - ::ConvertAttrGenToChar(aTmpSet, m_xTmp->GetItemSet(), CONV_ATTR_STD); + ::ConvertAttrGenToChar(aTmpSet, m_xTmp->GetItemSet()); } m_xTmp->SetItemSet( aTmpSet ); @@ -784,7 +784,7 @@ void SwDocShell::Edit( } else if( SfxStyleFamily::Char == nFamily ) { - ::ConvertAttrCharToGen(xTmp->GetItemSet(), CONV_ATTR_STD); + ::ConvertAttrCharToGen(xTmp->GetItemSet()); } if(SfxStyleFamily::Page == nFamily || SfxStyleFamily::Para == nFamily) @@ -880,7 +880,7 @@ void SwDocShell::Edit( ::SfxToSwPageDescAttr( *GetWrtShell(), xTmp->GetItemSet() ); else { - ::ConvertAttrGenToChar(xTmp->GetItemSet(), xTmp->GetItemSet(), CONV_ATTR_STD); + ::ConvertAttrGenToChar(xTmp->GetItemSet(), xTmp->GetItemSet()); } if(SfxStyleFamily::Page == nFamily) m_pView->InvalidateRulerPos(); diff --git a/sw/source/uibase/inc/uitool.hxx b/sw/source/uibase/inc/uitool.hxx index 2e2924df78b7..1941aa3abadc 100644 --- a/sw/source/uibase/inc/uitool.hxx +++ b/sw/source/uibase/inc/uitool.hxx @@ -42,17 +42,12 @@ SW_DLLPUBLIC void SetMetric(MetricFormatter& rCtrl, FieldUnit eUnit); // fill BoxInfo attribute SW_DLLPUBLIC void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh); -// Modes for attribute conversion -#define CONV_ATTR_STD 1 // Standard character dialog -#define CONV_ATTR_ENV 2 // Character dialog opened from envelope dialog - /** * Convert character specific attributes to general ones used by tab pages. * * @param[in,out] rSet the set in which character attributes are stored - * @param[in] nMode specify the dialog which will be called after conversion **/ -SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet& rSet, const sal_uInt8 nMode); +SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet& rSet); /** * Convert general attributes to the corresponding character attributes. @@ -60,9 +55,8 @@ SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet& rSet, const sal_uInt8 nMode); * * @param[in,out] rSet the set in which character attributes are stored * @param[in] rOrigSet original itemset used as input for the dialog - * @param[in] nMode specify the dialog which was called before **/ -SW_DLLPUBLIC void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet, const sal_uInt8 nMode); +SW_DLLPUBLIC void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet); // SfxItemSets <-> PageDesc void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc ); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index bbcecf5a3cf9..85e9a1cd23e2 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -164,7 +164,7 @@ void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, const } pCoreSet->Put(SfxUInt16Item(SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, rWrtSh.GetScalingOfSelectedText())); - ::ConvertAttrCharToGen(*pCoreSet, CONV_ATTR_STD); + ::ConvertAttrCharToGen(*pCoreSet); // Setting the BoxInfo ::PrepareBoxInfo(*pCoreSet, rWrtSh); @@ -218,7 +218,7 @@ void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, const static void sw_CharDialogResult(const SfxItemSet* pSet, SwWrtShell &rWrtSh, std::shared_ptr<SfxItemSet> pCoreSet, bool bSel, bool bSelectionPut, SfxRequest *pReq) { SfxItemSet aTmpSet( *pSet ); - ::ConvertAttrGenToChar(aTmpSet, *pCoreSet, CONV_ATTR_STD); + ::ConvertAttrGenToChar(aTmpSet, *pCoreSet); const SfxPoolItem* pSelectionItem; bool bInsert = false; diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 5d31d1d20909..19ffc32ea700 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -121,7 +121,7 @@ void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh) rSet.Put(aBoxInfo); } -void ConvertAttrCharToGen(SfxItemSet& rSet, const sal_uInt8 nMode) +void ConvertAttrCharToGen(SfxItemSet& rSet) { // Background / highlight { @@ -138,79 +138,43 @@ void ConvertAttrCharToGen(SfxItemSet& rSet, const sal_uInt8 nMode) } } - if( nMode == CONV_ATTR_STD ) - { - // Border - const SfxPoolItem *pTmpItem; - if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_BOX, true, &pTmpItem ) ) - { - SvxBoxItem aTmpBox( *static_cast<const SvxBoxItem*>(pTmpItem) ); - aTmpBox.SetWhich( RES_BOX ); - rSet.Put( aTmpBox ); - } - else - rSet.ClearItem(RES_BOX); - - // Border shadow - if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_SHADOW, false, &pTmpItem ) ) - { - SvxShadowItem aTmpShadow( *static_cast<const SvxShadowItem*>(pTmpItem) ); - aTmpShadow.SetWhich( RES_SHADOW ); - rSet.Put( aTmpShadow ); - } - else - rSet.ClearItem( RES_SHADOW ); - } + // Tell dialogs to use character-specific slots/whichIds + std::unique_ptr<SfxGrabBagItem> pGrabBag; + const SfxPoolItem *pTmpItem; + if (SfxItemState::SET == rSet.GetItemState(RES_CHRATR_GRABBAG, false, &pTmpItem)) + pGrabBag.reset(static_cast<SfxGrabBagItem*>(pTmpItem->Clone())); + else + pGrabBag.reset(new SfxGrabBagItem(RES_CHRATR_GRABBAG)); + pGrabBag->GetGrabBag()["DialogUseCharAttr"] <<= true; + rSet.Put(*pGrabBag); } -void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet, const sal_uInt8 nMode) +void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet) { // Background / highlighting + const SfxPoolItem *pTmpItem; + if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_BACKGROUND, false, &pTmpItem ) ) { - const SfxPoolItem *pTmpItem; - if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_BACKGROUND, false, &pTmpItem ) ) - { - // Highlight is an MS specific thing, so remove it at the first time when LO modifies - // this part of the imported document. - rSet.Put( SvxBrushItem(RES_CHRATR_HIGHLIGHT) ); + // Highlight is an MS specific thing, so remove it at the first time when LO modifies + // this part of the imported document. + rSet.Put( SvxBrushItem(RES_CHRATR_HIGHLIGHT) ); - // Remove shading marker - if( SfxItemState::SET == rOrigSet.GetItemState( RES_CHRATR_GRABBAG, false, &pTmpItem ) ) + // Remove shading marker + if( SfxItemState::SET == rOrigSet.GetItemState( RES_CHRATR_GRABBAG, false, &pTmpItem ) ) + { + SfxGrabBagItem aGrabBag(*static_cast<const SfxGrabBagItem*>(pTmpItem)); + std::map<OUString, css::uno::Any>& rMap = aGrabBag.GetGrabBag(); + auto aIterator = rMap.find("CharShadingMarker"); + if( aIterator != rMap.end() ) { - SfxGrabBagItem aGrabBag(*static_cast<const SfxGrabBagItem*>(pTmpItem)); - std::map<OUString, css::uno::Any>& rMap = aGrabBag.GetGrabBag(); - auto aIterator = rMap.find("CharShadingMarker"); - if( aIterator != rMap.end() ) - { - aIterator->second <<= false; - } - rSet.Put( aGrabBag ); + aIterator->second <<= false; } + // Remove temporary GrabBag entry before writing to destination set + rMap.erase("DialogUseCharAttr"); + rSet.Put( aGrabBag ); } - rSet.ClearItem( RES_BACKGROUND ); - } - - if( nMode == CONV_ATTR_STD ) - { - // Border - const SfxPoolItem *pTmpItem; - if( SfxItemState::SET == rSet.GetItemState( RES_BOX, false, &pTmpItem ) ) - { - SvxBoxItem aTmpBox( *static_cast<const SvxBoxItem*>(pTmpItem) ); - aTmpBox.SetWhich( RES_CHRATR_BOX ); - rSet.Put( aTmpBox ); - } - rSet.ClearItem( RES_BOX ); - - // Border shadow - if( SfxItemState::SET == rSet.GetItemState( RES_SHADOW, false, &pTmpItem ) ) - { - SvxShadowItem aTmpShadow( *static_cast<const SvxShadowItem*>(pTmpItem) ); - aTmpShadow.SetWhich( RES_CHRATR_SHADOW ); - rSet.Put( aTmpShadow ); - } - rSet.ClearItem( RES_SHADOW ); } + rSet.ClearItem( RES_BACKGROUND ); } // Fill header footer commit f20471d81bb0d22e124e8d599005373490eb2a71 Author: Tamas Bunth <tamas.bu...@collabora.co.uk> Date: Fri Feb 23 17:32:15 2018 +0100 tdf#115353 layout fix Change-Id: I085b330e6539adb8b924f4d7f4cd10fb593a0da6 Reviewed-on: https://gerrit.libreoffice.org/50257 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tamás Bunth <btom...@gmail.com> (cherry picked from commit 8d42909cd326cb26d8ba1fb383b5578f820c72ed) diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 7bba0b9428a0..403d0b64c723 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1226,7 +1226,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) rArgs.mnEndCharPos : rArgs.mnMinCharPos - 1; int nRunVisibleEndChar = pGlyphs[nFirstValid]->mnCharPos; // merge the fallback levels - while( nValid[0] && (nLevel > 0)) + while( nValid[nFirstValid] && (nLevel > 0)) { // find best fallback level for( n = 0; n < nLevel; ++n ) @@ -1261,7 +1261,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) nStartOld[0] = nStartNew[0]; nValid[nFirstValid] = mpLayouts[0]->GetNextGlyphs(1, &pGlyphs[nFirstValid], aPos, nStartNew[0]); - if( !nValid[0] ) + if( !nValid[nFirstValid] ) break; } } commit 785758d1cff284f016de1d2512897d6af4b798c6 Author: Tamás Zolnai <tamas.zol...@collabora.com> Date: Sat Feb 24 13:33:15 2018 +0100 Remove accidently committed debug lines Change-Id: Id083a3bb38ba89e00239e71387377691afd4f31c (cherry picked from commit c64f2d34c0e62ec288b2e1453bf91f9f650db845) diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 7ce798600084..5229db8759a1 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -2212,11 +2212,6 @@ void SdTiledRenderingTest::testCutSelectionChange() // Selection is removed CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(0), m_aSelection.size()); - - utl::TempFile* pNewTempFile(new utl::TempFile); - FileFormat* pFormat = getFormat(ODP); - save(pXImpressDocument->GetDocShell(), pFormat, *pNewTempFile); - comphelper::LibreOfficeKit::setActive(false); } commit b7c7893e02b78947e34c7dd1015be6cad0f8d4cb Author: Tamás Zolnai <tamas.zol...@collabora.com> Date: Sat Feb 24 04:44:20 2018 +0100 sd lok: Delete selection highlight after cutting text. Call drawing also after the new selection is set, similar to other cases where DrawSelectionXOR() is called before and after selection change. In desktop LO drawing is always called again and again by timeout, so there the selection is updated anyway, while in LO online painting does not emit a notification. Reviewed-on: https://gerrit.libreoffice.org/50268 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 56629f9797fa1cf8b7c86b93ee2ea62673444c94) Change-Id: I6e9337fc0cfb61656387ba44d901521c3dfa60dd diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 6a89f6f360f0..884f6e99327b 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -1469,6 +1469,9 @@ void ImpEditView::DeleteSelected() pEditEngine->pImpEditEngine->UndoActionEnd(); SetEditSelection( EditSelection( aPaM, aPaM ) ); + + DrawSelectionXOR(); + pEditEngine->pImpEditEngine->FormatAndUpdate( GetEditViewPtr() ); ShowCursor( DoAutoScroll(), true ); } diff --git a/sd/qa/unit/tiledrendering/data/cut_selection_change.odp b/sd/qa/unit/tiledrendering/data/cut_selection_change.odp new file mode 100644 index 000000000000..19d3a18480e2 Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/cut_selection_change.odp differ diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index b97caf538a7d..7ce798600084 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -114,6 +114,7 @@ public: void testTdf115873Group(); void testIMESupport(); void testPasteTextOnSlide(); + void testCutSelectionChange(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -159,6 +160,7 @@ public: CPPUNIT_TEST(testTdf115873Group); CPPUNIT_TEST(testIMESupport); CPPUNIT_TEST(testPasteTextOnSlide); + CPPUNIT_TEST(testCutSelectionChange); CPPUNIT_TEST_SUITE_END(); @@ -2173,6 +2175,51 @@ void SdTiledRenderingTest::testPasteTextOnSlide() comphelper::LibreOfficeKit::setActive(false); } +void SdTiledRenderingTest::testCutSelectionChange() +{ + // Load the document. + comphelper::LibreOfficeKit::setActive(); + SdXImpressDocument* pXImpressDocument = createDoc("cut_selection_change.odp"); + CPPUNIT_ASSERT(pXImpressDocument); + + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback, this); + Scheduler::ProcessEventsToIdle(); + + // Select first text object + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); + Scheduler::ProcessEventsToIdle(); + + // step into text editing + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, '1', 0); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, '1', 0); + Scheduler::ProcessEventsToIdle(); + + // select some text + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT | KEY_SHIFT); + Scheduler::ProcessEventsToIdle(); + + // Check that we have a selection before cutting + CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(1), m_aSelection.size()); + + // Cut the selected text + comphelper::dispatchCommand(".uno:Cut", uno::Sequence<beans::PropertyValue>()); + Scheduler::ProcessEventsToIdle(); + + // Selection is removed + CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(0), m_aSelection.size()); + + utl::TempFile* pNewTempFile(new utl::TempFile); + FileFormat* pFormat = getFormat(ODP); + save(pXImpressDocument->GetDocShell(), pFormat, *pNewTempFile); + + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); commit 718f05f5810eea75599f532bbc659eada8e52085 Author: Pranav Kant <pran...@collabora.co.uk> Date: Wed Feb 21 13:10:00 2018 +0530 lokdialog: Allow Execute()ing first, silently cancels others We want to be able to detect which dialogs are important and need to be converted to async while not completely disallowing them. Allow only first instance of such dialogs being Execute()d and warn when another such instance tries to Execute(). Change-Id: I6742784fa95d9e3f9ff87ece294126d390ae9e9e Reviewed-on: https://gerrit.libreoffice.org/50092 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: pranavk <pran...@collabora.co.uk> (cherry picked from commit 391660de4125da06775f7d94ef352da3926c115f) diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index 979c62c199dc..c2c7c2fe9870 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -48,6 +48,7 @@ private: std::unique_ptr<DialogImpl> mpDialogImpl; long mnMousePositioned; bool mbInExecute; + bool mbInSyncExecute; bool mbInClose; bool mbModalMode; bool mbPaintComplete; @@ -127,6 +128,8 @@ public: virtual short Execute(); bool IsInExecute() const { return mbInExecute; } + // Return true when dialog is synchronously executed (calling ::Execute()) + bool IsInSyncExecute() const { return mbInSyncExecute; }; virtual FactoryFunction GetUITestFactory() const override; diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 0219f2a806d2..797bf124144c 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/util/thePathSettings.hpp> #include <com/sun/star/frame/theGlobalEventBroadcaster.hpp> #include <comphelper/lok.hxx> +#include <comphelper/scopeguard.hxx> #include <comphelper/processfactory.hxx> #include <officecfg/Office/Common.hxx> #include <osl/file.hxx> @@ -813,13 +814,26 @@ bool Dialog::ImplStartExecuteModal() return false; } + ImplSVData* pSVData = ImplGetSVData(); + switch ( Application::GetDialogCancelMode() ) { case Application::DialogCancelMode::Off: break; case Application::DialogCancelMode::Silent: if (GetLOKNotifier()) - break; + { + // check if there's already some dialog being ::Execute()d + const bool bDialogExecuting = std::any_of(pSVData->maWinData.mpExecuteDialogs.begin(), + pSVData->maWinData.mpExecuteDialogs.end(), + [](const Dialog* pDialog) { + return pDialog->IsInSyncExecute(); + }); + if (!(bDialogExecuting && IsInSyncExecute())) + break; + else + SAL_WARN("lok.dialog", "Dialog \"" << ImplGetDialogText(this) << "\" is being synchronously executed over an existing synchronously executing dialog."); + } SAL_INFO( "vcl", @@ -846,9 +860,7 @@ bool Dialog::ImplStartExecuteModal() } #endif - ImplSVData* pSVData = ImplGetSVData(); - - // link all dialogs which are being executed + // link all dialogs which are being executed pSVData->maWinData.mpExecuteDialogs.push_back(this); // stop capturing, in order to have control over the dialog @@ -960,6 +972,11 @@ short Dialog::Execute() #if HAVE_FEATURE_DESKTOP VclPtr<vcl::Window> xWindow = this; + mbInSyncExecute = true; + comphelper::ScopeGuard aGuard([&]() { + mbInSyncExecute = false; + }); + if ( !ImplStartExecuteModal() ) return 0; @@ -969,7 +986,6 @@ short Dialog::Execute() Application::Yield(); ImplEndExecuteModal(); - #ifdef DBG_UTIL assert (!mpDialogParent || !mpDialogParent->IsDisposed()); #endif commit 2de36b5cedf790fd5198b8f7c4dfdb3bf67d4f0e Author: Pranav Kant <pran...@collabora.co.uk> Date: Tue Feb 20 21:39:15 2018 +0530 lok: Factor out the code for finding vcl::Window of a document This should also help with IME input on charts Change-Id: Ie513790a5d0c87397c39301a328a44b59d394a45 Reviewed-on: https://gerrit.libreoffice.org/50091 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: pranavk <pran...@collabora.co.uk> (cherry picked from commit 190a44fe052f034368e254d263fca21fc000d6ce) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index dc73373748f3..bcda9a59c040 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -552,10 +552,19 @@ OUString ScModelObj::getPartHash( int nPart ) VclPtr<vcl::Window> ScModelObj::getDocWindow() { SolarMutexGuard aGuard; + + // There seems to be no clear way of getting the grid window for this + // particular document, hence we need to hope we get the right window. ScViewData* pViewData = ScDocShell::GetViewData(); VclPtr<vcl::Window> pWindow; if (pViewData) pWindow = pViewData->GetActiveWin(); + + LokChartHelper aChartHelper(pViewData->GetViewShell()); + vcl::Window* pChartWindow = aChartHelper.GetWindow(); + if (pChartWindow) + pWindow = pChartWindow; + return pWindow; } @@ -597,24 +606,11 @@ void ScModelObj::postKeyEvent(int nType, int nCharCode, int nKeyCode) { SolarMutexGuard aGuard; - // There seems to be no clear way of getting the grid window for this - // particular document, hence we need to hope we get the right window. - ScViewData* pViewData = ScDocShell::GetViewData(); - vcl::Window* pWindow = pViewData->GetActiveWin(); - + VclPtr<vcl::Window> pWindow = getDocWindow(); if (!pWindow) return; KeyEvent aEvent(nCharCode, nKeyCode, 0); - - ScTabViewShell * pTabViewShell = pViewData->GetViewShell(); - LokChartHelper aChartHelper(pTabViewShell); - vcl::Window* pChartWindow = aChartHelper.GetWindow(); - if (pChartWindow) - { - pWindow = pChartWindow; - } - switch (nType) { case LOK_KEYEVENT_KEYINPUT: diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index af019e5ffdff..339fe46449d9 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2344,6 +2344,12 @@ VclPtr<vcl::Window> SdXImpressDocument::getDocWindow() VclPtr<vcl::Window> pWindow; if (pViewShell) pWindow = pViewShell->GetActiveWindow(); + + LokChartHelper aChartHelper(pViewShell->GetViewShell()); + VclPtr<vcl::Window> pChartWindow = aChartHelper.GetWindow(); + if (pChartWindow) + pWindow = pChartWindow; + return pWindow; } @@ -2466,23 +2472,11 @@ void SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) { SolarMutexGuard aGuard; - DrawViewShell* pViewShell = GetViewShell(); - if (!pViewShell) - return; - - vcl::Window* pWindow = pViewShell->GetActiveWindow(); + VclPtr<vcl::Window> pWindow = getDocWindow(); if (!pWindow) return; - LokChartHelper aChartHelper(pViewShell->GetViewShell()); - vcl::Window* pChartWindow = aChartHelper.GetWindow(); - if (pChartWindow) - { - pWindow = pChartWindow; - } - KeyEvent aEvent(nCharCode, nKeyCode, 0); - switch (nType) { case LOK_KEYEVENT_KEYINPUT: diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 67b98a76237d..c8a9b7ec7092 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3404,6 +3404,12 @@ VclPtr<vcl::Window> SwXTextDocument::getDocWindow() SwView* pView = pDocShell->GetView(); if (pView) pWindow = &(pView->GetEditWin()); + + LokChartHelper aChartHelper(pView); + VclPtr<vcl::Window> pChartWindow = aChartHelper.GetWindow(); + if (pChartWindow) + pWindow = pChartWindow; + return pWindow; } @@ -3477,18 +3483,11 @@ void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) { SolarMutexGuard aGuard; - vcl::Window* pWindow = &(pDocShell->GetView()->GetEditWin()); - - SfxViewShell* pViewShell = pDocShell->GetView(); - LokChartHelper aChartHelper(pViewShell); - vcl::Window* pChartWindow = aChartHelper.GetWindow(); - if (pChartWindow) - { - pWindow = pChartWindow; - } + VclPtr<vcl::Window> pWindow = getDocWindow(); + if (!pWindow) + return; KeyEvent aEvent(nCharCode, nKeyCode, 0); - switch (nType) { case LOK_KEYEVENT_KEYINPUT: commit 3cc59cfae1cf8701ec7a5e7d85fc7a3645f55d96 Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Wed Feb 21 11:25:16 2018 +0300 tdf#115938: Properly detect shadow size control's changed state This change makes sure that only if the shadow size edit box' text is changed, it is converted to the size in twips. It sets wrapper's default value on each SetControlValue, to return proper initial size when the size text wasn't modified. Also both ExampleSet and OutSet in SfxTabDialog's Reset handler are processed to set relevant items back to initial value; otherwise, as the restored item (marked as unchanged) will be absent in tab's result set, it would not modify the old items in the two, and they would keep previous modified values. Change-Id: Ie4362811968c6e6cbe0f9229bd3c9b29462f5704 Reviewed-on: https://gerrit.libreoffice.org/50196 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit b37a46fdf91dbc66f6ddc1c070aec70716d94a01) diff --git a/cui/source/tabpages/borderconn.cxx b/cui/source/tabpages/borderconn.cxx index 90b6b2f1b41e..7b49f35022f1 100644 --- a/cui/source/tabpages/borderconn.cxx +++ b/cui/source/tabpages/borderconn.cxx @@ -230,7 +230,10 @@ SvxShadowItem ShadowControlsWrapper::GetControlValue() const SvxShadowItem aItem( GetDefaultValue() ); if( !maPosWrp.IsControlDontKnow() ) aItem.SetLocation( maPosWrp.GetControlValue() ); - if( !maSizeWrp.IsControlDontKnow() ) + // Default value was saved; so don't change the aItem's width if the control + // has not changed its value, to avoid round-trip errors (like twip->cm->twip) + // E.g., initial 100 twip will become 0.18 cm, which will return as 102 twip + if( !maSizeWrp.IsControlDontKnow() && maSizeWrp.IsControlValueChanged() ) aItem.SetWidth( maSizeWrp.GetControlValue() ); if( !maColorWrp.IsControlDontKnow() ) aItem.SetColor( maColorWrp.GetControlValue() ); @@ -239,8 +242,10 @@ SvxShadowItem ShadowControlsWrapper::GetControlValue() const void ShadowControlsWrapper::SetControlValue( SvxShadowItem aItem ) { + SetDefaultValue(aItem); maPosWrp.SetControlValue( aItem.GetLocation() ); maSizeWrp.SetControlValue( aItem.GetWidth() ); + maSizeWrp.GetControl().SaveValue(); maColorWrp.SetControlValue( aItem.GetColor() ); } diff --git a/include/sfx2/controlwrapper.hxx b/include/sfx2/controlwrapper.hxx index 34740a48c02e..cccec3455691 100644 --- a/include/sfx2/controlwrapper.hxx +++ b/include/sfx2/controlwrapper.hxx @@ -259,6 +259,7 @@ public: virtual ValueT GetControlValue() const SAL_OVERRIDE; virtual void SetControlValue( ValueT nValue ) SAL_OVERRIDE; + bool IsControlValueChanged() const; private: FieldUnit meUnit; @@ -481,6 +482,12 @@ void MetricFieldWrapper< ValueT >::SetControlValue( ValueT nValue ) this->GetControl().SetValue( this->GetControl().Normalize( static_cast< sal_Int64 >( nValue ) ), meUnit ); } +template< typename ValueT > +bool MetricFieldWrapper< ValueT >::IsControlValueChanged() const +{ + return this->GetControl().IsValueChangedFromSaved(); +} + template< typename ValueT > ValueT ListBoxWrapper< ValueT >::GetControlValue() const diff --git a/include/sfx2/itemconnect.hxx b/include/sfx2/itemconnect.hxx index f64fa2deff2b..597240b46549 100644 --- a/include/sfx2/itemconnect.hxx +++ b/include/sfx2/itemconnect.hxx @@ -243,6 +243,7 @@ protected: ItemWrapperType maItemWrp; std::unique_ptr<ControlWrpT> mxCtrlWrp; + bool mbModified; }; @@ -393,7 +394,8 @@ ItemControlConnection< ItemWrpT, ControlWrpT >::ItemControlConnection( sal_uInt16 nSlot, ControlWrpT* pNewCtrlWrp, ItemConnFlags nFlags ) : ItemConnectionBase( nFlags ), maItemWrp( nSlot ), - mxCtrlWrp( pNewCtrlWrp ) + mxCtrlWrp( pNewCtrlWrp ), + mbModified( false ) { } @@ -402,7 +404,8 @@ ItemControlConnection< ItemWrpT, ControlWrpT >::ItemControlConnection( sal_uInt16 nSlot, ControlType& rControl, ItemConnFlags nFlags ) : ItemConnectionBase( nFlags ), maItemWrp( nSlot ), - mxCtrlWrp( new ControlWrpT( rControl ) ) + mxCtrlWrp( new ControlWrpT( rControl ) ), + mbModified( false ) { } @@ -425,6 +428,7 @@ void ItemControlConnection< ItemWrpT, ControlWrpT >::Reset( const SfxItemSet* pI mxCtrlWrp->SetControlDontKnow( pItem == nullptr ); if( pItem ) mxCtrlWrp->SetControlValue( maItemWrp.GetItemValue( *pItem ) ); + mbModified = false; } template< typename ItemWrpT, typename ControlWrpT > @@ -432,7 +436,6 @@ bool ItemControlConnection< ItemWrpT, ControlWrpT >::FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ) { const ItemType* pOldItem = maItemWrp.GetUniqueItem( rOldSet ); - bool bChanged = false; if( !mxCtrlWrp->IsControlDontKnow() ) { // first store the control value in a local variable @@ -440,7 +443,7 @@ bool ItemControlConnection< ItemWrpT, ControlWrpT >::FillItemSet( // convert to item value type -> possible to convert i.e. from 'T' to 'const T&' ItemValueType aNewValue( aCtrlValue ); // do not rely on existence of ItemValueType::operator!= - if( !pOldItem || !(maItemWrp.GetItemValue( *pOldItem ) == aNewValue) ) + if( mbModified || !pOldItem || !(maItemWrp.GetItemValue( *pOldItem ) == aNewValue) ) { sal_uInt16 nWhich = ItemWrapperHelper::GetWhichId( rDestSet, maItemWrp.GetSlotId() ); std::unique_ptr< ItemType > xItem( @@ -448,12 +451,12 @@ bool ItemControlConnection< ItemWrpT, ControlWrpT >::FillItemSet( xItem->SetWhich( nWhich ); maItemWrp.SetItemValue( *xItem, aNewValue ); rDestSet.Put( *xItem ); - bChanged = true; + mbModified = true; } } - if( !bChanged ) + if( !mbModified ) ItemWrapperHelper::RemoveDefaultItem( rDestSet, rOldSet, maItemWrp.GetSlotId() ); - return bChanged; + return mbModified; } diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 5dc6a5bee5b4..5ca195ed887f 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -965,6 +965,50 @@ IMPL_LINK_NOARG(SfxTabDialog, ResetHdl, Button*, void) DBG_ASSERT( pDataObject, "Id not known" ); pDataObject->pTabPage->Reset( m_pSet ); + // Also reset relevant items of ExampleSet and OutSet to initial state + if (pDataObject->fnGetRanges) + { + if (!m_pExampleSet) + m_pExampleSet = new SfxItemSet(*m_pSet); + + const SfxItemPool* pPool = m_pSet->GetPool(); + const sal_uInt16* pTmpRanges = (pDataObject->fnGetRanges)(); + + while (*pTmpRanges) + { + const sal_uInt16* pU = pTmpRanges + 1; + + // Correct Range with multiple values + sal_uInt16 nTmp = *pTmpRanges, nTmpEnd = *pU; + DBG_ASSERT(nTmp <= nTmpEnd, "Range is sorted the wrong way"); + + if (nTmp > nTmpEnd) + { + // If really sorted wrongly, then set new + std::swap(nTmp, nTmpEnd); + } + + while (nTmp && nTmp <= nTmpEnd) + { + // Iterate over the Range and set the Items + sal_uInt16 nWh = pPool->GetWhich(nTmp); + const SfxPoolItem* pItem; + if (SfxItemState::SET == m_pSet->GetItemState(nWh, false, &pItem)) + { + m_pExampleSet->Put(*pItem); + m_pOutSet->Put(*pItem); + } + else + { + m_pExampleSet->ClearItem(nWh); + m_pOutSet->ClearItem(nWh); + } + nTmp++; + } + // Go to the next pair + pTmpRanges += 2; + } + } } commit 9af3a946d23ba4906de7be69f0e1496e84f49390 Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Wed Feb 21 21:45:35 2018 +0100 Simplify conditions a little Change-Id: Iaa587f1a2d78f14b999f2e9e866db058d466493f Reviewed-on: https://gerrit.libreoffice.org/50137 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 06f04bf84d48d6542d9b47d1e16228923de61302) diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index f6dc0b2fce1a..5dc6a5bee5b4 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -778,10 +778,10 @@ short SfxTabDialog::Ok() if ( !m_pOutSet ) { - if ( !m_pExampleSet && m_pSet ) - m_pOutSet = m_pSet->Clone( false ); // without Items - else if ( m_pExampleSet ) + if ( m_pExampleSet ) m_pOutSet = new SfxItemSet( *m_pExampleSet ); + else if ( m_pSet ) + m_pOutSet = m_pSet->Clone( false ); // without Items } bool bModified = false; commit 552c20346f254646dc0f7405f336590f4901f2b1 Author: Tor Lillqvist <t...@collabora.com> Date: Thu Feb 22 16:52:56 2018 +0200 Bin unused function Change-Id: I38e9f2e21fdb7cfeb379278e9300e6451c8b970d (cherry picked from commit 5ec76e598899a9939fa1f3bceab1caae5dfd1a67) diff --git a/avmedia/source/macavf/framegrabber.hxx b/avmedia/source/macavf/framegrabber.hxx index ee1ccaac1199..9d9d436b042a 100644 --- a/avmedia/source/macavf/framegrabber.hxx +++ b/avmedia/source/macavf/framegrabber.hxx @@ -35,7 +35,6 @@ public: explicit FrameGrabber( const css::uno::Reference< css::lang::XMultiServiceFactory >& ); virtual ~FrameGrabber() override; - bool create( const ::rtl::OUString& rURL ); bool create( AVAsset* pMovie ); // XFrameGrabber diff --git a/avmedia/source/macavf/framegrabber.mm b/avmedia/source/macavf/framegrabber.mm index 2293a05ba03a..07bf7000bbcb 100644 --- a/avmedia/source/macavf/framegrabber.mm +++ b/avmedia/source/macavf/framegrabber.mm @@ -41,24 +41,6 @@ FrameGrabber::~FrameGrabber() } -bool FrameGrabber::create( const ::rtl::OUString& rURL ) -{ - NSString* pNSStr = [NSString stringWithCharacters:reinterpret_cast<unichar const *>(rURL.getStr()) length:rURL.getLength()]; - SAL_WNODEPRECATED_DECLARATIONS_PUSH - //TODO: 10.11 stringByAddingPercentEscapesUsingEncoding - NSURL* pNSURL = [NSURL URLWithString: [pNSStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; - SAL_WNODEPRECATED_DECLARATIONS_POP - AVAsset* pMovie = [AVURLAsset URLAssetWithURL:pNSURL options:nil]; - if( !pMovie ) - { - SAL_WARN("avmedia", "AVGrabber::create() cannot load url=" << [pNSStr UTF8String] ); - return false; - } - - return create( pMovie ); -} - - bool FrameGrabber::create( AVAsset* pMovie ) { if( [[pMovie tracksWithMediaType:AVMediaTypeVideo] count] == 0) commit 22d4bfbbc1a4bf1ef2969b55a765c2e774ff0b9f Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Thu Feb 22 11:45:24 2018 +0100 Remove useless special handling of single-value ranges ... as they are treated by generic code just fine. A check added to guard against overflow (0xFFFF + 1 -> 0). Change-Id: Ibef85191eab82002981e12f83f313f3d122da74c Reviewed-on: https://gerrit.libreoffice.org/50163 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit d4b4f5f1f4e452cb9f4a0e202b57c0a8610c1cad) diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 9fe10f844c14..f6dc0b2fce1a 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -997,41 +997,26 @@ IMPL_LINK_NOARG(SfxTabDialog, BaseFmtHdl, Button*, void) { const sal_uInt16* pU = pTmpRanges + 1; - if ( *pTmpRanges == *pU ) + // Correct Range with multiple values + sal_uInt16 nTmp = *pTmpRanges, nTmpEnd = *pU; + DBG_ASSERT( nTmp <= nTmpEnd, "Range is sorted the wrong way" ); + + if ( nTmp > nTmpEnd ) + { + // If really sorted wrongly, then set new + std::swap(nTmp, nTmpEnd); + } + + while ( nTmp && nTmp <= nTmpEnd ) // guard against overflow { - // Range which two identical values -> only set one Item - sal_uInt16 nWh = pPool->GetWhich( *pTmpRanges ); + // Iterate over the Range and set the Items + sal_uInt16 nWh = pPool->GetWhich( nTmp ); m_pExampleSet->ClearItem( nWh ); aTmpSet.ClearItem( nWh ); // At the Outset of InvalidateItem, // so that the change takes effect m_pOutSet->InvalidateItem( nWh ); - } - else - { - // Correct Range with multiple values - sal_uInt16 nTmp = *pTmpRanges, nTmpEnd = *pU; - DBG_ASSERT( nTmp <= nTmpEnd, "Range is sorted the wrong way" ); - - if ( nTmp > nTmpEnd ) - { - // If really sorted wrongly, then set new - sal_uInt16 nTmp1 = nTmp; - nTmp = nTmpEnd; - nTmpEnd = nTmp1; - } - - while ( nTmp <= nTmpEnd ) - { - // Iterate over the Range and set the Items - sal_uInt16 nWh = pPool->GetWhich( nTmp ); - m_pExampleSet->ClearItem( nWh ); - aTmpSet.ClearItem( nWh ); - // At the Outset of InvalidateItem, - // so that the change takes effect - m_pOutSet->InvalidateItem( nWh ); - nTmp++; - } + nTmp++; } // Go to the next pair pTmpRanges += 2; commit ff38d125aee0a7f121c9f20ecde63a9270516088 Author: Tamás Zolnai <tamas.zol...@collabora.com> Date: Wed Feb 21 17:47:59 2018 +0100 Add some extra assert to this test case To find out why this test fails for some linux tinderbox. Change-Id: I49d1afbbac631abe49378b12b888615e3e0e1bef Reviewed-on: https://gerrit.libreoffice.org/50121 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 0a46237093c1750ee69ddb6a365098dc1d06b758) diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 29f70764c3e7..b97caf538a7d 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -2113,9 +2113,7 @@ void SdTiledRenderingTest::testPasteTextOnSlide() // Load the document. comphelper::LibreOfficeKit::setActive(); SdXImpressDocument* pXImpressDocument = createDoc("paste_text_onslide.odp"); - - ViewCallback aView1; - SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1); + CPPUNIT_ASSERT(pXImpressDocument); // select second text object pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); @@ -2161,7 +2159,10 @@ void SdTiledRenderingTest::testPasteTextOnSlide() Scheduler::ProcessEventsToIdle(); // Check the position of the newly added text shape, created for pasted text - SdrObject* pObject = pXImpressDocument->GetDocShell()->GetViewShell()->GetActualPage()->GetObj(2); + SdPage* pActualPage = pXImpressDocument->GetDocShell()->GetViewShell()->GetActualPage(); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pActualPage->GetObjCount()); + SdrObject* pObject = pActualPage->GetObj(2); + CPPUNIT_ASSERT(pObject); SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObject); CPPUNIT_ASSERT(pTextObj); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_TEXT), pTextObj->GetObjIdentifier()); commit 2f9b2c32b9e497989026d4bbc4b35f82b279c08d Author: Tor Lillqvist <t...@collabora.com> Date: Wed Feb 21 23:25:30 2018 +0200 Manually recognize some IIDs that don't have cleartext names in the Registry Change-Id: I9deadfdd324f9b9014fef8370593e107302ed843 (cherry picked from commit 515885f39e648b987cf40df64450803df26d4a29) diff --git a/include/comphelper/windowsdebugoutput.hxx b/include/comphelper/windowsdebugoutput.hxx index 28eaab810ff2..d4e3372d5bec 100644 --- a/include/comphelper/windowsdebugoutput.hxx +++ b/include/comphelper/windowsdebugoutput.hxx @@ -27,6 +27,11 @@ #else #include <windows.h> #endif +#include <initguid.h> + +namespace { +DEFINE_GUID(IID_IdentityUnmarshal, 0x0000001B, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); +} template <typename charT, typename traits> inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, @@ -70,6 +75,28 @@ inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, t << "\""; } } + else + { + // Special case well-known interfaces that pop up a lot, but which don't have their name in + // the Registry. + + if (IsEqualIID(rIid, IID_IMarshal)) + stream << "=\"IMarshal\""; + else if (IsEqualIID(rIid, IID_INoMarshal)) + stream << "=\"INoMarshal\""; + else if (IsEqualIID(rIid, IID_IdentityUnmarshal)) + stream << "=\"IdentityUnmarshal\""; + else if (IsEqualIID(rIid, IID_IFastRundown)) + stream << "=\"IdentityUnmarshal\""; + else if (IsEqualIID(rIid, IID_IStdMarshalInfo)) + stream << "=\"IStdMarshalInfo\""; + else if (IsEqualIID(rIid, IID_IAgileObject)) + stream << "=\"IAgileObject\""; + else if (IsEqualIID(rIid, IID_IExternalConnection)) + stream << "=\"IExternalConnection\""; + else if (IsEqualIID(rIid, IID_ICallFactory)) + stream << "=\"ICallFactory\""; + } CoTaskMemFree(pRiid); return stream; commit c146a8da643979c2d0e16c1e35a924e4748db88f Author: Pranav Kant <pran...@collabora.co.uk> Date: Tue Feb 20 15:41:35 2018 +0530 Bin useless code Change-Id: Id3ffa2333946a9551da9d0f9ecbd2885716b9376 Reviewed-on: https://gerrit.libreoffice.org/50102 Reviewed-by: pranavk <pran...@collabora.co.uk> Tested-by: pranavk <pran...@collabora.co.uk> (cherry picked from commit ddbb78caa78085673b07dbea6f53288ec6237764) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index cebc4e56f2cc..ed14e2bce562 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2098,8 +2098,6 @@ void Window::PostExtTextInputEvent(VclEventId nType, const OUString& rText) } SalExtTextInputEvent aEvent { rText, pAttr.get(), rText.getLength(), EXTTEXTINPUT_CURSOR_OVERWRITE }; ImplWindowFrameProc(this, SalEvent::ExtTextInput, &aEvent); - SalExtTextInputPosEvent evt; - ImplWindowFrameProc(this, SalEvent::ExtTextInputPos, &evt); } break; case VclEventId::EndExtTextInput: commit 2e62bed6cc29fa28cfa9f0d7dfaf8ece61c08061 Author: Tor Lillqvist <t...@collabora.com> Date: Thu Feb 8 21:57:22 2018 +0200 Pass missing (hopefully optional) parameters as Any() Change-Id: I93e69e589cd81fbc9606b1b08233da7fb8f5d043 Reviewed-on: https://gerrit.libreoffice.org/50089 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tor Lillqvist <t...@collabora.com> (cherry picked from commit 3cd3d1044d03fdb733922bad74254f3ad65d898e) diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 604c74577e72..04cdc890d72d 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -813,6 +813,17 @@ STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember, convertDispparamsArgs(dispidMember, wFlags, pdispparams , params ); + // Pass missing (hopefully optional) parameters as Any(). + InvocationInfo aInvocationInfo; + getInvocationInfoForCall(dispidMember, aInvocationInfo); + if (pdispparams->cArgs < (UINT)aInvocationInfo.aParamTypes.getLength()) + { + params.realloc(aInvocationInfo.aParamTypes.getLength()); + Any* pParams = params.getArray(); + for (int i = pdispparams->cArgs; i < aInvocationInfo.aParamTypes.getLength(); ++i) + pParams[i] = Any(); + } + ret= doInvoke(pdispparams, pvarResult, pexcepinfo, puArgErr, d.name, params); } commit ac774a96399228dc869b50f9f938aebb8b476313 Author: Tamás Zolnai <tamas.zol...@collabora.com> Date: Wed Feb 21 03:07:33 2018 +0100 sd lok: Fix pasting text on slide Use the same solution as for images in this commit: 9fee132c18b658c9ea9fb1114c1fefa56b57532a Place the inserted text shape to the center of the slide for LOK, because we don't get correct window size here. Reviewed-on: https://gerrit.libreoffice.org/50074 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit e86fb2edfdca48b92b11c149002ab2b06a630b94) Change-Id: Ie0c3717d22da6b6a988ab8d566bd9759e03f86c8 diff --git a/sd/qa/unit/tiledrendering/data/paste_text_onslide.odp b/sd/qa/unit/tiledrendering/data/paste_text_onslide.odp new file mode 100644 index 000000000000..c33b7c110229 Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/paste_text_onslide.odp differ diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 2f2db0b8c1f7..29f70764c3e7 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -113,6 +113,7 @@ public: void testTdf115873(); void testTdf115873Group(); void testIMESupport(); + void testPasteTextOnSlide(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -157,6 +158,7 @@ public: CPPUNIT_TEST(testTdf115873); CPPUNIT_TEST(testTdf115873Group); CPPUNIT_TEST(testIMESupport); + CPPUNIT_TEST(testPasteTextOnSlide); CPPUNIT_TEST_SUITE_END(); @@ -2106,6 +2108,70 @@ void SdTiledRenderingTest::testIMESupport() comphelper::LibreOfficeKit::setActive(false); } +void SdTiledRenderingTest::testPasteTextOnSlide() +{ + // Load the document. + comphelper::LibreOfficeKit::setActive(); + SdXImpressDocument* pXImpressDocument = createDoc("paste_text_onslide.odp"); + + ViewCallback aView1; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1); + + // select second text object + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); + Scheduler::ProcessEventsToIdle(); + + // step into text editing + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, '1', 0); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, '1', 0); + Scheduler::ProcessEventsToIdle(); + + // select full text + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT | KEY_SHIFT); + Scheduler::ProcessEventsToIdle(); + + // Copy some text + comphelper::dispatchCommand(".uno:Copy", uno::Sequence<beans::PropertyValue>()); + Scheduler::ProcessEventsToIdle(); + + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::ESCAPE); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::ESCAPE); + Scheduler::ProcessEventsToIdle(); + + // Paste onto the slide + comphelper::dispatchCommand(".uno:Paste", uno::Sequence<beans::PropertyValue>()); + Scheduler::ProcessEventsToIdle(); + + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::ESCAPE); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::ESCAPE); + Scheduler::ProcessEventsToIdle(); + + // Check the position of the newly added text shape, created for pasted text + SdrObject* pObject = pXImpressDocument->GetDocShell()->GetViewShell()->GetActualPage()->GetObj(2); + SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObject); + CPPUNIT_ASSERT(pTextObj); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_TEXT), pTextObj->GetObjIdentifier()); + Point aPos = pTextObj->GetLastBoundRect().TopLeft(); + CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<long>(12990), aPos.getX(), 100); + CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<long>(7393), aPos.getY(), 100); + + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 4df02ee52385..7a042c44623a 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -62,6 +62,7 @@ #include <drawview.hxx> #include <helpids.h> #include <vcl/svapp.hxx> +#include <comphelper/lok.hxx> #include <slideshow.hxx> #include <memory> @@ -318,7 +319,12 @@ void View::DoPaste (vcl::Window const * pWindow) sal_Int8 nDnDAction = DND_ACTION_COPY; if( pWindow ) - aPos = pWindow->PixelToLogic( ::tools::Rectangle( aPos, pWindow->GetOutputSizePixel() ).Center() ); + { + if (comphelper::LibreOfficeKit::isActive()) + aPos = ::tools::Rectangle(aPos, GetSdrPageView()->GetPage()->GetSize()).Center(); + else + aPos = pWindow->PixelToLogic( ::tools::Rectangle( aPos, pWindow->GetOutputSizePixel() ).Center() ); + } DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>( mpDocSh->GetViewShell() ); commit 0b22df98f2e8b139dea6b42c98db0d54ce2b4a28 Author: Andras Timar <andras.ti...@collabora.com> Date: Tue Feb 20 23:21:34 2018 +0100 lok: support of AutoCorrect -> While Typing menu in Writer Change-Id: I7c07f3a6269cd4b92cc50f7aaf847faf04665029 Reviewed-on: https://gerrit.libreoffice.org/50068 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit e73cba0cea07eedee5507535f585e89e42ea0124) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index dd538d127f96..c87172a2a27a 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1771,7 +1771,8 @@ static void doc_iniUnoCommands () OUString(".uno:DocumentRepair"), OUString(".uno:TransformDialog"), OUString(".uno:InsertPageHeader"), - OUString(".uno:InsertPageFooter") + OUString(".uno:InsertPageFooter"), + OUString(".uno:OnlineAutoFormat") }; util::URL aCommandURL; diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 31c5bd9c702f..b831af5521d2 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1007,6 +1007,7 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c aEvent.FeatureURL.Path == "RightPara" || aEvent.FeatureURL.Path == "Shadowed" || aEvent.FeatureURL.Path == "SpellOnline" || + aEvent.FeatureURL.Path == "OnlineAutoFormat" || aEvent.FeatureURL.Path == "SubScript" || aEvent.FeatureURL.Path == "SuperScript" || aEvent.FeatureURL.Path == "Strikeout" || _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits