core.git: Branch 'distro/collabora/co-24.04' - sw/source
sw/source/uibase/shells/textsh1.cxx | 122 1 file changed, 111 insertions(+), 11 deletions(-) New commits: commit d679849aca883c1a42d3bcee61b3bee5e3bbc6dc Author: Attila Szűcs AuthorDate: Fri Sep 20 06:37:10 2024 +0200 Commit: Caolán McNamara CommitDate: Fri Sep 20 16:46:23 2024 +0200 SW: Transform DocStruct: Added Log warnings Implemented warning loggings in case of transform charts or content controls. Change-Id: I77398ca5bf04f05743c99d63380a402c394739ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173689 Reviewed-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 4d767b5da8a3..1b86d294021f 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -807,6 +807,11 @@ void DeleteFields(SfxRequest& rReq, SwWrtShell& rWrtSh) } } +void lcl_LogWarning(std::string sWarning) +{ +std::cerr << "Warning: " << sWarning << " "; +} + bool lcl_ChangeChartColumnCount(const uno::Reference& xChartDoc, sal_Int32 nId, bool bInsert, bool bResize = false) { @@ -2289,8 +2294,15 @@ void SwTextShell::Execute(SfxRequest &rReq) boost::property_tree::ptree aTree; std::stringstream aStream( (std::string(OUStringToOString(aDataJson, RTL_TEXTENCODING_UTF8; -boost::property_tree::read_json(aStream, aTree); -// Todo: try catch - in case of fail: log wrong JSON format +try +{ +boost::property_tree::read_json(aStream, aTree); +} +catch (...) +{ +lcl_LogWarning("FillApi Transform parameter, Wrong JSON format. "); +throw; +} // get the loaded content controls uno::Reference xCCSupplier( @@ -2360,6 +2372,10 @@ void SwTextShell::Execute(SfxRequest &rReq) } if (iKeyId != ChartFilterType::ERROR) { +// A chart transformation filter can match multiple charts +// In that case every matching charts will be transformed +// If no chart match to the filter, then we show warning +bool bChartFound = false; for (int i = 0; i < nEOcount; ++i) { uno::Reference xShapeProps( @@ -2475,6 +2491,7 @@ void SwTextShell::Execute(SfxRequest &rReq) // We have a match, this chart need to be transformed // Set all the values (of the chart) what is needed +bChartFound = true; // Check if the InternalDataProvider is row or column based. bool bChartUseColumns = false; @@ -2549,6 +2566,7 @@ void SwTextShell::Execute(SfxRequest &rReq) int nIndex = 0; int nX = nId; int nY = nId; +bool bIndexWarning = false; for (const auto& aItem4 : aItem3.second) { if (bSetColumn) @@ -2566,9 +2584,30 @@ void SwTextShell::Execute(SfxRequest &rReq) pCols[nX] = aItem4.second.get_value(); } -// else log: set invalid cell: index [nY,Nx] +else +{ +bIndexWarning = true; +} + nIndex++; } +if (bIndexWarning) +{ +std::string sValues = ""; +for (const auto& atemp : aItem3.second) +{ +if (sValues != "") +
core.git: Branch 'distro/collabora/co-24.04' - chart2/Library_chartcontroller.mk chart2/Library_chartcore.mk chart2/source offapi/com solenv/clang-format sw/qa sw/source
chart2/Library_chartcontroller.mk |5 chart2/Library_chartcore.mk |5 chart2/source/controller/dialogs/DataBrowser.cxx |2 chart2/source/controller/dialogs/DataBrowserModel.cxx |2 chart2/source/controller/dialogs/DialogModel.hxx |2 chart2/source/controller/inc/dlg_CreationWizard.hxx |2 chart2/source/controller/inc/res_ErrorBar.hxx |2 chart2/source/inc/DataBrowserModel.hxx|6 chart2/source/inc/InternalDataProvider.hxx|8 chart2/source/inc/RangeSelectionHelper.hxx|4 chart2/source/inc/RangeSelectionListener.hxx |4 chart2/source/inc/TimerTriggeredControllerLock.hxx|4 chart2/source/model/main/ChartModel.cxx |3 chart2/source/tools/InternalDataProvider.cxx | 15 offapi/com/sun/star/chart2/XInternalDataProvider.idl |7 solenv/clang-format/excludelist |4 sw/qa/uibase/shells/data/docStructureChartExampleOriginal.odt |binary sw/qa/uibase/shells/shells.cxx| 196 +++ sw/source/uibase/shells/textsh1.cxx | 585 +- sw/source/uibase/uno/loktxdoc.cxx | 139 ++ 20 files changed, 974 insertions(+), 21 deletions(-) New commits: commit d9338fcf8f15a7e32a9de3e7249c925fd768ffc9 Author: Attila Szűcs AuthorDate: Thu Jul 25 06:21:35 2024 +0200 Commit: Caolán McNamara CommitDate: Thu Sep 12 22:14:04 2024 +0200 SW: extract transform charts (using dialog code) Implemented chart data extraction, and transformation added insert/delete/modify row/column, and the ability to set resize data table setcolumndesc / setrowdesc .. for 1 descriptor, or with multiple descriptor to set set 1 cell value, or set the whole table cells values. it will resize the table, but you can still use partial arrays like "data": [ [ 1,2,3,4 ], [ 2,3,4,5 ], [ 3 ], [ 4,5,6,7 ], [ 2,2,1 ], [ 5,6,7,8 ] ], that means the 3. row 2,3,4th cell will not be overwritten. for insert column, it call codes from DataBrowserModel. (used by dialog code) added tests, fixed a contentcontrol date problem 2. commit (made by Caolan) squashed into 1. commit: WIP hack this to link move stuff from chartcontroller to chartcore and adjust visibility until it links at least Change-Id: I5529f4da33f046eef7e947d755e29486fa966274 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172849 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk index ca50d52a1fd9..b2d05298c237 100644 --- a/chart2/Library_chartcontroller.mk +++ b/chart2/Library_chartcontroller.mk @@ -100,8 +100,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\ chart2/source/controller/dialogs/ChartResourceGroups \ chart2/source/controller/dialogs/ChartTypeDialogController \ chart2/source/controller/dialogs/DataBrowser \ -chart2/source/controller/dialogs/DataBrowserModel \ -chart2/source/controller/dialogs/DialogModel \ chart2/source/controller/dialogs/dlg_ChartType \ chart2/source/controller/dialogs/dlg_ChartType_UNO \ chart2/source/controller/dialogs/dlg_CreationWizard \ @@ -120,8 +118,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\ chart2/source/controller/dialogs/dlg_ShapeParagraph \ chart2/source/controller/dialogs/dlg_View3D \ chart2/source/controller/dialogs/ObjectNameProvider \ -chart2/source/controller/dialogs/RangeSelectionHelper \ -chart2/source/controller/dialogs/RangeSelectionListener \ chart2/source/controller/dialogs/res_BarGeometry \ chart2/source/controller/dialogs/res_DataLabel \ chart2/source/controller/dialogs/res_DataTableProperties \ @@ -130,7 +126,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\ chart2/source/controller/dialogs/res_Titles \ chart2/source/controller/dialogs/res_Trendline \ chart2/source/controller/dialogs/TextDirectionListBox \ -chart2/source/controller/dialogs/TimerTriggeredControllerLock \ chart2/source/controller/dialogs/TitleDialogData \ chart2/source/controller/dialogs/tp_3D_SceneAppearance \ chart2/source/controller/dialogs/tp_3D_SceneGeometry \ diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk index b61390ec42ea..ad204c1ef094 100644 --- a/chart2/Library_chartcore.mk +++ b/chart2/Library_chartcore.mk @@ -62,6 +62,11 @@ $(eval $(call gb_Library_set_com
core.git: sw/source
sw/source/uibase/shells/textsh1.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit c3159b941c329e707484e6202f2dd4a518ec7acf Author: Attila Szűcs AuthorDate: Mon Jul 15 17:52:50 2024 +0200 Commit: Miklos Vajna CommitDate: Wed Jul 31 15:44:16 2024 +0200 SW: fix EOL in transform Document Structure Changed the transform parameter to uri decoded string, and encode it here. This way special characters will survive the transfering. Change-Id: Ibfa890f98a35559992317ac1f01596b9ca24a07b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171276 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index db00f15f9216..139b56a08506 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -130,6 +130,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace com::sun::star::beans; @@ -2237,6 +2238,7 @@ void SwTextShell::Execute(SfxRequest &rReq) if (pDataJson) { aDataJson = pDataJson->GetValue(); +aDataJson = rtl::Uri::decode(aDataJson, rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8); } // parse the JSON got prom parameter
core.git: sw/qa sw/source
sw/qa/uitest/ui/misc/misc.py |9 + sw/source/uibase/wrtsh/wrtsh1.cxx | 27 +++ 2 files changed, 20 insertions(+), 16 deletions(-) New commits: commit 352e564dd1de09a04a2fb1f9b40780b305da7c80 Author: Attila Szűcs AuthorDate: Fri Jul 12 14:51:41 2024 +0200 Commit: Miklos Vajna CommitDate: Fri Jul 19 21:26:28 2024 +0200 SW: random ID for new content controls Make the generated unique ID random for new content controls. This way if we copy paste them from different documents, they may still be unique. Change-Id: I2adb6577e08b5798ae88a63b6178352aa76280d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170773 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/uitest/ui/misc/misc.py b/sw/qa/uitest/ui/misc/misc.py index 8af00054a5e6..94fd60bff16f 100644 --- a/sw/qa/uitest/ui/misc/misc.py +++ b/sw/qa/uitest/ui/misc/misc.py @@ -44,9 +44,10 @@ class TestTmpdlg(UITestCase): type_text(xTag, "new tag ") xAdd = xDialog.getChild("add") -xId = xDialog.getChild("idspinbutton") -self.assertEqual(get_state_as_dict(xId)['Text'], "0") -type_text(xId, "429496729") # added in front, making it 4294967290 +# Id is a random number now, not 0. +# xId = xDialog.getChild("idspinbutton") +# self.assertEqual(get_state_as_dict(xId)['Text'], "0") +# type_text(xId, "429496729") # added in front, making it 4294967290 xTabIndex = xDialog.getChild("tabindexspinbutton") self.assertEqual(get_state_as_dict(xTabIndex)['Text'], "1") @@ -67,7 +68,7 @@ class TestTmpdlg(UITestCase): self.assertEqual(listItems[1][1].Value, "foo-bar") self.assertEqual(contentControl.Alias, "new alias my alias") self.assertEqual(contentControl.Tag, "new tag my tag") -self.assertEqual(contentControl.Id, -6) # stored as signed, displays as unsigned +# self.assertEqual(contentControl.Id, -6) # stored as signed, displays as unsigned self.assertEqual(contentControl.TabIndex, 4294967295) # stored as unsigned, displays as signed diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 65d725c6872a..585203eed017 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -1076,25 +1077,27 @@ void SwWrtShell::InsertContentControl(SwContentControlType eType) auto pContentControl = std::make_shared(nullptr); -// Search for a non used ID for the new ContentControl, to make it unique +// Make Random ID.. cehcek if it is unique +// warning: possible infinite loop if there would be billions of content controls. SwContentControlManager& pManager = GetDoc()->GetContentControlManager(); size_t nCCCount = pManager.GetCount(); -std::vector aIdMap(nCCCount); -aIdMap.resize(nCCCount, false); -size_t nIdToCheck; -for (nIdToCheck = 0; nIdToCheck < nCCCount; nIdToCheck++) +sal_Int32 nIdToCheck; +nIdToCheck += comphelper::rng::uniform_uint_distribution(1, std::numeric_limits::max()); +size_t nIdx = 0; +while (nIdx < nCCCount) { sal_Int32 nID -= pManager.UnsortedGet(nIdToCheck)->GetContentControl().GetContentControl()->GetId(); -if (nID >= 0 && nID < static_cast(nCCCount)) += pManager.UnsortedGet(nIdx)->GetContentControl().GetContentControl()->GetId(); +if (nID == nIdToCheck) { -aIdMap[nID] = true; +nIdToCheck = comphelper::rng::uniform_uint_distribution( +1, std::numeric_limits::max()); +nIdx = 0; } +else +nIdx++; } -// Find the first ID that was not used -nIdToCheck = 0; -while (nIdToCheck < nCCCount && aIdMap[nIdToCheck]) -nIdToCheck++; pContentControl->SetId(nIdToCheck); OUString aPlaceholder;
core.git: Branch 'distro/collabora/co-24.04' - sw/source
sw/source/uibase/shells/textsh1.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 3dcf0f9008da3bcc6f7adabc60dd413852c59574 Author: Attila Szűcs AuthorDate: Wed Jul 17 10:56:41 2024 +0200 Commit: Caolán McNamara CommitDate: Wed Jul 17 17:23:22 2024 +0200 SW: fix warning ‘iType’ may be used uninitialized added default value: iType = 0; Change-Id: Ib8e3cde171736c4a7733107a403a64b7753339ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170613 Reviewed-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 14225b4cb745..ed93f3b14a0a 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -2281,7 +2281,7 @@ void SwTextShell::Execute(SfxRequest &rReq) xContentControlText->setString( OStringToOUString(aContent, RTL_TEXTENCODING_UTF8)); -sal_Int32 iType; +sal_Int32 iType = 0; xContentControlProps->getPropertyValue( UNO_NAME_CONTENT_CONTROL_TYPE) >>= iType;
core.git: desktop/source include/LibreOfficeKit sw/inc sw/source
desktop/source/lib/init.cxx | 17 ++- include/LibreOfficeKit/LibreOfficeKit.h |3 include/LibreOfficeKit/LibreOfficeKit.hxx|4 sw/inc/unoprnms.hxx |1 sw/source/core/unocore/unocontentcontrol.cxx | 13 +++ sw/source/uibase/shells/textsh1.cxx | 116 --- sw/source/uibase/uno/loktxdoc.cxx| 82 +++ sw/source/uibase/wrtsh/wrtsh1.cxx| 22 + 8 files changed, 221 insertions(+), 37 deletions(-) New commits: commit 84d63cfccf7af8f2b3b689ab0e622f8b408eb470 Author: Attila Szűcs AuthorDate: Thu Jul 11 11:24:28 2024 +0200 Commit: Miklos Vajna CommitDate: Wed Jul 17 10:52:38 2024 +0200 Sw: extract/transform document structure 2 inserting a ContentControl, now generate a unique ID for it... search the lowest possible non used (non negative) number added a GetType() function for SwXContentControl that get it from SwContentControl, and used it for extract and transform. Added some support for all other types.. some are not really usable yet. Fixed a problem when setting checkbox check, did not changed its content. If content is set to “”. It now set as placeholder, and reset its content to the initial placeholder value, like: “Choose an item” or “Click here to enter text” (work for checkbox, and picture CntentControl.) Change-Id: I0fc696f73734bdfb9ac5b8fdc6891168b8d4ed5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170600 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 2769c47bf9b0..48b771c9f7f3 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2588,7 +2588,8 @@ static void lo_setOption(LibreOfficeKit* pThis, const char* pOption, const char* static void lo_dumpState(LibreOfficeKit* pThis, const char* pOptions, char** pState); -static char* lo_extractDocumentStructureRequest(LibreOfficeKit* pThis, const char* pFilePath); +static char* lo_extractDocumentStructureRequest(LibreOfficeKit* pThis, const char* pFilePath, +const char* pFilter); LibLibreOffice_Impl::LibLibreOffice_Impl() : m_pOfficeClass( gOfficeClass.lock() ) @@ -3147,7 +3148,8 @@ static char* lo_extractRequest(LibreOfficeKit* /*pThis*/, const char* pFilePath) return strdup("{ }"); } -static char* lo_extractDocumentStructureRequest(LibreOfficeKit* /*pThis*/, const char* pFilePath) +static char* lo_extractDocumentStructureRequest(LibreOfficeKit* /*pThis*/, const char* pFilePath, +const char* pFilter) { uno::Reference xComponentLoader = frame::Desktop::create(xContext); uno::Reference< css::lang::XComponent > xComp; @@ -3194,9 +3196,14 @@ static char* lo_extractDocumentStructureRequest(LibreOfficeKit* /*pThis*/, const { tools::JsonWriter aJson; { -pDoc->getCommandValues(aJson, ".uno:ExtractDocumentStructure"); -//auto aNode = aJson.startNode("Controls"); -//extractLinks(xLTS->getLinks(), false, aJson); +OString aCommand = ".uno:ExtractDocumentStructure"_ostr; +if (pFilter && pFilter[0]) +{ +aCommand += OString::Concat(aCommand) + "?filter="_ostr + pFilter; +} + +pDoc->getCommandValues(aJson, aCommand); } return convertOString(aJson.finishAndGetAsOString()); } diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 168e1203123e..da1ddbe13d7f 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -149,7 +149,8 @@ struct _LibreOfficeKitClass /** @see lok::Office::extractDocumentStructureRequest. */ -char* (*extractDocumentStructureRequest) (LibreOfficeKit* pThis, const char* pFilePath); +char* (*extractDocumentStructureRequest)(LibreOfficeKit* pThis, const char* pFilePath, + const char* pFilter); }; #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize) diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 9ce39d9e7d34..3f165c3e5363 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -1259,9 +1259,9 @@ public: return mpThis->pClass->setForkedChild(mpThis, bIsChild);
core.git: Branch 'refs/tags/cp-24.04.5-2' - sw/source
Rebased ref, commits from common ancestor: commit ff487ed943d5c291a0b3f6c6ba170ba699a786d3 Author: Attila Szűcs AuthorDate: Mon Jul 15 17:52:50 2024 +0200 Commit: Caolán McNamara CommitDate: Tue Jul 16 13:30:41 2024 +0200 SW: fix EOL in transform Document Structure Changed the transform parameter to uri decoded string, and encode it here. This way special characters will survive the transfering. Change-Id: Ibfa890f98a35559992317ac1f01596b9ca24a07b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170508 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170572 Tested-by: Caolán McNamara diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index d9e96e4bd638..14225b4cb745 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -128,6 +128,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace com::sun::star::beans; @@ -2156,6 +2157,7 @@ void SwTextShell::Execute(SfxRequest &rReq) if (pDataJson) { aDataJson = pDataJson->GetValue(); +aDataJson = rtl::Uri::decode(aDataJson, rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8); } // parse the JSON got prom parameter
core.git: Branch 'distro/collabora/co-24.04.5' - sw/source
sw/source/uibase/shells/textsh1.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit ff487ed943d5c291a0b3f6c6ba170ba699a786d3 Author: Attila Szűcs AuthorDate: Mon Jul 15 17:52:50 2024 +0200 Commit: Caolán McNamara CommitDate: Tue Jul 16 13:30:41 2024 +0200 SW: fix EOL in transform Document Structure Changed the transform parameter to uri decoded string, and encode it here. This way special characters will survive the transfering. Change-Id: Ibfa890f98a35559992317ac1f01596b9ca24a07b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170508 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170572 Tested-by: Caolán McNamara diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index d9e96e4bd638..14225b4cb745 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -128,6 +128,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace com::sun::star::beans; @@ -2156,6 +2157,7 @@ void SwTextShell::Execute(SfxRequest &rReq) if (pDataJson) { aDataJson = pDataJson->GetValue(); +aDataJson = rtl::Uri::decode(aDataJson, rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8); } // parse the JSON got prom parameter
core.git: sw/inc sw/sdi sw/source
sw/inc/cmdid.h |1 sw/sdi/_textsh.sdi |4 sw/sdi/swriter.sdi | 17 sw/source/uibase/shells/textsh1.cxx | 151 4 files changed, 173 insertions(+) New commits: commit 913e26de02067d49cdbe2746f9e3c3c9bed63236 Author: Attila Szűcs AuthorDate: Mon Jul 1 08:48:43 2024 +0200 Commit: Miklos Vajna CommitDate: Tue Jul 16 09:24:45 2024 +0200 SW: transform document structure Added a new UNO command: .uno:TransformDocumentStructure it need a sring parameter conaining a JSON strucure, that list what to change (transform), like this: { "Transforms": { "ContentControls.ByIndex.0": { "content": "new value for the first content control" }, "ContentControls.ByTag.name": { "content": "John Smith" } } } this is just a 1. version it can only set text of a plain-text content control, or the state of a checkbox, or the alias (i may will be removed .. we have to decide later about all setable propertyes of contentc controls, what to let transform) Change-Id: I1772d979a7eb43961d62896f3c393482ed7dfa89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170538 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index c99e8da6d3f7..bd36f0bdd3b3 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -151,6 +151,7 @@ class SwUINumRuleItem; #define FN_REDLINE_REJECT_ALL(FN_EDIT2 + 44)/* Redlining Reject All*/ #define FN_REDLINE_ACCEPT_TONEXT (FN_EDIT2 + 45)/* Redlining Accept and jump to next*/ #define FN_REDLINE_REJECT_TONEXT (FN_EDIT2 + 46)/* Redlining Reject and jump to next*/ +#define FN_TRANSFORM_DOCUMENT_STRUCTURE (FN_EDIT2 + 47) /* overwrite text of content control, and more*/ // Region: View #define FN_DRAW_WRAP_DLGTypedWhichId(FN_VIEW + 3) /* Draw wrapping dlg */ diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index fa5809bd29c0..4d982bf76d8f 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -336,6 +336,10 @@ interface BaseText ExecMethod = ExecInsert ; StateMethod = GetState ; ] +FN_TRANSFORM_DOCUMENT_STRUCTURE +[ +ExecMethod = Execute ; +] FN_INSERT_COLUMN_BREAK // status(final|play) [ ExecMethod = ExecInsert ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index ed49dc200ed9..ccbfb29dfb75 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -3338,6 +3338,23 @@ SfxVoidItem ContentControlProperties FN_CONTENT_CONTROL_PROPERTIES GroupId = SfxGroupId::Insert; ] +SfxVoidItem TransformDocumentStructure FN_TRANSFORM_DOCUMENT_STRUCTURE +(SfxStringItem DataJson FN_PARAM_1) +[ +AutoUpdate = FALSE, +FastCall = FALSE, +ReadOnlyDoc = FALSE, +Toggle = FALSE, +Container = FALSE, +RecordAbsolute = FALSE, +RecordPerSet; + +AccelConfig = TRUE, +MenuConfig = TRUE, +ToolBoxConfig = TRUE, +GroupId = SfxGroupId::Edit; +] + SfxVoidItem InsertMultiIndex FN_INSERT_MULTI_TOX () [ diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 9b0d76746541..a169f0490263 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -126,6 +127,8 @@ #include #include #include +#include +#include using namespace ::com::sun::star; using namespace com::sun::star::beans; @@ -2224,6 +2227,154 @@ void SwTextShell::Execute(SfxRequest &rReq) rWrtSh.SetInsMode( bOldIns ); } break; +case FN_TRANSFORM_DOCUMENT_STRUCTURE: +{ +// get the parameter, what to transform +OUString aDataJson; +const SfxStringItem* pDataJson = rReq.GetArg(FN_PARAM_1); +if (pDataJson) +{ +aDataJson = pDataJson->GetValue(); +} + +// parse the JSON got prom parameter +boost::property_tree::ptree aTree; +std::stringstream aStream( +(std::string(OUStringToOString(aDataJson, RTL_TEXTENCODING_UTF8; +boost::property_tree::read_json(aStream, aTree); + +// get the loaded content controls +uno::Reference xCCSupplier( +GetView().GetDocShell()->GetModel(), uno::UNO_QUERY); +uno::Reference xContentControls += xCCSupplier->getContentControls(); +int iCCcount = xContentControls->getCount(); + +enum class ContentDataType +{ +ERROR = -1, +INDEX, +TAG, +ALIAS, +ID +
core.git: Branch 'distro/collabora/co-24.04' - sw/source
sw/source/uibase/shells/textsh1.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 57dd4b32f12918949067c4276bda8b4cca61a895 Author: Attila Szűcs AuthorDate: Mon Jul 15 17:52:50 2024 +0200 Commit: Caolán McNamara CommitDate: Tue Jul 16 09:23:37 2024 +0200 SW: fix EOL in transform Document Structure Changed the transform parameter to uri decoded string, and encode it here. This way special characters will survive the transfering. Change-Id: Ibfa890f98a35559992317ac1f01596b9ca24a07b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170508 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index d9e96e4bd638..14225b4cb745 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -128,6 +128,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace com::sun::star::beans; @@ -2156,6 +2157,7 @@ void SwTextShell::Execute(SfxRequest &rReq) if (pDataJson) { aDataJson = pDataJson->GetValue(); +aDataJson = rtl::Uri::decode(aDataJson, rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8); } // parse the JSON got prom parameter
core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source
sw/qa/uitest/ui/misc/misc.py |9 + sw/source/uibase/wrtsh/wrtsh1.cxx | 27 +++ 2 files changed, 20 insertions(+), 16 deletions(-) New commits: commit 9186e01a0656cef3961e1495670c5f9114ee22ed Author: Attila Szűcs AuthorDate: Fri Jul 12 14:51:41 2024 +0200 Commit: Caolán McNamara CommitDate: Fri Jul 12 15:32:29 2024 +0200 SW: random ID for new content controls Make the generated unique ID random for new content controls. This way if we copy paste them from different documents, they may still be unique. Change-Id: I2adb6577e08b5798ae88a63b6178352aa76280d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170407 Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/sw/qa/uitest/ui/misc/misc.py b/sw/qa/uitest/ui/misc/misc.py index 8af00054a5e6..94fd60bff16f 100644 --- a/sw/qa/uitest/ui/misc/misc.py +++ b/sw/qa/uitest/ui/misc/misc.py @@ -44,9 +44,10 @@ class TestTmpdlg(UITestCase): type_text(xTag, "new tag ") xAdd = xDialog.getChild("add") -xId = xDialog.getChild("idspinbutton") -self.assertEqual(get_state_as_dict(xId)['Text'], "0") -type_text(xId, "429496729") # added in front, making it 4294967290 +# Id is a random number now, not 0. +# xId = xDialog.getChild("idspinbutton") +# self.assertEqual(get_state_as_dict(xId)['Text'], "0") +# type_text(xId, "429496729") # added in front, making it 4294967290 xTabIndex = xDialog.getChild("tabindexspinbutton") self.assertEqual(get_state_as_dict(xTabIndex)['Text'], "1") @@ -67,7 +68,7 @@ class TestTmpdlg(UITestCase): self.assertEqual(listItems[1][1].Value, "foo-bar") self.assertEqual(contentControl.Alias, "new alias my alias") self.assertEqual(contentControl.Tag, "new tag my tag") -self.assertEqual(contentControl.Id, -6) # stored as signed, displays as unsigned +# self.assertEqual(contentControl.Id, -6) # stored as signed, displays as unsigned self.assertEqual(contentControl.TabIndex, 4294967295) # stored as unsigned, displays as signed diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 16c49cdd7d89..004aa95ad127 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -1065,25 +1066,27 @@ void SwWrtShell::InsertContentControl(SwContentControlType eType) auto pContentControl = std::make_shared(nullptr); -// Search for a non used ID for the new ContentControl, to make it unique +// Make Random ID.. cehcek if it is unique +// warning: possible infinite loop if there would be billions of content controls. SwContentControlManager& pManager = GetDoc()->GetContentControlManager(); size_t nCCCount = pManager.GetCount(); -std::vector aIdMap(nCCCount); -aIdMap.resize(nCCCount, false); -size_t nIdToCheck; -for (nIdToCheck = 0; nIdToCheck < nCCCount; nIdToCheck++) +sal_Int32 nIdToCheck; +nIdToCheck += comphelper::rng::uniform_uint_distribution(1, std::numeric_limits::max()); +size_t nIdx = 0; +while (nIdx < nCCCount) { sal_Int32 nID -= pManager.UnsortedGet(nIdToCheck)->GetContentControl().GetContentControl()->GetId(); -if (nID >= 0 && nID < static_cast(nCCCount)) += pManager.UnsortedGet(nIdx)->GetContentControl().GetContentControl()->GetId(); +if (nID == nIdToCheck) { -aIdMap[nID] = true; +nIdToCheck = comphelper::rng::uniform_uint_distribution( +1, std::numeric_limits::max()); +nIdx = 0; } +else +nIdx++; } -// Find the first ID that was not used -nIdToCheck = 0; -while (nIdToCheck < nCCCount && aIdMap[nIdToCheck]) -nIdToCheck++; pContentControl->SetId(nIdToCheck); OUString aPlaceholder;
core.git: Branch 'distro/collabora/co-24.04' - desktop/source include/LibreOfficeKit sw/inc sw/source
desktop/source/lib/init.cxx | 17 ++- include/LibreOfficeKit/LibreOfficeKit.h |3 include/LibreOfficeKit/LibreOfficeKit.hxx|4 sw/inc/unoprnms.hxx |1 sw/source/core/unocore/unocontentcontrol.cxx | 13 +++ sw/source/uibase/shells/textsh1.cxx | 116 --- sw/source/uibase/uno/loktxdoc.cxx| 82 +++ sw/source/uibase/wrtsh/wrtsh1.cxx| 22 + 8 files changed, 221 insertions(+), 37 deletions(-) New commits: commit 578fb7b8227a8e19c00dba4d217bc1e3f7ffb5e9 Author: Attila Szűcs AuthorDate: Thu Jul 11 11:24:28 2024 +0200 Commit: Caolán McNamara CommitDate: Fri Jul 12 14:38:26 2024 +0200 Sw: extract/transform document structure 2 inserting a ContentControl, now generate a unique ID for it... search the lowest possible non used (non negative) number added a GetType() function for SwXContentControl that get it from SwContentControl, and used it for extract and transform. Added some support for all other types.. some are not really usable yet. Fixed a problem when setting checkbox check, did not changed its content. If content is set to “”. It now set as placeholder, and reset its content to the initial placeholder value, like: “Choose an item” or “Click here to enter text” (work for checkbox, and picture CntentControl.) Change-Id: I0fc696f73734bdfb9ac5b8fdc6891168b8d4ed5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170365 Reviewed-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 176ab50d601d..cb542191befa 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2637,7 +2637,8 @@ static void lo_setOption(LibreOfficeKit* pThis, const char* pOption, const char* static void lo_dumpState(LibreOfficeKit* pThis, const char* pOptions, char** pState); -static char* lo_extractDocumentStructureRequest(LibreOfficeKit* pThis, const char* pFilePath); +static char* lo_extractDocumentStructureRequest(LibreOfficeKit* pThis, const char* pFilePath, +const char* pFilter); LibLibreOffice_Impl::LibLibreOffice_Impl() : m_pOfficeClass( gOfficeClass.lock() ) @@ -3200,7 +3201,8 @@ static char* lo_extractRequest(LibreOfficeKit* /*pThis*/, const char* pFilePath) return strdup("{ }"); } -static char* lo_extractDocumentStructureRequest(LibreOfficeKit* /*pThis*/, const char* pFilePath) +static char* lo_extractDocumentStructureRequest(LibreOfficeKit* /*pThis*/, const char* pFilePath, +const char* pFilter) { uno::Reference xComponentLoader = frame::Desktop::create(xContext); uno::Reference< css::lang::XComponent > xComp; @@ -3245,9 +3247,14 @@ static char* lo_extractDocumentStructureRequest(LibreOfficeKit* /*pThis*/, const { tools::JsonWriter aJson; { -pDoc->getCommandValues(aJson, ".uno:ExtractDocumentStructure"); -//auto aNode = aJson.startNode("Controls"); -//extractLinks(xLTS->getLinks(), false, aJson); +OString aCommand = ".uno:ExtractDocumentStructure"_ostr; +if (pFilter && pFilter[0]) +{ +aCommand += OString::Concat(aCommand) + "?filter="_ostr + pFilter; +} + +pDoc->getCommandValues(aJson, aCommand); } return convertOString(aJson.finishAndGetAsOString()); } diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 89bc609ff446..87bf5e6e7a0b 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -152,7 +152,8 @@ struct _LibreOfficeKitClass /** @see lok::Office::extractDocumentStructureRequest. */ -char* (*extractDocumentStructureRequest) (LibreOfficeKit* pThis, const char* pFilePath); +char* (*extractDocumentStructureRequest)(LibreOfficeKit* pThis, const char* pFilePath, + const char* pFilter); }; #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize) diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index f00a5e4ede66..115e73fdf58c 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -1268,9 +1268,9 @@ public: return mpThis->pClass->setFor
core.git: desktop/qa desktop/source include/LibreOfficeKit sw/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 - desktop/source/lib/init.cxx | 62 ++ include/LibreOfficeKit/LibreOfficeKit.h |4 + include/LibreOfficeKit/LibreOfficeKit.hxx |5 + sw/source/uibase/uno/loktxdoc.cxx | 77 5 files changed, 150 insertions(+), 1 deletion(-) New commits: commit f8e7da23b64580d4bc45abb159651c63b578be8d Author: Attila Szűcs AuthorDate: Mon Jun 24 12:45:57 2024 +0200 Commit: Miklos Vajna CommitDate: Fri Jul 12 10:45:49 2024 +0200 SW: exctract document structure It extract form controls, and write its data to JSON. It is a basic 1. version, for now it only recognize: -PlainText (and write its text) -CheckBox (and write its state) but it writes some common data for any type of controls: ID, alias, Tag, TabIndex, and its index. Change-Id: I9ff74cd013c6f1118942207059181678713504af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170381 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 85cd7e47e4f2..c5d981ca6c58 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3590,10 +3590,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(classOffset(19), offsetof(struct _LibreOfficeKitClass, stopURP)); CPPUNIT_ASSERT_EQUAL(classOffset(20), offsetof(struct _LibreOfficeKitClass, joinThreads)); CPPUNIT_ASSERT_EQUAL(classOffset(21), offsetof(struct _LibreOfficeKitClass, setForkedChild)); +CPPUNIT_ASSERT_EQUAL(classOffset(22), offsetof(struct _LibreOfficeKitClass, extractDocumentStructureRequest)); // When extending LibreOfficeKit with a new function pointer, add new assert for the offsetof the // new function pointer and bump this assert for the size of the class. -CPPUNIT_ASSERT_EQUAL(classOffset(22), sizeof(struct _LibreOfficeKitClass)); +CPPUNIT_ASSERT_EQUAL(classOffset(23), sizeof(struct _LibreOfficeKitClass)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(0), offsetof(struct _LibreOfficeKitDocumentClass, destroy)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(1), offsetof(struct _LibreOfficeKitDocumentClass, saveAs)); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 365947a43b9f..5a85758039ff 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2588,6 +2588,8 @@ static void lo_setOption(LibreOfficeKit* pThis, const char* pOption, const char* static void lo_dumpState(LibreOfficeKit* pThis, const char* pOptions, char** pState); +static char* lo_extractDocumentStructureRequest(LibreOfficeKit* pThis, const char* pFilePath); + LibLibreOffice_Impl::LibLibreOffice_Impl() : m_pOfficeClass( gOfficeClass.lock() ) , maThread(nullptr) @@ -2621,6 +2623,7 @@ LibLibreOffice_Impl::LibLibreOffice_Impl() m_pOfficeClass->stopURP = lo_stopURP; m_pOfficeClass->joinThreads = lo_joinThreads; m_pOfficeClass->setForkedChild = lo_setForkedChild; +m_pOfficeClass->extractDocumentStructureRequest = lo_extractDocumentStructureRequest; gOfficeClass = m_pOfficeClass; } @@ -3144,6 +3147,65 @@ static char* lo_extractRequest(LibreOfficeKit* /*pThis*/, const char* pFilePath) return strdup("{ }"); } +static char* lo_extractDocumentStructureRequest(LibreOfficeKit* /*pThis*/, const char* pFilePath) +{ +uno::Reference xComponentLoader = frame::Desktop::create(xContext); +uno::Reference< css::lang::XComponent > xComp; +OUString aURL(getAbsoluteURL(pFilePath)); +if (!aURL.isEmpty()) +{ +if (xComponentLoader.is()) +{ +try +{ +uno::Sequence aFilterOptions(comphelper::InitPropertySequence( +{ +{u"Hidden"_ustr, css::uno::Any(true)}, +{u"ReadOnly"_ustr, css::uno::Any(true)} +})); +xComp = xComponentLoader->loadComponentFromURL( aURL, u"_blank"_ustr, 0, aFilterOptions ); +} +catch ( const lang::IllegalArgumentException& ex ) +{ +SAL_WARN("lok", "lo_extractDocumentStructureRequest: IllegalArgumentException: " << ex.Message); +} +catch (...) +{ +SAL_WARN("lok", "lo_extractDocumentStructureRequest: Exception on loadComponentFromURL, url= " << aURL); +} + +if (xComp.is()) +{ +ITiledRenderable* pDoc = dynamic_cast(xComp.get()); + +auto pBaseModel = dynamic_cast(xComp.get()); +if (!pBaseModel) +return nullptr; + +SfxObje
core.git: Branch 'libreoffice-24-8' - chart2/qa oox/source
chart2/qa/extras/chart2export2.cxx | 30 ++ oox/source/export/chartexport.cxx | 14 +- 2 files changed, 43 insertions(+), 1 deletion(-) New commits: commit eb9352112df1ed88acf10a3e3ec1db2cd9892c98 Author: Attila Szűcs AuthorDate: Thu Jun 13 21:31:25 2024 +0200 Commit: Xisco Fauli CommitDate: Fri Jun 21 12:50:09 2024 +0200 tdf#161571 chart: OOXML export of piechart label positions Custom Positions of lables was not exported in case of piechart. As far as i know, Best Fit Placement in PieChart may can cause issues, because MS, and LO may calculate it differently, so i left that case unchanged, to avoid possible regressions. Change-Id: I84e94f30390eb323c7311ae1d97ca3c63da0bc6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168972 Tested-by: Jenkins Reviewed-by: Caolán McNamara Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169082 Reviewed-by: Attila Szűcs diff --git a/chart2/qa/extras/chart2export2.cxx b/chart2/qa/extras/chart2export2.cxx index 440c526cb5fc..67907d3643cf 100644 --- a/chart2/qa/extras/chart2export2.cxx +++ b/chart2/qa/extras/chart2export2.cxx @@ -455,6 +455,36 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCustomPositionofDataLabel) } } +CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf161571PiechartCustomPosDataLabels) +{ +// FIXME: validation error in OOXML export +skipValidation(); + +loadFromFile(u"xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx"); +save(u"Calc Office Open XML"_ustr); +xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr); +CPPUNIT_ASSERT(pXmlDoc); + +// test custom position of data label (xlsx) +assertXPath( +pXmlDoc, + "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/c:dLbl[2]/c:idx"_ostr, +"val"_ostr, u"1"_ustr); +OUString aXVal = getXPath(pXmlDoc, + "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/" + "c:dLbl[2]/c:layout/c:manualLayout/c:x"_ostr, + "val"_ostr); +double nX = aXVal.toDouble(); +CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.13500189609404625, nX, 1e-7); + +OUString aYVal = getXPath(pXmlDoc, + "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/" + "c:dLbl[2]/c:layout/c:manualLayout/c:y"_ostr, + "val"_ostr); +double nY = aYVal.toDouble(); +CPPUNIT_ASSERT_DOUBLES_EQUAL(0.15994818221025045, nY, 1e-7); +} + CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCustomDataLabelMultipleSeries) { loadFromFile(u"pptx/tdf115107-2.pptx"); diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index c63c8497daf1..78d3d4cbcebf 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -4052,8 +4052,20 @@ void ChartExport::exportDataLabels( pFS->startElement(FSNS(XML_c, XML_dLbl)); pFS->singleElement(FSNS(XML_c, XML_idx), XML_val, OString::number(nIdx)); +// As far as i know there can be issues with the Positions, +// if a piechart label use AVOID_OVERLAP placement (== BestFit) +// because LO and MS may calculate the bestFit positions differently. +bool bWritePosition = true; +if (eChartType == chart::TYPEID_PIE) +{ +sal_Int32 nLabelPlacement = aParam.meDefault; +xLabelPropSet->getPropertyValue(u"LabelPlacement"_ustr) >>= nLabelPlacement; +if (nLabelPlacement == css::chart::DataLabelPlacement::AVOID_OVERLAP) +bWritePosition = false; +} + // export custom position of data label -if( eChartType != chart::TYPEID_PIE ) +if (bWritePosition) { chart2::RelativePosition aCustomLabelPosition; if( xLabelPropSet->getPropertyValue(u"CustomLabelPosition"_ustr) >>= aCustomLabelPosition )
core.git: Branch 'libreoffice-24-8' - 2 commits - chart2/qa chart2/source cui/inc officecfg/registry oox/source
chart2/qa/extras/chart2export2.cxx | 27 +++ chart2/qa/extras/data/xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx |binary chart2/source/view/charttypes/PieChart.cxx | 26 +-- cui/inc/tipoftheday.hrc|2 officecfg/registry/data/org/openoffice/Office/Accelerators.xcu |6 - oox/source/drawingml/chart/seriesconverter.cxx | 29 oox/source/export/chartexport.cxx | 34 ++ 7 files changed, 108 insertions(+), 16 deletions(-) New commits: commit 19d58f7547bfab1a079d44b2e9272f48d0c623d7 Author: Attila Szűcs AuthorDate: Thu Jun 13 21:33:13 2024 +0200 Commit: Xisco Fauli CommitDate: Fri Jun 21 12:49:52 2024 +0200 tdf#161607 Chart: import-export LeaderLines data Implemented Importexport of some leaderLines data (color and width of the lines) from/to OOXML. It now supports only the solidFill color. Used properties: "LineColor" and "LineWidth" Change-Id: Ib33392d0404e1186328176fd93322e02b4006f3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168974 Reviewed-by: Caolán McNamara Tested-by: Jenkins Tested-by: Caolán McNamara Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169081 Reviewed-by: Attila Szűcs diff --git a/chart2/qa/extras/chart2export2.cxx b/chart2/qa/extras/chart2export2.cxx index 7d81dbb6f6a7..440c526cb5fc 100644 --- a/chart2/qa/extras/chart2export2.cxx +++ b/chart2/qa/extras/chart2export2.cxx @@ -549,6 +549,33 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testLeaderLines) } } +CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf161607PieChartLeaderLinesColorWidth) +{ +// FIXME: validation error in OOXML export +skipValidation(); + +loadFromFile(u"xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx"); +save(u"Calc Office Open XML"_ustr); +xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr); +CPPUNIT_ASSERT(pXmlDoc); + +// test LeaderLines width +OUString aWidth = getXPath( +pXmlDoc, + "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/c:leaderLines/c:spPr/" +"a:ln"_ostr, +"w"_ostr); +sal_Int32 nWidth = aWidth.toInt32(); +CPPUNIT_ASSERT_LESSEQUAL(static_cast(100), std::abs(nWidth - 88900)); + +// test LeaderLines Color +assertXPath( +pXmlDoc, + "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/c:leaderLines/c:spPr/" +"a:ln/a:solidFill/a:srgbClr"_ostr, +"val"_ostr, u"7030a0"_ustr); +} + CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testNumberFormatExportPPTX) { loadFromFile(u"pptx/tdf115859.pptx"); diff --git a/chart2/qa/extras/data/xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx b/chart2/qa/extras/data/xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx new file mode 100644 index ..c8c4e06a44c3 Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx differ diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index fcb79ef1907a..58193df880d6 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -27,7 +27,8 @@ #include #include #include - +#include "../../model/main/DataPointProperties.hxx" +#include #include #include @@ -686,14 +687,21 @@ void PieChart::createTextLabelShape( drawing::PointSequenceSequence aPoints{ { {nX1, nY1}, {nX2, nY2} } }; VLineProperties aVLineProperties; -if (aPieLabelInfo.xTextShape.is()) -{ -sal_Int32 nColor = 0; - aPieLabelInfo.xTextShape->SvxShape::getPropertyValue(u"CharColor"_ustr) >>= nColor; -//automatic font color does not work for lines -> fallback to black -if (nColor != -1) -aVLineProperties.Color <<= nColor; -} + +sal_Int32 nColor = 0; +nColor = rSeries.getModel() + ->getFastPropertyValue( + DataPointProperties::PROP_DATAPOINT_BORDER_COLOR) + .get(); +if (nColor != -1) +aVLineProperties.Color <<= nColor; +sal_Int32 nWidth = 0; +nWidth = rSeries.getModel() + ->getFastPropertyValue(LinePropertiesHelper::PROP_LINE_WIDTH) +
core.git: chart2/qa oox/source
chart2/qa/extras/chart2export2.cxx | 30 ++ oox/source/export/chartexport.cxx | 14 +- 2 files changed, 43 insertions(+), 1 deletion(-) New commits: commit dfffe516199b595e78a23178bc6e508a28ee48e6 Author: Attila Szűcs AuthorDate: Thu Jun 13 21:31:25 2024 +0200 Commit: Caolán McNamara CommitDate: Tue Jun 18 09:49:31 2024 +0200 tdf#161571 chart: OOXML export of piechart label positions Custom Positions of lables was not exported in case of piechart. As far as i know, Best Fit Placement in PieChart may can cause issues, because MS, and LO may calculate it differently, so i left that case unchanged, to avoid possible regressions. Change-Id: I84e94f30390eb323c7311ae1d97ca3c63da0bc6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168972 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/chart2/qa/extras/chart2export2.cxx b/chart2/qa/extras/chart2export2.cxx index 440c526cb5fc..67907d3643cf 100644 --- a/chart2/qa/extras/chart2export2.cxx +++ b/chart2/qa/extras/chart2export2.cxx @@ -455,6 +455,36 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCustomPositionofDataLabel) } } +CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf161571PiechartCustomPosDataLabels) +{ +// FIXME: validation error in OOXML export +skipValidation(); + +loadFromFile(u"xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx"); +save(u"Calc Office Open XML"_ustr); +xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr); +CPPUNIT_ASSERT(pXmlDoc); + +// test custom position of data label (xlsx) +assertXPath( +pXmlDoc, + "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/c:dLbl[2]/c:idx"_ostr, +"val"_ostr, u"1"_ustr); +OUString aXVal = getXPath(pXmlDoc, + "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/" + "c:dLbl[2]/c:layout/c:manualLayout/c:x"_ostr, + "val"_ostr); +double nX = aXVal.toDouble(); +CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.13500189609404625, nX, 1e-7); + +OUString aYVal = getXPath(pXmlDoc, + "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/" + "c:dLbl[2]/c:layout/c:manualLayout/c:y"_ostr, + "val"_ostr); +double nY = aYVal.toDouble(); +CPPUNIT_ASSERT_DOUBLES_EQUAL(0.15994818221025045, nY, 1e-7); +} + CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCustomDataLabelMultipleSeries) { loadFromFile(u"pptx/tdf115107-2.pptx"); diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index c63c8497daf1..78d3d4cbcebf 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -4052,8 +4052,20 @@ void ChartExport::exportDataLabels( pFS->startElement(FSNS(XML_c, XML_dLbl)); pFS->singleElement(FSNS(XML_c, XML_idx), XML_val, OString::number(nIdx)); +// As far as i know there can be issues with the Positions, +// if a piechart label use AVOID_OVERLAP placement (== BestFit) +// because LO and MS may calculate the bestFit positions differently. +bool bWritePosition = true; +if (eChartType == chart::TYPEID_PIE) +{ +sal_Int32 nLabelPlacement = aParam.meDefault; +xLabelPropSet->getPropertyValue(u"LabelPlacement"_ustr) >>= nLabelPlacement; +if (nLabelPlacement == css::chart::DataLabelPlacement::AVOID_OVERLAP) +bWritePosition = false; +} + // export custom position of data label -if( eChartType != chart::TYPEID_PIE ) +if (bWritePosition) { chart2::RelativePosition aCustomLabelPosition; if( xLabelPropSet->getPropertyValue(u"CustomLabelPosition"_ustr) >>= aCustomLabelPosition )
core.git: chart2/qa chart2/source oox/source
chart2/qa/extras/chart2export2.cxx | 27 +++ chart2/qa/extras/data/xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx |binary chart2/source/view/charttypes/PieChart.cxx | 26 +-- oox/source/drawingml/chart/seriesconverter.cxx | 29 oox/source/export/chartexport.cxx | 34 ++ 5 files changed, 107 insertions(+), 9 deletions(-) New commits: commit ada05b8874aa2c5161550dbc87d79b47f40f0df8 Author: Attila Szűcs AuthorDate: Thu Jun 13 21:33:13 2024 +0200 Commit: Caolán McNamara CommitDate: Tue Jun 18 09:49:07 2024 +0200 tdf#161607 Chart: import-export LeaderLines data Implemented Importexport of some leaderLines data (color and width of the lines) from/to OOXML. It now supports only the solidFill color. Used properties: "LineColor" and "LineWidth" Change-Id: Ib33392d0404e1186328176fd93322e02b4006f3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168974 Reviewed-by: Caolán McNamara Tested-by: Jenkins Tested-by: Caolán McNamara diff --git a/chart2/qa/extras/chart2export2.cxx b/chart2/qa/extras/chart2export2.cxx index 7d81dbb6f6a7..440c526cb5fc 100644 --- a/chart2/qa/extras/chart2export2.cxx +++ b/chart2/qa/extras/chart2export2.cxx @@ -549,6 +549,33 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testLeaderLines) } } +CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf161607PieChartLeaderLinesColorWidth) +{ +// FIXME: validation error in OOXML export +skipValidation(); + +loadFromFile(u"xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx"); +save(u"Calc Office Open XML"_ustr); +xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr); +CPPUNIT_ASSERT(pXmlDoc); + +// test LeaderLines width +OUString aWidth = getXPath( +pXmlDoc, + "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/c:leaderLines/c:spPr/" +"a:ln"_ostr, +"w"_ostr); +sal_Int32 nWidth = aWidth.toInt32(); +CPPUNIT_ASSERT_LESSEQUAL(static_cast(100), std::abs(nWidth - 88900)); + +// test LeaderLines Color +assertXPath( +pXmlDoc, + "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/c:leaderLines/c:spPr/" +"a:ln/a:solidFill/a:srgbClr"_ostr, +"val"_ostr, u"7030a0"_ustr); +} + CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testNumberFormatExportPPTX) { loadFromFile(u"pptx/tdf115859.pptx"); diff --git a/chart2/qa/extras/data/xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx b/chart2/qa/extras/data/xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx new file mode 100644 index ..c8c4e06a44c3 Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx differ diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index fcb79ef1907a..58193df880d6 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -27,7 +27,8 @@ #include #include #include - +#include "../../model/main/DataPointProperties.hxx" +#include #include #include @@ -686,14 +687,21 @@ void PieChart::createTextLabelShape( drawing::PointSequenceSequence aPoints{ { {nX1, nY1}, {nX2, nY2} } }; VLineProperties aVLineProperties; -if (aPieLabelInfo.xTextShape.is()) -{ -sal_Int32 nColor = 0; - aPieLabelInfo.xTextShape->SvxShape::getPropertyValue(u"CharColor"_ustr) >>= nColor; -//automatic font color does not work for lines -> fallback to black -if (nColor != -1) -aVLineProperties.Color <<= nColor; -} + +sal_Int32 nColor = 0; +nColor = rSeries.getModel() + ->getFastPropertyValue( + DataPointProperties::PROP_DATAPOINT_BORDER_COLOR) + .get(); +if (nColor != -1) +aVLineProperties.Color <<= nColor; +sal_Int32 nWidth = 0; +nWidth = rSeries.getModel() + ->getFastPropertyValue(LinePropertiesHelper::PROP_LINE_WIDTH) + .get(); +if (nWidth != -1) +aVLineProperties.Width <<= nWidth; + ShapeFactory::createLine2D(xTextTarget, aPoints, &aVLineProperties); } } diff --git a/oox/source/drawingml/chart
core.git: drawinglayer/source svx/qa svx/source
drawinglayer/source/attribute/sdrfillgraphicattribute.cxx | 13 ++ svx/qa/unit/data/tdf153008_crop_stretched_bitmap.pptx |binary svx/qa/unit/svdraw.cxx| 68 +- svx/source/customshapes/EnhancedCustomShape2d.cxx | 27 + 4 files changed, 105 insertions(+), 3 deletions(-) New commits: commit c30c1d12f283e75fdcc5bb508a79a9d33a431d28 Author: Attila Szűcs AuthorDate: Mon Jun 3 22:08:42 2024 +0200 Commit: Caolán McNamara CommitDate: Thu Jun 6 10:03:14 2024 +0200 tdf#153008 svx: impl crop for stretched bitmap fill The ticket had a pptx with a: Impress loaded the fillRect as a crop, but never used. Implemented a crop in SdrFillGraphicAttribute::createFillGraphicAttribute because in the case of stretching, it blindly used the whole picture. Cropping data was not available there so it is copied into OffsetPosition, and Size Change-Id: I195cc40a35dc24c708e7c0e3cdbe40d6e47b8ce5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168391 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx index b78f3e322c38..0acf4ba44be2 100644 --- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx +++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx @@ -286,6 +286,19 @@ namespace drawinglayer::attribute aBitmapSize.setX(aBitmapSize.getX() / fRangeWidth); aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight); } +else if (mpSdrFillGraphicAttribute->getStretch()) +{ +//tdf#153008 We may want to calculate crop. (stretch-fillRect case) +aBitmapTopLeft.setX(getOffsetPosition().getX() * 0.01); +aBitmapTopLeft.setY(getOffsetPosition().getY() * 0.01); +if (getSize().getX() != 0.0 && getSize().getY() != 0.0) +{ +const double fRangeWidth(0.0 != rRange.getWidth() ? rRange.getWidth() : 1.0); +const double fRangeHeight(0.0 != rRange.getHeight() ? rRange.getHeight() : 1.0); +aBitmapSize.setX(getSize().getX() / fRangeWidth); +aBitmapSize.setY(getSize().getY() / fRangeHeight); +} +} // get offset in percent const double fOffsetX(std::clamp(getOffset().getX() * 0.01, 0.0, 1.0)); diff --git a/svx/qa/unit/data/tdf153008_crop_stretched_bitmap.pptx b/svx/qa/unit/data/tdf153008_crop_stretched_bitmap.pptx new file mode 100644 index ..453b81fa006a Binary files /dev/null and b/svx/qa/unit/data/tdf153008_crop_stretched_bitmap.pptx differ diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index 83293c52ee3f..5f16baae175d 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -52,16 +52,17 @@ public: } protected: -SdrPage* getFirstDrawPageWithAssert(); +SdrPage* getFirstDrawPageWithAssert(sal_Int32 nPageIndex = 0); }; -SdrPage* SvdrawTest::getFirstDrawPageWithAssert() +SdrPage* SvdrawTest::getFirstDrawPageWithAssert(sal_Int32 nPageIndex /* = 0*/) { uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY_THROW); CPPUNIT_ASSERT(xDrawPagesSupplier.is()); uno::Reference xDrawPages(xDrawPagesSupplier->getDrawPages()); -uno::Reference xDrawPage(xDrawPages->getByIndex(0), uno::UNO_QUERY_THROW); +uno::Reference xDrawPage(xDrawPages->getByIndex(nPageIndex), + uno::UNO_QUERY_THROW); CPPUNIT_ASSERT(xDrawPage.is()); auto pDrawPage = dynamic_cast(xDrawPage.get()); @@ -465,6 +466,67 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf148000_CurvedTextWidth) } } +CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf153008_CropStretchedBitmapFill) +{ +loadFromFile(u"tdf153008_crop_stretched_bitmap.pptx"); + +SdrPage* pSdrPage = getFirstDrawPageWithAssert(); + +xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage); + +// Load Polygon size +sal_Int16 nPolyHeight = getXPath(pXmlDoc, "//mask/polypolygon"_ostr, "height"_ostr).toInt32(); +sal_Int16 nPolyWidth = getXPath(pXmlDoc, "//mask/polypolygon"_ostr, "width"_ostr).toInt32(); +// polygon position is nearly 0,0 +// Load Bitmap coordinates (from transformation matrix) +sal_Int16 nBmpPosX = getXPath(pXmlDoc, "//bitmap"_ostr, "xy13"_ostr).toInt32(); +sal_Int16 nBmpPosY = getXPath(pXmlDoc, "//bitmap"_ostr, "xy23"_ostr).toInt32(); +sal_Int16 nBmpWidth = getXPath(pXmlDoc, "//bitmap"_ostr, "xy11"_ostr).toInt32(); +sal_Int16 nBmpHeight = getXPath(pXmlDoc
core.git: slideshow/source
slideshow/source/engine/shapes/drawshape.cxx | 62 + slideshow/source/engine/shapes/drawshape.hxx | 37 +++ slideshow/source/engine/shapes/gdimtftools.cxx | 248 --- slideshow/source/engine/shapes/gdimtftools.hxx | 24 ++ slideshow/source/engine/shapes/shapeimporter.cxx |7 5 files changed, 251 insertions(+), 127 deletions(-) New commits: commit 89998a744f9ee8efa40c0e1cb7bdbc783d3414fa Author: Attila Szűcs AuthorDate: Thu Apr 25 01:43:05 2024 +0200 Commit: Caolán McNamara CommitDate: Thu Apr 25 14:05:13 2024 +0200 tdf#153162 Animation load optimization Loading a big GIF animation can freeze LO for a long time, so: changed getAnimationFromGraphic, it can load parts of a big animation. It can be called several times to load the whole animation. Now it can load animation while it is playing. It may still load smaller animations at once before it is rendered. At first it load frames that sum maximum 5 million pixels. (But minimum 10 frame.) Changed the Graphic parameter to shared_ptr, so it won’t be deleted until the whole animation is loaded. Change-Id: I5ac16d7ee4883dbaefb604cd07757d19e5aa2939 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166608 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx index 185b76cc23d3..de89822dac58 100644 --- a/slideshow/source/engine/shapes/drawshape.cxx +++ b/slideshow/source/engine/shapes/drawshape.cxx @@ -343,6 +343,7 @@ namespace slideshow::internal mxPage( xContainingPage ), maAnimationFrames(), // empty, we don't have no intrinsic animation mnCurrFrame(0), +mpGraphicLoader(), mpCurrMtf(), mnCurrMtfLoadFlags( bForeignSource ? MTF_LOAD_FOREIGN_SOURCE : MTF_LOAD_NONE ), @@ -418,12 +419,13 @@ namespace slideshow::internal DrawShape::DrawShape( const uno::Reference< drawing::XShape >& xShape, uno::Reference< drawing::XDrawPage > xContainingPage, double nPrio, - const Graphic& rGraphic, + std::shared_ptr pGraphic, const SlideShowContext& rContext ) : mxShape( xShape ), mxPage(std::move( xContainingPage )), maAnimationFrames(), mnCurrFrame(0), +mpGraphicLoader(), mpCurrMtf(), mnCurrMtfLoadFlags( MTF_LOAD_NONE ), maCurrentShapeUnitBounds(), @@ -450,12 +452,25 @@ namespace slideshow::internal mbDrawingLayerAnim( false ), mbContainsPageField( false ) { -ENSURE_OR_THROW( rGraphic.IsAnimated(), +ENSURE_OR_THROW( pGraphic->IsAnimated(), "DrawShape::DrawShape(): Graphic is no animation" ); -getAnimationFromGraphic( maAnimationFrames, - mnAnimationLoopCount, - rGraphic ); +::Animation aAnimation(pGraphic->GetAnimation()); +const Size aAnimSize(aAnimation.GetDisplaySizePixel()); +tools::Long nBitmapPixels = aAnimSize.getWidth() * aAnimSize.getHeight(); + +tools::Long nFramesToLoad = aAnimation.Count(); + +// if the Animation is bigger then 5 million pixels, we do not load the +// whole animation now. +if (nBitmapPixels * aAnimation.Count() > 500) +{ +nFramesToLoad = 500 / nBitmapPixels; +if (nFramesToLoad < 10) +nFramesToLoad = 10; +} +mpGraphicLoader = ::std::make_unique(pGraphic); +getSomeAnimationFramesFromGraphic(nFramesToLoad); ENSURE_OR_THROW( !maAnimationFrames.empty() && maAnimationFrames.front().mpMtf, @@ -475,6 +490,7 @@ namespace slideshow::internal maAnimationFrames(), // don't copy animations for subsets, // only the current frame! mnCurrFrame(0), +mpGraphicLoader(), mpCurrMtf( rSrc.mpCurrMtf ), mnCurrMtfLoadFlags( rSrc.mnCurrMtfLoadFlags ), maCurrentShapeUnitBounds(), @@ -550,13 +566,13 @@ namespace slideshow::internal const uno::Reference< drawing::XShape >&xShape, const uno::Reference< drawing::XDrawPage >& xContainingPage, double
core.git: vcl/source
vcl/source/filter/igif/gifread.cxx | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) New commits: commit 110eb4f6f8ed43faf7d2a4e74bfdcb93934f6439 Author: Attila Szűcs AuthorDate: Mon Mar 25 01:04:14 2024 +0100 Commit: Caolán McNamara CommitDate: Thu Mar 28 10:19:23 2024 +0100 tdf#153162 Gif load transparency optimization Converting a bitmap from transparency to alpha can be very slow. fortunately it can be avoided. Inverted the transparency colors (cTransIndex1, cNonTransIndex1) that are used to create aBmp1 in GIFReader::FillImages. It create the transparency bitmap inverted, so no need to invert it. Change-Id: I14714fe4b8bbcd7849db57b2824a7077dda40f81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165261 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Caolán McNamara diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 8f56edaee77f..cfb4e84f2363 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -220,18 +220,22 @@ void GIFReader::CreateBitmaps(tools::Long nWidth, tools::Long nHeight, BitmapPal if (bGCTransparent) { const Color aWhite(COL_WHITE); +const Color aBlack(COL_BLACK); aBmp1 = Bitmap(aSize, vcl::PixelFormat::N8_BPP, &Bitmap::GetGreyPalette(256)); if (!aAnimation.Count()) -aBmp1.Erase(aWhite); +aBmp1.Erase(aBlack); pAcc1 = aBmp1; if (pAcc1) { -cTransIndex1 = static_cast(pAcc1->GetBestPaletteIndex(aWhite)); -cNonTransIndex1 = cTransIndex1 ? 0 : 1; +// We have to make an AlphaMask from it, that needs to be inverted from transparency. +// It is faster to invert it here. +// So Non-Transparent color should be 0xff , and Transparent should be 0. +cNonTransIndex1 = static_cast(pAcc1->GetBestPaletteIndex(aWhite)); +cTransIndex1 = static_cast(pAcc1->GetBestPaletteIndex(aBlack)); } else { @@ -671,7 +675,8 @@ void GIFReader::CreateNewBitmaps() { pAcc1.reset(); AlphaMask aAlphaMask(aBmp1); -aAlphaMask.Invert(); // convert from transparency to alpha +// No need to convert from transparency to alpha +// aBmp1 is already inverted aAnimationFrame.maBitmapEx = BitmapEx( aBmp8, aAlphaMask ); } else
core.git: svx/inc svx/source
svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx|4 ++- svx/source/sdr/contact/viewcontactofgraphic.cxx |3 +- svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx | 24 ++ 3 files changed, 25 insertions(+), 6 deletions(-) New commits: commit d323976fd6d560a9b91da3e7833dfbe9f6b78f39 Author: Attila Szűcs AuthorDate: Thu Mar 21 01:57:59 2024 +0100 Commit: Attila Szűcs CommitDate: Fri Mar 22 15:25:23 2024 +0100 tdf#159258 SD: SS: disable placeholdertext in image Changed the text creation to use ExclusiveEditViewPrimitive2D in case we are in a placeholder image. Had to make a flag to send the information if we are in a placeholderimage.. because this function also called on other primitives. Unfortunatelly we cannot do it in CreateObjectSpecificViewObjectContact as in case of the icon... because the Primitive2DContainer that will (later) contain the text will also contain the rectangle as well, and we want to display the rectange. Follow-up to commit I307f4b0fe7f8faf98789787f216cac7be86a0515 "Provide tooling for EditView exclusive Primitives". Change-Id: If24aaa330c7b0b6dbaa72c9900774959ef24da4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165087 Tested-by: Jenkins Reviewed-by: Attila Szűcs diff --git a/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx index 91f1d9d2d4d8..3e19d5b6dce8 100644 --- a/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx +++ b/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx @@ -33,6 +33,7 @@ private: attribute::SdrLineFillEffectsTextAttribute maSdrLFSTAttribute; GraphicObject maGraphicObject; GraphicAttr maGraphicAttr; +bool mbPlaceholderImage = false; // local decomposition. virtual Primitive2DReference @@ -41,7 +42,8 @@ private: public: SdrGrafPrimitive2D(::basegfx::B2DHomMatrix aTransform, const attribute::SdrLineFillEffectsTextAttribute& rSdrLFSTAttribute, - const GraphicObject& rGraphicObject, const GraphicAttr& rGraphicAttr); + const GraphicObject& rGraphicObject, const GraphicAttr& rGraphicAttr, + bool bPlaceholderImage = false); // data access const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; } diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index f3a18d8e6462..b9f7755b5a03 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -84,7 +84,8 @@ namespace sdr::contact rObjectMatrix, rAttribute, aEmptyGraphicObject, -aEmptyGraphicAttr)); +aEmptyGraphicAttr, +true)); xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReferenceA }; // SdrGrafPrimitive2D with content (which is the preview graphic) scaled to smaller size and diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index ff91bc67462d..dadc8d06326e 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -103,9 +104,22 @@ Primitive2DReference SdrGrafPrimitive2D::create2DDecomposition( // add text if (!getSdrLFSTAttribute().getText().isDefault()) { - aRetval.push_back(createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - getSdrLFSTAttribute().getText(), - getSdrLFSTAttribute().getLine(), false, false)); +const drawinglayer::primitive2d::Primitive2DReference xReferenceA = createTextPrimitive( +basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), getSdrLFSTAttribute().getText(), +getSdrLFSTAttribute().getLine(), false, false); + +if (!mbPlaceholderImage) +{ +aRetval.push_back(xReferenceA); +} +else +{ +const drawinglayer::primitive2d::Primitive2DReference aEmbedded( +new drawinglayer::primitive2d::ExclusiveEditViewPrimitive2D( +drawinglayer::primitive2d::Primitive2DContainer{ xReferenceA })); + +aRetval.push_back(aEmbedded); +} } // tdf#132199: put glow before shadow, to have shadow of the glow, not the opposite @@ -128,11 +142,13 @@ Primitive2DReference SdrGrafPrimitive2D::create2DDecomposition( SdrGrafPrimitive2D::SdrGrafPrimitive2D( basegfx::B2DHomMatrix aTransform, const attribute::SdrLineFillEffectsTextAttribute& rSdrLFSTAttribute, -cons
core.git: oox/source
oox/source/drawingml/shape.cxx | 41 + 1 file changed, 41 insertions(+) New commits: commit 0079f0e77e74a355d57b24d3a6b6d1a29f45eb79 Author: Attila Szűcs AuthorDate: Mon Feb 26 10:04:23 2024 +0100 Commit: Attila Szűcs CommitDate: Tue Feb 27 09:51:43 2024 +0100 tdf#67347 pptx import: stacked + horz/vert aligment In case of Stacked, PP calculates in the vertical direction with the horizontal alignment. We simulate it by setting TextVerticalAdjust at import time (from PPTX) based on the ParagraphAdjust of the 1. paragraph It is not perfect, because we have 1 TextVerticalAdjust / 1 shape, and it does not support justified, while we can have many ParagraphAdjust / 1 shape (if the shape have more paragraphs) For a better solution we should re-implement the entire stacked thing, but that is a much bigger task. Change-Id: I4011be0f118b870ab7f9e2ddc15c6dc5a21f8a89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163934 Reviewed-by: Caolán McNamara Tested-by: Jenkins Reviewed-by: Attila Szűcs diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 8f3aedf3488a..d9a3f8b8db59 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -90,6 +90,7 @@ #include #include #include +#include #include #include @@ -1354,6 +1355,46 @@ Reference< XShape > const & Shape::createAndInsert( // add properties from textbody to shape properties if( mpTextBody ) { +// tdf#67347: In case of Stacked, PP calculates in the vertical direction with the +// horizontal alignment. +// In LO, we simulate it by setting TextVerticalAdjust based on the ParagraphAdjust +// of the 1. paragraph +// It is not perfect, because we have 1 TextVerticalAdjust / 1 shape, and it +// does not support justified, while we can have many ParagraphAdjust / 1 shape +// (if the shape have more paragraphs) +if (mpTextBody->getTextProperties().maPropertyMap.hasProperty(PROP_WritingMode) +&& mpTextBody->getTextProperties().maPropertyMap.getProperty(PROP_WritingMode) + == uno::Any(text::WritingMode2::STACKED) +&& mpTextBody->getParagraphs().size() > 0 +&& aServiceName != "com.sun.star.drawing.GroupShape") +{ +std::optional& oParaAdjust += mpTextBody->getParagraphs()[0]->getProperties().getParaAdjust(); + +if (oParaAdjust) +{ +switch (*oParaAdjust) +{ +case ParagraphAdjust::ParagraphAdjust_LEFT: +mpTextBody->getTextProperties().meVA += TextVerticalAdjust::TextVerticalAdjust_TOP; +break; +case ParagraphAdjust::ParagraphAdjust_CENTER: +mpTextBody->getTextProperties().meVA += TextVerticalAdjust::TextVerticalAdjust_CENTER; +break; +case ParagraphAdjust::ParagraphAdjust_RIGHT: +mpTextBody->getTextProperties().meVA += TextVerticalAdjust::TextVerticalAdjust_BOTTOM; +break; +default: +break; +} +mpTextBody->getTextProperties().maPropertyMap.setProperty( +PROP_TextVerticalAdjust, mpTextBody->getTextProperties().meVA); +} +} + mpTextBody->getTextProperties().pushTextDistances(Size(aShapeRectHmm.Width, aShapeRectHmm.Height)); aShapeProps.assignUsed( mpTextBody->getTextProperties().maPropertyMap ); // Push char properties as well - specifically useful when this is a placeholder
core.git: editeng/source include/editeng
editeng/source/editeng/editstt2.hxx |4 +++- editeng/source/editeng/impedit3.cxx |6 +++--- include/editeng/editstat.hxx|5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) New commits: commit 57ac7b73e898cf8889819d7f3beb3608e61b179b Author: Attila Szűcs AuthorDate: Wed Feb 21 10:57:14 2024 +0100 Commit: Caolán McNamara CommitDate: Wed Feb 21 15:13:32 2024 +0100 tdf#67347 fix regression stacked text in calc Added a new element (STACKED) to EEControlBits. It would be better to use only ONECHARPERLINE, but calc and impress used it from different places, and couldn't recognise each other, so they may overwrite each other. With this fix they both set a separate flag, and editeng check if any of the flags are set. regression was made by: I535da45e3a2f2d1550bad2a40e9909e0d561d0ef Change-Id: I60496059f3ce2773b232970bf2c3b7264ce64c5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163682 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/editeng/source/editeng/editstt2.hxx b/editeng/source/editeng/editstt2.hxx index 334622b23495..09e7f02e1831 100644 --- a/editeng/source/editeng/editstt2.hxx +++ b/editeng/source/editeng/editstt2.hxx @@ -47,7 +47,9 @@ public: { return bool( nControlBits & EEControlBits::UNDOATTRIBS ); } boolOneCharPerLine() const -{ return bool( nControlBits & EEControlBits::ONECHARPERLINE ); } +{ +return bool(nControlBits & (EEControlBits::ONECHARPERLINE | EEControlBits::STACKED)); +} boolIsOutliner() const { return bool( nControlBits & EEControlBits::OUTLINER ); } diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 8bbcebcebf2a..0c8b9bae8223 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -695,13 +695,13 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) return false; } -//If the paragraph SvxFrameDirection is Stacked, use ONECHARPERLINE +//If the paragraph SvxFrameDirection is Stacked, use STACKED const SvxFrameDirectionItem* pFrameDirItem = &GetParaAttrib(nPara, EE_PARA_WRITINGDIR); bool bStacked = pFrameDirItem->GetValue() == SvxFrameDirection::Stacked; if (bStacked) -maStatus.TurnOnFlags(EEControlBits::ONECHARPERLINE); +maStatus.TurnOnFlags(EEControlBits::STACKED); else -maStatus.TurnOffFlags(EEControlBits::ONECHARPERLINE); +maStatus.TurnOffFlags(EEControlBits::STACKED); // Initialization... diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx index 29653d5eec4f..4e839254df1c 100644 --- a/include/editeng/editstat.hxx +++ b/include/editeng/editstat.hxx @@ -32,7 +32,7 @@ enum class EEControlBits PASTESPECIAL = 0x0010, // Allow PasteSpecial AUTOINDENTING = 0x0020, // Automatic indenting UNDOATTRIBS= 0x0040, // Undo for Attributes... -ONECHARPERLINE = 0x0080, // One character per line +ONECHARPERLINE = 0x0080, // One character per line (used in calc) NOCOLORS = 0x0100, // Engine: No Color OUTLINER = 0x0200, // Special treatment Outliner/Outline mode OUTLINER2 = 0x0400, // Special treatment Outliner/Page @@ -51,10 +51,11 @@ enum class EEControlBits FORMAT100 = 0x0100, // Always format to 100% ULSPACESUMMATION = 0x0200, // MS Compat: sum SA and SB, not maximum value SINGLELINE = 0x0400, // One line for all text +STACKED= 0x0800, // Same as ONECHARPERLINE (used in impress) }; namespace o3tl { -template<> struct typed_flags : is_typed_flags {}; +template<> struct typed_flags : is_typed_flags {}; } enum class EVControlBits
core.git: editeng/source include/editeng
editeng/source/editeng/impedit3.cxx |4 ++-- editeng/source/items/svxfont.cxx|4 ++-- include/editeng/svxfont.hxx |2 +- 3 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 684d63e133fddeca68055a83d85f75bd73319d39 Author: Attila Szűcs AuthorDate: Tue Feb 20 03:19:09 2024 +0100 Commit: Caolán McNamara CommitDate: Tue Feb 20 18:38:00 2024 +0100 tdf#67347 fix stacked text kern problems Disabled some kerning calculations in case of stacked text. Without this: -x position of characters was strange, and the last characters was different. -thin characters, like 'j', 'i', ' ', ... could result issues at editing the text. (if width of character + kern was < 0) Change-Id: I40a23ef445fc9683a1cfd619ea23f1536c525d1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163608 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index b54e1328a0ac..8bbcebcebf2a 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1249,14 +1249,14 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) if (bContinueLastPortion) { - Size aSize = aTmpFont.QuickGetTextSize( GetRefDevice(), rParaPortion.GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray); + Size aSize = aTmpFont.QuickGetTextSize( GetRefDevice(), rParaPortion.GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray, bStacked); pPortion->adjustSize(aSize.Width(), 0); if (pPortion->GetSize().Height() < aSize.Height()) pPortion->setHeight(aSize.Height()); } else { -Size aSize = aTmpFont.QuickGetTextSize(GetRefDevice(), rParaPortion.GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray); +Size aSize = aTmpFont.QuickGetTextSize(GetRefDevice(), rParaPortion.GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray, bStacked); pPortion->SetSize(aSize); } diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 876bc06868f8..a4367de4680e 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -442,7 +442,7 @@ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut ) } Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt, - const sal_Int32 nIdx, const sal_Int32 nLen, KernArray* pDXArray ) const + const sal_Int32 nIdx, const sal_Int32 nLen, KernArray* pDXArray, bool bStacked ) const { if ( !IsCaseMap() && !IsFixKerning() ) { @@ -477,7 +477,7 @@ Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt, } SAL_INFO( "editeng.quicktextsize", "SvxFont::QuickGetTextSize after GetTextArray(): Text length: " << nLen << " Text size: " << aTxtSize.Width() << "x" << aTxtSize.Height()); -if( IsFixKerning() && ( nLen > 1 ) ) +if( IsFixKerning() && ( nLen > 1 ) && !bStacked) { auto nKern = GetFixKerning(); tools::Long nOldValue = (*pDXArray)[0]; diff --git a/include/editeng/svxfont.hxx b/include/editeng/svxfont.hxx index a86e2097f80a..126b56f8f65f 100644 --- a/include/editeng/svxfont.hxx +++ b/include/editeng/svxfont.hxx @@ -101,7 +101,7 @@ public: Size QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt, const sal_Int32 nIdx, const sal_Int32 nLen, - KernArray* pDXArray = nullptr ) const; + KernArray* pDXArray = nullptr, bool bStacked = false ) const; void DrawPrev( OutputDevice* pOut, Printer* pPrinter, const Point &rPos, const OUString &rTxt,
core.git: editeng/inc editeng/qa editeng/source
editeng/inc/EditLine.hxx|3 editeng/qa/unit/core-test.cxx | 60 ++ editeng/source/editeng/EditLine.cxx |1 editeng/source/editeng/impedit3.cxx | 147 ++-- 4 files changed, 172 insertions(+), 39 deletions(-) New commits: commit 9ed6d80622174826f8b7413529320ccd94782296 Author: Attila Szűcs AuthorDate: Wed Jan 24 12:03:28 2024 +0100 Commit: Caolán McNamara CommitDate: Fri Feb 16 18:10:51 2024 +0100 tdf#154248 sd: change multiline field wrapping Modified ImpEditEngine::CreateLines and ImpEditEngine::Paint to wrap multiline fields (hyperlinks) to wrap better: Multiline hyperlinks can start/end in the middle of a line. like this: text hyperlink-start hyperlink-line2. hyperlink-end text Start of the lines of the multiline hyperlinks now follow the line start (for example if the 1. line has a bullet/indent, and the 2. line does not then the multiline hyperlink 2. line will start where normal 2. line would start) Changed the way how fields wrapped while editing.. (we didn't split fields into lines, when its textbox is edited, but now we do) This way it is more a WYSIWYG editor. (when we edit, we see what we will get) Changed the constant reference rLine to non-constant pointer pLine, because this hack change the actual line to the next line at the end of a muliline hyperlink, so the algotithm will continue calculating with the next line, as if it would be still the previous line. Change-Id: I2c67f4ae1b86ee9c73f01ae0c045f02e56a09c1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162503 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/editeng/inc/EditLine.hxx b/editeng/inc/EditLine.hxx index 165f3fcf0a59..7d4a43e0e639 100644 --- a/editeng/inc/EditLine.hxx +++ b/editeng/inc/EditLine.hxx @@ -35,6 +35,7 @@ private: std::vector aKashidaPositions; sal_Int32 nTxtWidth = 0; sal_Int32 nStartPosX = 0; +sal_Int32 nNextLinePosXDiff = 0; sal_Int32 nStart = 0; // could be replaced by nStartPortion sal_Int32 nEnd = 0; // could be replaced by nEndPortion sal_Int32 nStartPortion = 0; @@ -97,6 +98,8 @@ public: sal_Int32 GetStartPosX() const { return nStartPosX; } void SetStartPosX(sal_Int32 start); +sal_Int32 GetNextLinePosXDiff() const { return nNextLinePosXDiff; } +void SetNextLinePosXDiff(sal_Int32 diff) { nNextLinePosXDiff = diff; } Size CalcTextSize(ParaPortion& rParaPortion); bool IsInvalid() const { return bInvalid; } diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index 59f5c0ac7839..177310dd6b82 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -122,6 +122,7 @@ public: void testSingleLine(); void testMoveParagraph(); void testCreateLines(); +void testTdf154248MultilineFieldWrapping(); DECL_STATIC_LINK( Test, CalcFieldValueHdl, EditFieldInfo*, void ); @@ -152,6 +153,7 @@ public: CPPUNIT_TEST(testSingleLine); CPPUNIT_TEST(testMoveParagraph); CPPUNIT_TEST(testCreateLines); +CPPUNIT_TEST(testTdf154248MultilineFieldWrapping); CPPUNIT_TEST_SUITE_END(); private: @@ -2238,6 +2240,64 @@ void Test::testCreateLines() // CPPUNIT_ASSERT_MESSAGE("INTENTIONALLY FALSE", false); } +void Test::testTdf154248MultilineFieldWrapping() +{ +// If field wrapping changes, this test may need to be updated + +// Create Outliner instance +Outliner aOutliner(mpItemPool.get(), OutlinerMode::TextObject); +aOutliner.SetCalcFieldValueHdl(LINK(nullptr, Test, CalcFieldValueHdl)); + +// Create EditEngine's instance +EditEngine& aEditEngine = const_cast(aOutliner.GetEditEngine()); +aEditEngine.SetPaperSize(Size(2000, 2000)); +aEditEngine.SetText("ABC DEF ABC DEFGH"); +// Positions Ref *4 + +// Get Field Item for inserting URLs in text +SvxURLField aURLField("http://not.a.real.link";, + "Really long hyperlink text that wont fit in 1 line, no matter what.", + SvxURLFormat::Repr); +SvxFieldItem aField(aURLField, EE_FEATURE_FIELD); + +// Insert URL +EditDoc& rDoc = aEditEngine.GetEditDoc(); +ContentNode* pNode = rDoc.GetObject(0); +EditSelection aSel(EditPaM(pNode, 4), EditPaM(pNode, 4)); +aEditEngine.InsertField(aSel, aField); + +// Assert Field Count +CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), aEditEngine.GetFieldCount(0)); + +aEditEngine.QuickFormatDoc(false); +CPPUNIT_ASSERT_EQUAL(true, aEditEngine.IsFormatted()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aEditEngine.GetParagraphCount()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aEditEngine.GetLineCount(0)); + +ParaPortionList& rParagraphPort
core.git: 2 commits - download.lst editeng/source include/editeng offapi/com oox/source
download.lst |4 ++-- editeng/source/editeng/impedit3.cxx|9 + editeng/source/items/frmitems.cxx |6 ++ include/editeng/frmdir.hxx |3 +++ offapi/com/sun/star/text/WritingMode2.idl | 10 ++ oox/source/drawingml/textbodypropertiescontext.cxx |7 ++- oox/source/drawingml/textparagraph.cxx | 10 ++ oox/source/export/drawingml.cxx|2 ++ oox/source/shape/WpsContext.cxx| 14 ++ 9 files changed, 58 insertions(+), 7 deletions(-) New commits: commit f846efa507252b0584d2753a251f2dd99c34541a Author: Attila Szűcs AuthorDate: Thu Feb 8 15:46:07 2024 +0100 Commit: Caolán McNamara CommitDate: Fri Feb 16 13:07:18 2024 +0100 tdf#67347 pptx import: stacked text, minimal impl. Display Stacked text, and Import/Export Stacked property from/to pptx. It is a minimal implementation, it does not import/export to .odp, there is no user interface to set this property. Multiline Stacked text is rendered as 1 line text. XML_wordArtVertRtl is mapped to XML_wordArtVert. Editing of text containing space character seems to not work correctly. Change-Id: I535da45e3a2f2d1550bad2a40e9909e0d561d0ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163121 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 51c922ce0b3f..54a7745eca7a 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -694,6 +695,14 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) return false; } +//If the paragraph SvxFrameDirection is Stacked, use ONECHARPERLINE +const SvxFrameDirectionItem* pFrameDirItem = &GetParaAttrib(nPara, EE_PARA_WRITINGDIR); +bool bStacked = pFrameDirItem->GetValue() == SvxFrameDirection::Stacked; +if (bStacked) +maStatus.TurnOnFlags(EEControlBits::ONECHARPERLINE); +else +maStatus.TurnOffFlags(EEControlBits::ONECHARPERLINE); + // Initialization... // Always format for 100%: diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index e84ae2140e33..fa393ff4ccd8 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -4675,6 +4675,9 @@ bool SvxFrameDirectionItem::PutValue( const css::uno::Any& rVal, case text::WritingMode2::PAGE: SetValue( SvxFrameDirection::Environment ); break; +case text::WritingMode2::STACKED: +SetValue(SvxFrameDirection::Stacked); +break; default: bRet = false; break; @@ -4714,6 +4717,9 @@ bool SvxFrameDirectionItem::QueryValue( css::uno::Any& rVal, case SvxFrameDirection::Environment: nVal = text::WritingMode2::PAGE; break; +case SvxFrameDirection::Stacked: +nVal = text::WritingMode2::STACKED; +break; default: OSL_FAIL("Unknown SvxFrameDirection value!"); bRet = false; diff --git a/include/editeng/frmdir.hxx b/include/editeng/frmdir.hxx index 270ab62c626d..94972ebff0b0 100644 --- a/include/editeng/frmdir.hxx +++ b/include/editeng/frmdir.hxx @@ -56,6 +56,9 @@ enum class SvxFrameDirection /** Vertical, from top to bottom, from right to left (vert="vert"). */ Vertical_RL_TB90 = css::text::WritingMode2::TB_RL90, + +/** Stacked, from top to bottom, 1 char per line (vert="wordArtVert"). */ +Stacked = css::text::WritingMode2::STACKED, }; TranslateId getFrmDirResId(size_t nIndex); diff --git a/offapi/com/sun/star/text/WritingMode2.idl b/offapi/com/sun/star/text/WritingMode2.idl index f75108337a69..065912858de5 100644 --- a/offapi/com/sun/star/text/WritingMode2.idl +++ b/offapi/com/sun/star/text/WritingMode2.idl @@ -91,6 +91,16 @@ published constants WritingMode2 @since LibreOffice 7.5 */ const short TB_RL90 = 6; + +/** 'T' text within a line is written top-to-bottom, but characters are +'E' not rotated. +'X' This is like LR_TB where 1 Character fit in every line. +'T' Only 1 line display is implemented. +This corresponds to OOXML attribute vert="wordArtVert" for shapes. + +@since LibreOffice 24.8 +*/ +const short STACKED = 7; }; diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 46576c069c8e..a08ae8fb
core.git: include/comphelper
include/comphelper/oslfile2streamwrap.hxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 0f4002378d7cbf20ed5f33cbdc4e3c8e01e0338d Author: Attila Szűcs AuthorDate: Wed Feb 14 03:54:05 2024 +0100 Commit: Noel Grandin CommitDate: Wed Feb 14 07:57:24 2024 +0100 fix windows UNLESS_MERGELIBS it was needed to fix a linker error in my system Change-Id: I5eeebf0db569289aace32f61535ae2ba7148de48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163327 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/comphelper/oslfile2streamwrap.hxx b/include/comphelper/oslfile2streamwrap.hxx index 79bd808af452..84122624c8f7 100644 --- a/include/comphelper/oslfile2streamwrap.hxx +++ b/include/comphelper/oslfile2streamwrap.hxx @@ -58,7 +58,7 @@ private: class OSLOutputStreamWrapper final : public ::cppu::WeakImplHelper { public: -UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OSLOutputStreamWrapper(::osl::File& _rFile); +COMPHELPER_DLLPUBLIC OSLOutputStreamWrapper(::osl::File& _rFile); private: virtual ~OSLOutputStreamWrapper() override;
core.git: Branch 'libreoffice-24-2' - oox/qa oox/source
oox/qa/unit/data/tdf134401_ExportAutoGrowToTextWordWrap.odp |binary oox/qa/unit/export.cxx | 17 oox/source/export/drawingml.cxx | 16 +++ 3 files changed, 33 insertions(+) New commits: commit 1c7c0cdb90f703b963ec88180d12324e4b3afa2e Author: Attila Szűcs AuthorDate: Tue Jan 16 04:29:49 2024 +0100 Commit: Andras Timar CommitDate: Fri Jan 19 14:01:36 2024 +0100 tdf#134401 SD: export to pptx: autoGrow->textWordWrap PPTX doesn't have autoGrowWidth and autoGrowHeight, but it does have TextWordWrap which is similar. If autoGrowWidth and autoGrowHeight are set in the document, then they are exported to PPTX as TextWordWrap = "none". Without this patch, PowerPoint may wrap some texts into more lines as Impress does. This is because some text may rendered at sligtly different sizes in PowerPoint as in Impress. (maybe it is just a rounding difference) Even 1% (or less) size difference is enought, because when autoGrowthWidth and autoGrowthHeight is set, then there is a good chance, the textbox rectangle is exactly as big as the text. Change-Id: I2cdba68c66c43507c5007a9e395b87ddeeea2372 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162152 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara (cherry picked from commit dc5a761df436f5d9de781d1fa6cf7d010f8be0e8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162210 Reviewed-by: Andras Timar diff --git a/oox/qa/unit/data/tdf134401_ExportAutoGrowToTextWordWrap.odp b/oox/qa/unit/data/tdf134401_ExportAutoGrowToTextWordWrap.odp new file mode 100644 index ..9fcebfe0f448 Binary files /dev/null and b/oox/qa/unit/data/tdf134401_ExportAutoGrowToTextWordWrap.odp differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 415c5fe8d02f..aa9690efdb4a 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -1345,6 +1345,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf157289CircularArrowExport) assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo[1]"_ostr, "wR"_ostr, "6750"); assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo[1]"_ostr, "hR"_ostr, "6750"); } + +CPPUNIT_TEST_FIXTURE(Test, testTdf134401_ExportAutoGrowToTextWordWrap) +{ +// pptx doesn't have autoGrowWidth and autoGrowHeight, but it does have TextWordWrap +// which is similar. If autoGrowWidth and autoGrowHeight are set in the document, +// then they are exported to pptx as TextWordWrap = "none". +loadFromFile(u"tdf134401_ExportAutoGrowToTextWordWrap.odp"); +save("Impress Office Open XML"); + +// There are 2 shapes in the test file. +// The 1. shape is without autoGrowWidth/Height. +// The 2. shape is with autoGrowWidth/Height. +// Check if wrap="none" is exported for shape 2, but no wrap is exported for shape 1. +xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml"); +assertXPathNoAttribute(pXmlDoc, "//p:sp[1]/p:txBody/a:bodyPr"_ostr, "wrap"_ostr); +assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:bodyPr"_ostr, "wrap"_ostr, "none"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 05c96c9ad798..a3e5356c0523 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -4061,6 +4061,22 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo bHasWrap = true; } +// tdf#134401: If AUTOGROWWIDTH and AUTOGROWHEIGHT are set, then export it as TextWordWrap +if (SvxShapeText* pShpTxt = dynamic_cast(rXIface.get())) +{ +const sdr::properties::BaseProperties& rProperties += pShpTxt->GetSdrObject()->GetProperties(); + +const SdrOnOffItem& rSdrTextFitWidth = rProperties.GetItem(SDRATTR_TEXT_AUTOGROWWIDTH); +const SdrOnOffItem& rSdrTextFitHeight = rProperties.GetItem(SDRATTR_TEXT_AUTOGROWHEIGHT); + +if (rSdrTextFitWidth.GetValue() == true && rSdrTextFitHeight.GetValue() == true) +{ +bHasWrap = true; +bWrap = false; +} +} + if (bBodyPr) { const char* pWrap = (bHasWrap && !bWrap) || bIsFontworkShape ? "none" : nullptr;
core.git: sc/source
sc/source/ui/inc/content.hxx|2 ++ sc/source/ui/navipi/content.cxx | 18 +- 2 files changed, 19 insertions(+), 1 deletion(-) New commits: commit ebda38ef860970bea2996f3122660339ef2ddacd Author: Attila Szűcs AuthorDate: Tue Nov 7 15:03:33 2023 +0100 Commit: Andras Timar CommitDate: Wed Jan 17 17:32:11 2024 +0100 SC navigator: fix changing language of contenttree Save the actual language, when ScContentTree is created, and use that language to localise its text. Note: Saving language in ScContentTree::ScContentTree caused problems, so it is better to save the language when this tree is filled with text the first time. In case of LOK, there can be separate views, with different languages, that means there can be 2+ ScContentTrees, e.g. one has text in English and the other in German. When a new item is created that is listed in navigator, then every ScContentTree is updated at once... but that would use the global language, not the one what was used when the actual ScContentTree was created. Change-Id: I2dedf293e0ad9fb8f3cdd1090e1e1707a9f6cfa4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159077 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162192 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx index 2e8c6757e202..b57e49eb55f2 100644 --- a/sc/source/ui/inc/content.hxx +++ b/sc/source/ui/inc/content.hxx @@ -55,6 +55,8 @@ class ScContentTree o3tl::enumarray pPosList; // for the sequence +std::unique_ptr m_pResLocaleForLOK; //it needed only in case of LOK + ScDocShell* GetManualOrCurrent(); voidInitRoot(ScContentId nType); diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index af8b64b6fdba..588476d97ed9 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -188,7 +188,23 @@ void ScContentTree::InitRoot( ScContentId nType ) } auto const & aImage = aContentBmps[static_cast(nType) - 1]; -OUString aName(ScResId(SCSTR_CONTENT_ARY[static_cast(nType)])); + +OUString aName; +if(comphelper::LibreOfficeKit::isActive()) +{ +//In case of LOK we may have many different ScContentTrees in different languages. +//At creation time, we store what language we use, and then use it later too. +//It does not work in the constructor, that is why it is here. +if (!m_pResLocaleForLOK) +{ +m_pResLocaleForLOK = std::make_unique(SC_MOD()->GetResLocale()); +} +aName = Translate::get(SCSTR_CONTENT_ARY[static_cast(nType)], *m_pResLocaleForLOK); +} +else +{ +aName = ScResId(SCSTR_CONTENT_ARY[static_cast(nType)]); +} // back to the correct position: sal_uInt16 nPos = nRootType != ScContentId::ROOT ? 0 : pPosList[nType]-1; m_aRootNodes[nType] = m_xTreeView->make_iterator();
core.git: Branch 'distro/collabora/co-24.04' - 4 commits - editeng/inc editeng/source sfx2/source
editeng/inc/editattr.hxx|2 + editeng/inc/editdoc.hxx |1 editeng/source/editeng/editdoc.cxx | 13 + editeng/source/editeng/impedit3.cxx |6 +++- sfx2/source/view/lokhelper.cxx | 49 ++-- 5 files changed, 51 insertions(+), 20 deletions(-) New commits: commit 5bbda05d6f2abf87422190a3790db014edd748d1 Author: Attila Szűcs AuthorDate: Tue Jan 9 17:45:19 2024 +0100 Commit: Andras Timar CommitDate: Wed Jan 17 11:36:08 2024 +0100 tdf#154248 Impress: fix color of hyperlink Added a new FindAttrib method that searches in the attribs a bit different. The original FindAttrib searches in attribs as if their position intervals are closed from both side [Start,End]. However, the actual attribs array was created using PaMs as positions, and these are right-opened intervals [Start,End) Change-Id: I9a46b6b27ce447366fc20af1b46fd60b5c745359 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161836 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/editeng/inc/editattr.hxx b/editeng/inc/editattr.hxx index 3a619a5e85b8..985a586c7fe3 100644 --- a/editeng/inc/editattr.hxx +++ b/editeng/inc/editattr.hxx @@ -105,6 +105,8 @@ public: boolIsIn( sal_Int32 nIndex ) const { return ( ( nStart <= nIndex ) && ( nEnd >= nIndex ) ); } +boolIsInLeftClosedRightOpen( sal_Int32 nIndex ) const +{ return ( ( nStart <= nIndex ) && ( nEnd > nIndex ) ); } boolIsInside( sal_Int32 nIndex ) const { return ( ( nStart < nIndex ) && ( nEnd > nIndex ) ); } boolIsEmpty() const diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index 16eaf157a91f..80e3cc34243c 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -199,6 +199,7 @@ public: const EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) const; EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ); +EditCharAttrib* FindAttribRightOpen( sal_uInt16 nWhich, sal_Int32 nPos ); const EditCharAttrib* FindNextAttrib( sal_uInt16 nWhich, sal_Int32 nFromPos ) const; EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nPos ); const EditCharAttrib* FindFeature( sal_Int32 nPos ) const; diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index d892bd1c3a25..2472d8362957 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -2841,6 +2841,19 @@ EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) return nullptr; } +EditCharAttrib* CharAttribList::FindAttribRightOpen( sal_uInt16 nWhich, sal_Int32 nPos ) +{ +AttribsType::reverse_iterator it = std::find_if(aAttribs.rbegin(), aAttribs.rend(), +[&nWhich, &nPos](AttribsType::value_type& rxAttr) { +return rxAttr->Which() == nWhich && rxAttr->IsInLeftClosedRightOpen(nPos); }); +if (it != aAttribs.rend()) +{ +EditCharAttrib& rAttr = **it; +return &rAttr; +} +return nullptr; +} + const EditCharAttrib* CharAttribList::FindNextAttrib( sal_uInt16 nWhich, sal_Int32 nFromPos ) const { assert(nWhich); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index b24cc004011c..17699870c6e4 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2939,7 +2939,11 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo // #i1550# hard color attrib should win over text color from field if ( pAttrib->Which() == EE_FEATURE_FIELD ) { -EditCharAttrib* pColorAttr = pNode->GetCharAttribs().FindAttrib( EE_CHAR_COLOR, nPos ); +// These Attribs positions come from PaMs, so their interval is right-open and left-closed +// when SeekCursor is called, nPos is incremented by 1. I do not know why... +// probably designed to be a nEndPos, and like in a PaM, it is the position after the actual character. +sal_Int32 nPosActual = nPos > 0 ? nPos - 1 : 0; +EditCharAttrib* pColorAttr = pNode->GetCharAttribs().FindAttribRightOpen( EE_CHAR_COLOR, nPosActual ); if ( pColorAttr ) pColorAttr->SetFont( rFont, pOut ); } commit b97af5c60f379f45021bc6692dcba890dc80dc97 Author: Aron Budea AuthorDate: Tue Jan 9 12:39:56 2024 +1030 Commit: Andras Timar CommitDate: Wed Jan 17 11:34:45 2024 +0100 lok: Replace loop with std::find_if(...) Change-Id: Icfe912f7b79454b9d208c39382ba187d
core.git: Branch 'distro/collabora/co-24.04' - sc/source
sc/source/ui/inc/content.hxx|2 ++ sc/source/ui/navipi/content.cxx | 18 +- 2 files changed, 19 insertions(+), 1 deletion(-) New commits: commit a9a578610f51f708725afa698a946b6837c0d9ef Author: Attila Szűcs AuthorDate: Tue Nov 7 15:03:33 2023 +0100 Commit: Andras Timar CommitDate: Wed Jan 17 11:30:55 2024 +0100 SC navigator: fix changing language of contenttree Save the actual language, when ScContentTree is created, and use that language to localise its text. Note: Saving language in ScContentTree::ScContentTree caused problems, so it is better to save the language when this tree is filled with text the first time. In case of LOK, there can be separate views, with different languages, that means there can be 2+ ScContentTrees, e.g. one has text in English and the other in German. When a new item is created that is listed in navigator, then every ScContentTree is updated at once... but that would use the global language, not the one what was used when the actual ScContentTree was created. Change-Id: I2dedf293e0ad9fb8f3cdd1090e1e1707a9f6cfa4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159077 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx index 2e8c6757e202..b57e49eb55f2 100644 --- a/sc/source/ui/inc/content.hxx +++ b/sc/source/ui/inc/content.hxx @@ -55,6 +55,8 @@ class ScContentTree o3tl::enumarray pPosList; // for the sequence +std::unique_ptr m_pResLocaleForLOK; //it needed only in case of LOK + ScDocShell* GetManualOrCurrent(); voidInitRoot(ScContentId nType); diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 89d77642558a..d16f61411016 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -186,7 +186,23 @@ void ScContentTree::InitRoot( ScContentId nType ) } auto const & aImage = aContentBmps[static_cast(nType) - 1]; -OUString aName(ScResId(SCSTR_CONTENT_ARY[static_cast(nType)])); + +OUString aName; +if(comphelper::LibreOfficeKit::isActive()) +{ +//In case of LOK we may have many different ScContentTrees in different languages. +//At creation time, we store what language we use, and then use it later too. +//It does not work in the constructor, that is why it is here. +if (!m_pResLocaleForLOK) +{ +m_pResLocaleForLOK = std::make_unique(SC_MOD()->GetResLocale()); +} +aName = Translate::get(SCSTR_CONTENT_ARY[static_cast(nType)], *m_pResLocaleForLOK); +} +else +{ +aName = ScResId(SCSTR_CONTENT_ARY[static_cast(nType)]); +} // back to the correct position: sal_uInt16 nPos = nRootType != ScContentId::ROOT ? 0 : pPosList[nType]-1; m_aRootNodes[nType] = m_xTreeView->make_iterator();
core.git: oox/qa oox/source
oox/qa/unit/data/tdf134401_ExportAutoGrowToTextWordWrap.odp |binary oox/qa/unit/export.cxx | 17 oox/source/export/drawingml.cxx | 16 +++ 3 files changed, 33 insertions(+) New commits: commit dc5a761df436f5d9de781d1fa6cf7d010f8be0e8 Author: Attila Szűcs AuthorDate: Tue Jan 16 04:29:49 2024 +0100 Commit: Caolán McNamara CommitDate: Wed Jan 17 10:55:09 2024 +0100 tdf#134401 SD: export to pptx: autoGrow->textWordWrap PPTX doesn't have autoGrowWidth and autoGrowHeight, but it does have TextWordWrap which is similar. If autoGrowWidth and autoGrowHeight are set in the document, then they are exported to PPTX as TextWordWrap = "none". Without this patch, PowerPoint may wrap some texts into more lines as Impress does. This is because some text may rendered at sligtly different sizes in PowerPoint as in Impress. (maybe it is just a rounding difference) Even 1% (or less) size difference is enought, because when autoGrowthWidth and autoGrowthHeight is set, then there is a good chance, the textbox rectangle is exactly as big as the text. Change-Id: I2cdba68c66c43507c5007a9e395b87ddeeea2372 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162152 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/oox/qa/unit/data/tdf134401_ExportAutoGrowToTextWordWrap.odp b/oox/qa/unit/data/tdf134401_ExportAutoGrowToTextWordWrap.odp new file mode 100644 index ..9fcebfe0f448 Binary files /dev/null and b/oox/qa/unit/data/tdf134401_ExportAutoGrowToTextWordWrap.odp differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 415c5fe8d02f..aa9690efdb4a 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -1345,6 +1345,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf157289CircularArrowExport) assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo[1]"_ostr, "wR"_ostr, "6750"); assertXPath(pXmlDoc, "//a:pathLst/a:path/a:arcTo[1]"_ostr, "hR"_ostr, "6750"); } + +CPPUNIT_TEST_FIXTURE(Test, testTdf134401_ExportAutoGrowToTextWordWrap) +{ +// pptx doesn't have autoGrowWidth and autoGrowHeight, but it does have TextWordWrap +// which is similar. If autoGrowWidth and autoGrowHeight are set in the document, +// then they are exported to pptx as TextWordWrap = "none". +loadFromFile(u"tdf134401_ExportAutoGrowToTextWordWrap.odp"); +save("Impress Office Open XML"); + +// There are 2 shapes in the test file. +// The 1. shape is without autoGrowWidth/Height. +// The 2. shape is with autoGrowWidth/Height. +// Check if wrap="none" is exported for shape 2, but no wrap is exported for shape 1. +xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml"); +assertXPathNoAttribute(pXmlDoc, "//p:sp[1]/p:txBody/a:bodyPr"_ostr, "wrap"_ostr); +assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:bodyPr"_ostr, "wrap"_ostr, "none"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 05c96c9ad798..a3e5356c0523 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -4061,6 +4061,22 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo bHasWrap = true; } +// tdf#134401: If AUTOGROWWIDTH and AUTOGROWHEIGHT are set, then export it as TextWordWrap +if (SvxShapeText* pShpTxt = dynamic_cast(rXIface.get())) +{ +const sdr::properties::BaseProperties& rProperties += pShpTxt->GetSdrObject()->GetProperties(); + +const SdrOnOffItem& rSdrTextFitWidth = rProperties.GetItem(SDRATTR_TEXT_AUTOGROWWIDTH); +const SdrOnOffItem& rSdrTextFitHeight = rProperties.GetItem(SDRATTR_TEXT_AUTOGROWHEIGHT); + +if (rSdrTextFitWidth.GetValue() == true && rSdrTextFitHeight.GetValue() == true) +{ +bHasWrap = true; +bWrap = false; +} +} + if (bBodyPr) { const char* pWrap = (bHasWrap && !bWrap) || bIsFontworkShape ? "none" : nullptr;
core.git: Branch 'distro/collabora/co-23.05' - editeng/inc editeng/source
editeng/inc/editattr.hxx|2 ++ editeng/inc/editdoc.hxx |1 + editeng/source/editeng/editdoc.cxx | 13 + editeng/source/editeng/impedit3.cxx |6 +- 4 files changed, 21 insertions(+), 1 deletion(-) New commits: commit 9dd58f32e2a3b327f2a82387783d71af09d526bd Author: Attila Szűcs AuthorDate: Tue Jan 9 17:45:19 2024 +0100 Commit: Caolán McNamara CommitDate: Fri Jan 12 11:18:44 2024 +0100 tdf#154248 Impress: fix color of hyperlink Added a new FindAttrib method that searches in the attribs a bit different. The original FindAttrib searches in attribs as if their position intervals are closed from both side [Start,End]. However, the actual attribs array was created using PaMs as positions, and these are right-opened intervals [Start,End) Change-Id: I9a46b6b27ce447366fc20af1b46fd60b5c745359 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161836 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/editeng/inc/editattr.hxx b/editeng/inc/editattr.hxx index 502a5b084605..62d0a0ab5a70 100644 --- a/editeng/inc/editattr.hxx +++ b/editeng/inc/editattr.hxx @@ -101,6 +101,8 @@ public: boolIsIn( sal_Int32 nIndex ) const { return ( ( nStart <= nIndex ) && ( nEnd >= nIndex ) ); } +boolIsInLeftClosedRightOpen( sal_Int32 nIndex ) const +{ return ( ( nStart <= nIndex ) && ( nEnd > nIndex ) ); } boolIsInside( sal_Int32 nIndex ) const { return ( ( nStart < nIndex ) && ( nEnd > nIndex ) ); } boolIsEmpty() const diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index e5c3abbef0cf..13969badac36 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -200,6 +200,7 @@ public: const EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) const; EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ); +EditCharAttrib* FindAttribRightOpen( sal_uInt16 nWhich, sal_Int32 nPos ); const EditCharAttrib* FindNextAttrib( sal_uInt16 nWhich, sal_Int32 nFromPos ) const; EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nPos ); const EditCharAttrib* FindFeature( sal_Int32 nPos ) const; diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 9fff222d9368..38641b95efa4 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -2869,6 +2869,19 @@ EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) return nullptr; } +EditCharAttrib* CharAttribList::FindAttribRightOpen( sal_uInt16 nWhich, sal_Int32 nPos ) +{ +AttribsType::reverse_iterator it = std::find_if(aAttribs.rbegin(), aAttribs.rend(), +[&nWhich, &nPos](AttribsType::value_type& rxAttr) { +return rxAttr->Which() == nWhich && rxAttr->IsInLeftClosedRightOpen(nPos); }); +if (it != aAttribs.rend()) +{ +EditCharAttrib& rAttr = **it; +return &rAttr; +} +return nullptr; +} + const EditCharAttrib* CharAttribList::FindNextAttrib( sal_uInt16 nWhich, sal_Int32 nFromPos ) const { assert(nWhich); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 8a6ff9d63e6e..0541dfbc91b9 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2981,7 +2981,11 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo // #i1550# hard color attrib should win over text color from field if ( pAttrib->Which() == EE_FEATURE_FIELD ) { -EditCharAttrib* pColorAttr = pNode->GetCharAttribs().FindAttrib( EE_CHAR_COLOR, nPos ); +// These Attribs positions come from PaMs, so their interval is right-open and left-closed +// when SeekCursor is called, nPos is incremented by 1. I do not know why... +// probably designed to be a nEndPos, and like in a PaM, it is the position after the actual character. +sal_Int32 nPosActual = nPos > 0 ? nPos - 1 : 0; +EditCharAttrib* pColorAttr = pNode->GetCharAttribs().FindAttribRightOpen( EE_CHAR_COLOR, nPosActual ); if ( pColorAttr ) pColorAttr->SetFont( rFont, pOut ); }
core.git: sfx2/source
sfx2/source/view/lokhelper.cxx | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) New commits: commit f97dc9d815ad8fdd75cbcd9c18b2e585ecf39ca5 Author: Attila Szűcs AuthorDate: Tue Jan 9 20:23:44 2024 +0100 Commit: Caolán McNamara CommitDate: Thu Jan 11 20:47:30 2024 +0100 LOK: fix language warning in setView Made the warning before the new language set. This way we log the old (wrong) and new (good) language. Elseway we could save the old languages to a temporal variable, set the language, and do the warning with the saved variable, but i think the extra variables would be a waste of memory. Change-Id: I0b69f49d07e9130bf1538c2c8e1d0b09cf82091f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161841 Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara (cherry picked from commit e09b3f5f4cd662a596b5d8d6ad4d5e2778e315f4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161916 Tested-by: Jenkins diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 711e12209e8a..02cc7fe25230 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -194,10 +194,6 @@ void SfxLokHelper::setView(int nId) if (bIsCurrShell && comphelper::LibreOfficeKit::getLanguageTag().getBcp47() == pViewShell->GetLOKLanguageTag().getBcp47()) return; -// update the current LOK language and locale for the dialog tunneling - comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); -comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale()); - if (bIsCurrShell) { // If we wanted to set the SfxViewShell that is actually set, we could skip it. @@ -206,9 +202,15 @@ void SfxLokHelper::setView(int nId) SAL_WARN("lok", "LANGUAGE mismatch at setView! ... old (wrong) lang:" << comphelper::LibreOfficeKit::getLanguageTag().getBcp47() << " new lang:" << pViewShell->GetLOKLanguageTag().getBcp47()); -return; } +// update the current LOK language and locale for the dialog tunneling + comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); +comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale()); + +if (bIsCurrShell) +return; + SfxViewFrame& rViewFrame = pViewShell->GetViewFrame(); rViewFrame.MakeActive_Impl(false);
core.git: sfx2/source
sfx2/source/view/lokhelper.cxx | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) New commits: commit e78bce3c1dbef3bbc0a18d9c17e458a69c2a8e46 Author: Attila Szűcs AuthorDate: Fri Dec 1 15:20:58 2023 +0100 Commit: Caolán McNamara CommitDate: Thu Jan 11 14:54:51 2024 +0100 LOK: fix setView language problem Fix some mis-localization problem by checking for wrong language at setView(...). setView does not change current localization, if the view we want to set is the current view. But in some cases the language - view is not in a consistent state. Maybe the language changed but the view did not, or the current view changed without language change (I found examples for both). Changed setView(...) so that it checks, if the current language matches to the current view, and if it does not, then we set the view, even if we want to set to the current view. This won't fix everything, but hopefully it helps a lot. I think we should make sure that current view - current Language are always changed at the same time (or at least we make sure they always match). Change-Id: Ie177b9b55f7befcbcf7cd1f62e402700f0e1aa60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160219 Reviewed-by: Andras Timar Tested-by: Andras Timar Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161915 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index f21457e1b16d..711e12209e8a 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -190,13 +190,25 @@ void SfxLokHelper::setView(int nId) { DisableCallbacks dc; -if (pViewShell == SfxViewShell::Current()) +bool bIsCurrShell = (pViewShell == SfxViewShell::Current()); +if (bIsCurrShell && comphelper::LibreOfficeKit::getLanguageTag().getBcp47() == pViewShell->GetLOKLanguageTag().getBcp47()) return; // update the current LOK language and locale for the dialog tunneling comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale()); +if (bIsCurrShell) +{ +// If we wanted to set the SfxViewShell that is actually set, we could skip it. +// But it looks like that the language can go wrong, so we have to fix that. +// This can happen, when someone sets the language or SfxViewShell::Current() separately. +SAL_WARN("lok", "LANGUAGE mismatch at setView! ... old (wrong) lang:" +<< comphelper::LibreOfficeKit::getLanguageTag().getBcp47() +<< " new lang:" << pViewShell->GetLOKLanguageTag().getBcp47()); +return; +} + SfxViewFrame& rViewFrame = pViewShell->GetViewFrame(); rViewFrame.MakeActive_Impl(false);
core.git: Branch 'distro/collabora/co-23.05' - sfx2/source
sfx2/source/view/lokhelper.cxx | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) New commits: commit e09b3f5f4cd662a596b5d8d6ad4d5e2778e315f4 Author: Attila Szűcs AuthorDate: Tue Jan 9 20:23:44 2024 +0100 Commit: Caolán McNamara CommitDate: Wed Jan 10 11:10:51 2024 +0100 LOK: fix language warning in setView Made the warning before the new language set. This way we log the old (wrong) and new (good) language. Elseway we could save the old languages to a temporal variable, set the language, and do the warning with the saved variable, but i think the extra variables would be a waste of memory. Change-Id: I0b69f49d07e9130bf1538c2c8e1d0b09cf82091f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161841 Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 1ee8f262906c..c54551b1637f 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -195,10 +195,6 @@ void SfxLokHelper::setView(int nId) if (bIsCurrShell && comphelper::LibreOfficeKit::getLanguageTag().getBcp47() == pViewShell->GetLOKLanguageTag().getBcp47()) return; -// update the current LOK language and locale for the dialog tunneling - comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); -comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale()); - if (bIsCurrShell) { // If we wanted to set the SfxViewShell that is actually set, we could skip it. @@ -207,9 +203,15 @@ void SfxLokHelper::setView(int nId) SAL_WARN("lok", "LANGUAGE mismatch at setView! ... old (wrong) lang:" << comphelper::LibreOfficeKit::getLanguageTag().getBcp47() << " new lang:" << pViewShell->GetLOKLanguageTag().getBcp47()); -return; } +// update the current LOK language and locale for the dialog tunneling + comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); +comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale()); + +if (bIsCurrShell) +return; + SfxViewFrame* pViewFrame = pViewShell->GetViewFrame(); pViewFrame->MakeActive_Impl(false);
core.git: Branch 'distro/collabora/co-23.05' - sfx2/source
sfx2/source/view/lokhelper.cxx | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) New commits: commit 12bb3f3dd5bd29718b60697aa4f7e76c4698cd96 Author: Attila Szűcs AuthorDate: Fri Dec 1 15:20:58 2023 +0100 Commit: Andras Timar CommitDate: Sun Dec 10 12:33:44 2023 +0100 LOK: fix setView language problem Fix some mis-localization problem by checking for wrong language at setView(...). setView does not change current localization, if the view we want to set is the current view. But in some cases the language - view is not in a consistent state. Maybe the language changed but the view did not, or the current view changed without language change (I found examples for both). Changed setView(...) so that it checks, if the current language matches to the current view, and if it does not, then we set the view, even if we want to set to the current view. This won't fix everything, but hopefully it helps a lot. I think we should make sure that current view - current Language are always changed at the same time (or at least we make sure they always match). Change-Id: Ie177b9b55f7befcbcf7cd1f62e402700f0e1aa60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160219 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 0d3843632f13..2436c7cbe85d 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -180,13 +180,25 @@ void SfxLokHelper::setView(int nId) { DisableCallbacks dc; -if (pViewShell == SfxViewShell::Current()) +bool bIsCurrShell = (pViewShell == SfxViewShell::Current()); +if (bIsCurrShell && comphelper::LibreOfficeKit::getLanguageTag().getBcp47() == pViewShell->GetLOKLanguageTag().getBcp47()) return; // update the current LOK language and locale for the dialog tunneling comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale()); +if (bIsCurrShell) +{ +// If we wanted to set the SfxViewShell that is actually set, we could skip it. +// But it looks like that the language can go wrong, so we have to fix that. +// This can happen, when someone sets the language or SfxViewShell::Current() separately. +SAL_WARN("lok", "LANGUAGE mismatch at setView! ... old (wrong) lang:" +<< comphelper::LibreOfficeKit::getLanguageTag().getBcp47() +<< " new lang:" << pViewShell->GetLOKLanguageTag().getBcp47()); +return; +} + SfxViewFrame* pViewFrame = pViewShell->GetViewFrame(); pViewFrame->MakeActive_Impl(false);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - include/svx include/tools oox/qa sc/source sd/qa sd/source svx/qa svx/source sw/source
include/svx/compatflags.hxx |2 include/tools/poly.hxx |1 oox/qa/unit/shape.cxx |4 sc/source/ui/docshell/docsh.cxx |2 sd/qa/unit/export-tests-ooxml3.cxx |2 sd/source/ui/docshell/docshel4.cxx |2 svx/qa/unit/data/tdf148000_CurvedTextWidth.pptx |binary svx/qa/unit/data/tdf148000_CurvedTextWidth_Legacy.odp |binary svx/qa/unit/data/tdf148000_CurvedTextWidth_New.odp |binary svx/qa/unit/svdraw.cxx | 39 ++ svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 275 +--- svx/source/svdraw/svdmodel.cxx | 18 - sw/source/uibase/app/docshini.cxx |2 13 files changed, 296 insertions(+), 51 deletions(-) New commits: commit 3d7dad88c409fecd3ba4a3f27f8e2e6e2e5f14d7 Author: Attila Szűcs AuthorDate: Wed Nov 15 07:04:32 2023 +0100 Commit: Andras Timar CommitDate: Sun Nov 26 15:07:35 2023 +0100 tdf#148000 impress: improve fontwork text placement. Improved the calculation of positions of text characters for multi-line texts. The previous version only fitted the text to the basic outline (curve), and then scale them to the appropriate text line. This means that the text will be wider or shorter, depending on the shape of the curve, and which line it is on Now it calculates a curve for each paragraph and fits text on it. Text will be approximately the same width on each line. Except if the text is wider as the curve. Because then it shrinks the text to fit on the curve. (this can only happens on inner curves) Reused the same compat flag that was used in bug148000, now it serves as a Powerpoint compatible mode for FontWork, so no need to create new compat flag every time FontWork has improve. That means that the Fontwork in old documents has remains the same Refactored horizontal/vertical alignment, but had to keep the old hacks as well. Note: if there are too many lines of text, and the vertical alignment causes internal curves, then curves can shrink to 0 length (center point of a circle) or even to negative length, These cases are impossible to display normally, so it will be glitchy similar to how it was before this patch. MS PowerPoint avoid these cases by not allowing vertical alignments that would result internal (smaller) curves. Added unittest to check legacy-odb / new-odp / pptx file. It change the display of fontwork, so in some cases it may feel like a regression. Squashed a lot of typo fix commits by Andrea Gelmini. Change-Id: Iac2d9bc751bbc2b6f747c33958f969cb3543fae5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159776 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159975 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/include/svx/compatflags.hxx b/include/svx/compatflags.hxx index f7d021f17bf7..9a64bd2bab80 100644 --- a/include/svx/compatflags.hxx +++ b/include/svx/compatflags.hxx @@ -11,7 +11,7 @@ enum class SdrCompatibilityFlag { AnchoredTextOverflowLegacy, ///< for tdf#99729 -LegacySingleLineFontwork, ///< for tdf#148000 +LegacyFontwork, ///< for tdf#148000 false == Fontwork works in PowerPoint compat mode ConnectorUseSnapRect, ///< for tdf#149756 IgnoreBreakAfterMultilineField, ///< for tdf#148966 }; diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx index d9f2a4544901..fd653ec724b7 100644 --- a/include/tools/poly.hxx +++ b/include/tools/poly.hxx @@ -114,6 +114,7 @@ public: voidSetSize( sal_uInt16 nNewSize ); sal_uInt16 GetSize() const; +sal_uInt16 size() const { return GetSize(); } //for vector compatibility voidClear(); diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 4db45f7451be..d2475095e716 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -178,9 +178,9 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf125582_TextOnCircle) { SdrObjCustomShape& rSdrCustomShape( static_cast(*SdrObject::getSdrObjectFromXShape(xShape))); -// Without the fix in place width was 3639, but should be 4824 for 96dpi. +// Without the fix in place width was 3639, but should be 4784 for 96dpi. tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect()); -CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(4824), aBoundRect.GetWidth(), 5); +CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(4784), aBoundRect.GetWidth(), 5); } drawing::TextVerticalAdjust eAdjust; diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docsh
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/svx include/tools oox/qa sc/source sd/qa sd/source svx/qa svx/source sw/source
include/svx/compatflags.hxx |2 include/tools/poly.hxx |1 oox/qa/unit/shape.cxx |2 sc/source/ui/docshell/docsh.cxx |2 sd/qa/unit/export-tests-ooxml3.cxx |2 sd/source/ui/docshell/docshel4.cxx |2 svx/qa/unit/data/tdf148000_CurvedTextWidth.pptx |binary svx/qa/unit/data/tdf148000_CurvedTextWidth_Legacy.odp |binary svx/qa/unit/data/tdf148000_CurvedTextWidth_New.odp |binary svx/qa/unit/svdraw.cxx | 39 ++ svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 275 +--- svx/source/svdraw/svdmodel.cxx | 18 - sw/source/uibase/app/docshini.cxx |2 13 files changed, 295 insertions(+), 50 deletions(-) New commits: commit 202f2d6f6529a8fe5a12dded879bafb546d9add3 Author: Attila Szűcs AuthorDate: Wed Nov 15 07:04:32 2023 +0100 Commit: Caolán McNamara CommitDate: Thu Nov 23 10:02:19 2023 +0100 tdf#148000 impress: improve fontwork text placement. Improved the calculation of positions of text characters for multi-line texts. The previous version only fitted the text to the basic outline (curve), and then scale them to the appropriate text line. This means that the text will be wider or shorter, depending on the shape of the curve, and which line it is on Now it calculates a curve for each paragraph and fits text on it. Text will be approximately the same width on each line. Except if the text is wider as the curve. Because then it shrinks the text to fit on the curve. (this can only happens on inner curves) Reused the same compat flag that was used in bug148000, now it serves as a Powerpoint compatible mode for FontWork, so no need to create new compat flag every time FontWork has improve. That means that the Fontwork in old documents has remains the same Refactored horizontal/vertical alignment, but had to keep the old hacks as well. Note: if there are too many lines of text, and the vertical alignment causes internal curves, then curves can shrink to 0 length (center point of a circle) or even to negative length, These cases are impossible to display normally, so it will be glitchy similar to how it was before this patch. MS PowerPoint avoid these cases by not allowing vertical alignments that would result internal (smaller) curves. Added unittest to check legacy-odb / new-odp / pptx file. It change the display of fontwork, so in some cases it may feel like a regression. Change-Id: Iac2d9bc751bbc2b6f747c33958f969cb3543fae5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159428 Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/include/svx/compatflags.hxx b/include/svx/compatflags.hxx index f7d021f17bf7..9a64bd2bab80 100644 --- a/include/svx/compatflags.hxx +++ b/include/svx/compatflags.hxx @@ -11,7 +11,7 @@ enum class SdrCompatibilityFlag { AnchoredTextOverflowLegacy, ///< for tdf#99729 -LegacySingleLineFontwork, ///< for tdf#148000 +LegacyFontwork, ///< for tdf#148000 false == Fontwork works in PowerPoint compat mode ConnectorUseSnapRect, ///< for tdf#149756 IgnoreBreakAfterMultilineField, ///< for tdf#148966 }; diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx index d9f2a4544901..dff37a51b436 100644 --- a/include/tools/poly.hxx +++ b/include/tools/poly.hxx @@ -114,6 +114,7 @@ public: voidSetSize( sal_uInt16 nNewSize ); sal_uInt16 GetSize() const; +sal_uInt16 size() const { return GetSize(); } //for vector compability voidClear(); diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index c0bae9cbb536..64730eedd4ca 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -166,7 +166,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf125582_TextOnCircle) static_cast(*SdrObject::getSdrObjectFromXShape(xShape))); // Without the fix in place width was 3639, but should be 4824 for 96dpi. tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect()); -CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(4824), aBoundRect.GetWidth(), 5); +CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(4784), aBoundRect.GetWidth(), 5); } drawing::TextVerticalAdjust eAdjust; diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 41035532cb27..a0d45efd23a6 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -613,7 +613,7 @@ bool ScDocShell::Load( SfxMedium& rMedium ) { pDrawLayer->SetCompatibilityFla
[Libreoffice-commits] core.git: include/svx include/tools oox/qa sc/source sd/qa sd/source svx/qa svx/source sw/source
include/svx/compatflags.hxx |2 include/tools/poly.hxx |1 oox/qa/unit/shape.cxx |4 sc/source/ui/docshell/docsh.cxx |2 sd/qa/unit/export-tests-ooxml3.cxx |2 sd/source/ui/docshell/docshel4.cxx |2 svx/qa/unit/data/tdf148000_CurvedTextWidth.pptx |binary svx/qa/unit/data/tdf148000_CurvedTextWidth_Legacy.odp |binary svx/qa/unit/data/tdf148000_CurvedTextWidth_New.odp |binary svx/qa/unit/svdraw.cxx | 39 ++ svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 275 +--- svx/source/svdraw/svdmodel.cxx | 18 - sw/source/uibase/app/docshini.cxx |2 13 files changed, 296 insertions(+), 51 deletions(-) New commits: commit 3a5cc107efb843b01193230c56dc8d9c0072348a Author: Attila Szűcs AuthorDate: Wed Nov 15 07:04:32 2023 +0100 Commit: Caolán McNamara CommitDate: Wed Nov 22 11:10:08 2023 +0100 tdf#148000 impress: improve fontwork text placement. Improved the calculation of positions of text characters for multi-line texts. The previous version only fitted the text to the basic outline (curve), and then scale them to the appropriate text line. This means that the text will be wider or shorter, depending on the shape of the curve, and which line it is on Now it calculates a curve for each paragraph and fits text on it. Text will be approximately the same width on each line. Except if the text is wider as the curve. Because then it shrinks the text to fit on the curve. (this can only happens on inner curves) Reused the same compat flag that was used in bug148000, now it serves as a Powerpoint compatible mode for FontWork, so no need to create new compat flag every time FontWork has improve. That means that the Fontwork in old documents has remains the same Refactored horizontal/vertical alignment, but had to keep the old hacks as well. Note: if there are too many lines of text, and the vertical alignment causes internal curves, then curves can shrink to 0 length (center point of a circle) or even to negative length, These cases are impossible to display normally, so it will be glitchy similar to how it was before this patch. MS PowerPoint avoid these cases by not allowing vertical alignments that would result internal (smaller) curves. Added unittest to check legacy-odb / new-odp / pptx file. It change the display of fontwork, so in some cases it may feel like a regression. Change-Id: Iac2d9bc751bbc2b6f747c33958f969cb3543fae5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159776 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/include/svx/compatflags.hxx b/include/svx/compatflags.hxx index f7d021f17bf7..9a64bd2bab80 100644 --- a/include/svx/compatflags.hxx +++ b/include/svx/compatflags.hxx @@ -11,7 +11,7 @@ enum class SdrCompatibilityFlag { AnchoredTextOverflowLegacy, ///< for tdf#99729 -LegacySingleLineFontwork, ///< for tdf#148000 +LegacyFontwork, ///< for tdf#148000 false == Fontwork works in PowerPoint compat mode ConnectorUseSnapRect, ///< for tdf#149756 IgnoreBreakAfterMultilineField, ///< for tdf#148966 }; diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx index 77653d23bda7..24705f6c9e3c 100644 --- a/include/tools/poly.hxx +++ b/include/tools/poly.hxx @@ -114,6 +114,7 @@ public: voidSetSize( sal_uInt16 nNewSize ); sal_uInt16 GetSize() const; +sal_uInt16 size() const { return GetSize(); } //for vector compability voidClear(); diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 54ea52cce19c..d3a971cd58db 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -178,9 +178,9 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf125582_TextOnCircle) { SdrObjCustomShape& rSdrCustomShape( static_cast(*SdrObject::getSdrObjectFromXShape(xShape))); -// Without the fix in place width was 3639, but should be 4824 for 96dpi. +// Without the fix in place width was 3639, but should be 4784 for 96dpi. tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect()); -CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(4824), aBoundRect.GetWidth(), 5); +CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(4784), aBoundRect.GetWidth(), 5); } drawing::TextVerticalAdjust eAdjust; diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index c951814ce77f..77cf975166de 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -612,7 +612,7 @@ bool ScDocShell::Load(
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source
sc/source/ui/inc/content.hxx|2 ++ sc/source/ui/navipi/content.cxx | 18 +- 2 files changed, 19 insertions(+), 1 deletion(-) New commits: commit 3dff3a50dfda011c8bfb5502f6a8d1e7f8b95d59 Author: Attila Szűcs AuthorDate: Tue Nov 7 15:03:33 2023 +0100 Commit: Tomaž Vajngerl CommitDate: Thu Nov 16 04:02:36 2023 +0100 SC navigator: fix changing language of contenttree Saved the actual language, when ScContentTree is created, and use that language to localise is text. Note: Saving language in ScContentTree::ScContentTree caused problems, so it replaced into where this tree filled with text at the first time. In case of LOK, there can be seapate views, with different languages, that means there can be 2+ ScContentTree, one have text in English and the other in German. When new item is created that is listed in navigator, then every ScContentTree is updated at once... but that would use the global laguage, not the one what was used when the actual ScContentTree was created. Change-Id: I2dedf293e0ad9fb8f3cdd1090e1e1707a9f6cfa4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159077 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx index 9cd7e977319d..3f179860cce7 100644 --- a/sc/source/ui/inc/content.hxx +++ b/sc/source/ui/inc/content.hxx @@ -59,6 +59,8 @@ class ScContentTree o3tl::enumarray pPosList; // for the sequence +std::unique_ptr m_pResLocaleForLOK; //it needed only in case of LOK + ScDocShell* GetManualOrCurrent(); voidInitRoot(ScContentId nType); diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 1387abd44346..7c3d2b7d022b 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -188,7 +188,23 @@ void ScContentTree::InitRoot( ScContentId nType ) } auto const aImage(aContentBmps[static_cast(nType) - 1]); -OUString aName(ScResId(SCSTR_CONTENT_ARY[static_cast(nType)])); + +OUString aName; +if(comphelper::LibreOfficeKit::isActive()) +{ +//In case of LOK we may have many different languaged ScContentTree +//At creation time, we store what language we use, and then use it later too. +//It not work in the constructor, that is why it is here. +if (!m_pResLocaleForLOK) +{ +m_pResLocaleForLOK = std::make_unique(SC_MOD()->GetResLocale()); +} +aName = Translate::get(SCSTR_CONTENT_ARY[static_cast(nType)], *m_pResLocaleForLOK); +} +else +{ +aName = ScResId(SCSTR_CONTENT_ARY[static_cast(nType)]); +} // back to the correct position: sal_uInt16 nPos = nRootType != ScContentId::ROOT ? 0 : pPosList[nType]-1; m_aRootNodes[nType] = m_xTreeView->make_iterator();
[Libreoffice-commits] core.git: sw/source
sw/source/core/doc/docredln.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit bfeb6375a96d75ed7117f1581b0a0d7cb0d236ca Author: Attila Szűcs AuthorDate: Thu Oct 26 23:11:03 2023 +0200 Commit: Caolán McNamara CommitDate: Tue Oct 31 16:27:25 2023 +0100 tdf#157662 SW: fix connected area calculation Reset pRedline to its origin value between the 2 loops, because the 1. loop may change it. without this fix, if it discover neightbours in the 1. direction, it will not discover them in the other direction. Change-Id: Ia1ab357ada17cb7574907a3aa1bf0dd4d7a90255 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158517 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158721 Tested-by: Jenkins diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 0472343d8eb3..8ef699787b3f 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -846,6 +846,7 @@ void SwRedlineTable::getConnectedArea(size_type nPosOrigin, size_type& rPosStart rPosStart--; pRedline = pOther; } +pRedline = pOrigin; while (rPosEnd + 1 < size() && (pOther = (*this)[rPosEnd + 1]) && lcl_CanCombineWithRange(pOrigin, pRedline, pOther, false, bCheckChilds)) {
[Libreoffice-commits] core.git: sw/inc sw/source
sw/inc/IDocumentRedlineAccess.hxx |3 +- sw/source/core/doc/DocumentRedlineManager.cxx | 33 +- sw/source/core/doc/docnum.cxx |2 - sw/source/core/inc/DocumentRedlineManager.hxx |5 +++ 4 files changed, 39 insertions(+), 4 deletions(-) New commits: commit b40e469887d973e1eea242749a90c3c2370da3a5 Author: Attila Szűcs AuthorDate: Thu Oct 26 01:51:40 2023 +0200 Commit: Caolán McNamara CommitDate: Mon Oct 30 01:55:54 2023 +0100 tdf#157663 SW: fix redline continueing a move Subsequent moves generated new MoveID's, like if they were separete moves. That cause moves to forgot their other parts. Now, if we move a redline that was moved by us it will re-use its moveID as if it was just the continue of the previous movement. It does not work if we move more then 1 of our own movement redlines Note: There are complex cases what it cannot handle.. in those case it just use the new ID, so the newly moved part, will forgot its relation with the old move oroginal parts. Complex case is like.. if we move 2 of our own move redlines, that means there will be 2 MoveId we would want to continue, but only 1 insert redline to write that MoveID. But as long as we moved only 1 of our redlines it will work, even if there are more text redlines, even move redlines of other author. Other move redlines will be separate move anyway. Note2: In complex cases, we may could connect movements. Or we could split the new inserted move part. but those are design questions, they may be not good idea.. and the split one is probably more work to implement. Change-Id: Icb2adf43272181c6a63a4a84750352f4b163383a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158473 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158615 Tested-by: Jenkins diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx index 6e28f1340deb..9d97eb43ff7e 100644 --- a/sw/inc/IDocumentRedlineAccess.hxx +++ b/sw/inc/IDocumentRedlineAccess.hxx @@ -147,7 +147,8 @@ public: MERGED if pNewRedl was deleted but has been merged with existing one IGNORED if pNewRedl was deleted and ignored/invalid */ -virtual AppendResult AppendRedline(/*[in]*/SwRangeRedline* pNewRedl, /*[in]*/bool bCallDelete) = 0; +virtual AppendResult AppendRedline(/*[in]*/ SwRangeRedline* pNewRedl, /*[in]*/ bool bCallDelete, + /*[in]*/ sal_uInt32 nMoveIDToDelete = 0) = 0; virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr) = 0; virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr) = 0; diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 468449ecfbe9..8d52c814e81a 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -1309,7 +1309,8 @@ Behaviour of Delete-Redline: the Delete */ IDocumentRedlineAccess::AppendResult -DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCallDelete) +DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCallDelete, + sal_uInt32 nMoveIDToDelete) { CHECK_REDLINE( *this ) @@ -1330,6 +1331,9 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall return AppendResult::IGNORED; } +// Collect MoveID's of the redlines we delete. +// If there is only 1, then we should use its ID. (continuing the move) +std::set deletedMoveIDs; bool bMerged = false; @@ -1807,6 +1811,16 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall // and anonymized insertion, i.e. with the same dummy timestamp !pRedl->GetRedlineData(0).IsAnonymized() ) { +// Collect MoveID's of the redlines we delete. +if (nMoveIDToDelete > 1 && maRedlineTable[n]->GetMoved() > 0 +&& (eCmpPos == SwComparePosition::Equal +|| eCmpPos == SwComparePosition::Inside +|| eCmpPos == SwComparePosition::Outside +|| eCmpPos == SwComparePosition::OverlapBefore +|| eCmpPos == SwComparePosition::OverlapBehind)) +{ +deletedMoveIDs.insert(maRedlineTable[n]->GetMoved()); +} // Set to NONE, so that the Delete::Redo merges the Redline data correctly! // The ShowMode needs to be retained! @@ -2421,6 +24
[Libreoffice-commits] core.git: sw/inc sw/source
sw/inc/IDocumentRedlineAccess.hxx |9 ++ sw/source/core/doc/DocumentContentOperationsManager.cxx |9 ++ sw/source/core/doc/DocumentRedlineManager.cxx | 53 +++- sw/source/core/inc/DocumentRedlineManager.hxx | 10 +++ 4 files changed, 78 insertions(+), 3 deletions(-) New commits: commit 5e726afaf08c8cc59124d9551bb083220a38821e Author: Attila Szűcs AuthorDate: Wed Oct 25 12:46:10 2023 +0200 Commit: Caolán McNamara CommitDate: Mon Oct 30 00:39:30 2023 +0100 SW: fixed redline SwPosition update problem When nodes are removed, SwPosition nNode is updated, but its nContent is not. If nNode change from a non-ContentNodo to a ContentNode, then it is a problem, as nContent 's m_pContentNode remains nullptr, so the Position seems to be inconsistent. Now when redline remove nodes, it check what redlines may effected it, and update them after the node deletion happened. Probably this bug should be handled deeper, as this problem probably effect every SwPosition.. not sure if it can be a problem elsewhere. A special case when it happens, if there is a Table between 2 text. And there are 2 redlines.. 1: any redline positioned 'text start'-'table start' 2: delete redline: 'table begin'-'table end' now if we accept the 2. redline .. that remove the table the 1. redline position will change to: 'text start'-'next text start' but its end's nContent.m_pContentNode remain nullptr so lcl_CheckPosition(...) will assert Change-Id: I2981fd0218a375994d3f55cb5d3463b17ca35849 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158456 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158614 Tested-by: Jenkins diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx index c2b71aa1005a..6e28f1340deb 100644 --- a/sw/inc/IDocumentRedlineAccess.hxx +++ b/sw/inc/IDocumentRedlineAccess.hxx @@ -168,6 +168,11 @@ public: /*[in]*/const SwNode& rNode, /*[in]*/RedlineType nType) const = 0; +virtual SwRedlineTable::size_type GetRedlineEndPos( +/*[in]*/ SwRedlineTable::size_type nStartPos, +/*[in]*/ const SwNode& rNode, +/*[in]*/ RedlineType nType) const = 0; + virtual bool HasRedline( /*[in]*/const SwPaM& rPam, /*[in]*/RedlineType nType, @@ -226,6 +231,10 @@ public: virtual void SetRedlinePassword( /*[in]*/const css::uno::Sequence & rNewPassword) = 0; +virtual void UpdateRedlineContentNode(/*[in]*/ SwRedlineTable::size_type nStartPos, + /*[in]*/ SwRedlineTable::size_type nEndPos) const = 0; + + protected: virtual ~IDocumentRedlineAccess() {}; }; diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 60f9d1b96890..3f4c99a8f487 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2142,8 +2142,17 @@ void DocumentContentOperationsManager::DeleteDummyChar( void DocumentContentOperationsManager::DeleteRange( SwPaM & rPam ) { +// Seek all redlines that are in that PaM to be deleted.. +SwRedlineTable::size_type nRedlStart = m_rDoc.getIDocumentRedlineAccess().GetRedlinePos( +rPam.Start()->GetNode(), RedlineType::Any); +SwRedlineTable::size_type nRedlEnd = m_rDoc.getIDocumentRedlineAccess().GetRedlineEndPos( +nRedlStart, rPam.End()->GetNode(), RedlineType::Any); + lcl_DoWithBreaks(*this, rPam, SwDeleteFlags::Default, &DocumentContentOperationsManager::DeleteRangeImpl); +// update all redlines was in the Pam that is +m_rDoc.getIDocumentRedlineAccess().UpdateRedlineContentNode(nRedlStart, nRedlEnd); + if (!m_rDoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty()) { diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index b09ad5bedcaa..468449ecfbe9 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -54,9 +54,8 @@ using namespace com::sun::star; // 2. check that position is valid and doesn't point after text void lcl_CheckPosition( const SwPosition* pPos ) { -// Commented out because of a random problem, that happened even before my patch -//assert(dynamic_cast(&pPos->GetNode()) -//== pPos->GetContentNode()); +assert(dynamic_cast(&pPos->GetNode()) +== pPos->GetContentNode());
[Libreoffice-commits] core.git: 2 commits - sw/source
sw/source/core/doc/docredln.cxx|8 ++-- sw/source/uibase/misc/redlndlg.cxx |7 +-- 2 files changed, 7 insertions(+), 8 deletions(-) New commits: commit a1c3ac4205226f192b94a36a912e915b959043d7 Author: Attila Szűcs AuthorDate: Wed Oct 25 13:09:22 2023 +0200 Commit: Caolán McNamara CommitDate: Mon Oct 30 00:39:22 2023 +0100 SW: small fix for manage changes dialog. Fixed a continue, as it was planned to effect the outer loop. (probably when it was replaced to an inner loop it was forgot to handle) fixed a nullptr check also. These problems may not result real problem right now, but when interdependedt redlines will be improved, they will result in problems. Change-Id: Ie139f9a657abbacea9450176d2fe138392beddfa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158457 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158613 Tested-by: Caolán McNamara diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index b68bacbbef5c..532ea120ca2a 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -440,13 +440,16 @@ void SwRedlineAcceptDlg::Activate() { while (pRedlineData) { -if (pRedlineData != pBackupData->pChild) +if (!pBackupData || pRedlineData != pBackupData->pChild) { // Redline-Children were inserted, changed or deleted i = CalcDiff(i, true); if (i == SwRedlineTable::npos) return; -continue; + +// here was a continue; targetted to the outer loop +// now a break will do, as there is nothing after it in the outer loop +break; } pBackupData = pBackupData->pNext; pRedlineData = pRedlineData->Next(); commit 2c3f731992a294d4f35b41193af034fe9a6dd65c Author: Attila Szűcs AuthorDate: Wed Oct 25 11:40:23 2023 +0200 Commit: Caolán McNamara CommitDate: Mon Oct 30 00:39:12 2023 +0100 tdf#157663 SW: reenable move recognition improvements Re-enabled the improvement of move recognition in redlines, that is able to recognize movements split into more redlines. Probably it does not effect performance too much, but if in some cases it would become a problem then this small patch can be reverted easily. Change-Id: I6598d4d4f98f472f3972aec41b82ec26d90db860 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158455 Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158612 diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 02ded9bc1acd..26a3c7bc24df 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -908,11 +908,7 @@ bool SwRedlineTable::isMoved(size_type rPos) const if (isMovedImpl(rPos, false)) return true; else -{ -// Commented out because of probably performance issue -//return isMovedImpl(rPos, true); -return false; -} +return isMovedImpl(rPos, true); } bool SwRedlineTable::isMovedImpl(size_type rPos, bool bTryCombined) const @@ -982,7 +978,7 @@ bool SwRedlineTable::isMovedImpl(size_type rPos, bool bTryCombined) const size_type nStart = rPos > nLookahead ? rPos - nLookahead : 0; // first, try to compare to single redlines // next, try to compare to combined redlines -for (int nPass = 0; nPass < (bTryCombined ? 2 : 1) && !bRet; nPass++) +for (int nPass = 0; nPass < 2 && !bRet; nPass++) { for (size_type nPosAct = nStart; nPosAct < nEnd && !bRet; ++nPosAct) {
[Libreoffice-commits] core.git: include/xmloff schema/libreoffice sw/inc sw/qa sw/source writerfilter/source xmloff/source
include/xmloff/txtimp.hxx |2 include/xmloff/xmltoken.hxx |1 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |9 sw/inc/IDocumentContentOperations.hxx |2 sw/inc/crsrsh.hxx |2 sw/inc/docary.hxx |8 sw/inc/redline.hxx | 21 sw/inc/unoprnms.hxx |1 sw/qa/extras/layout/layout2.cxx |7 sw/qa/extras/uiwriter/data/tdf157663_redlineMove.odt|binary sw/qa/extras/uiwriter/uiwriter5.cxx | 136 + sw/source/core/doc/DocumentContentOperationsManager.cxx |9 sw/source/core/doc/DocumentRedlineManager.cxx | 201 --- sw/source/core/doc/doccomp.cxx |4 sw/source/core/doc/docnum.cxx |8 sw/source/core/doc/docredln.cxx | 304 +--- sw/source/core/inc/DocumentContentOperationsManager.hxx |2 sw/source/core/inc/DocumentRedlineManager.hxx | 14 sw/source/core/unocore/unocrsrhelper.cxx| 11 sw/source/core/unocore/unoredline.cxx |4 sw/source/filter/basflt/fltshell.cxx|1 sw/source/filter/ww8/writerhelper.cxx |2 sw/source/filter/xml/XMLRedlineImportHelper.cxx | 15 sw/source/filter/xml/XMLRedlineImportHelper.hxx |1 sw/source/filter/xml/xmltexti.cxx |3 sw/source/filter/xml/xmltexti.hxx |1 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 45 + writerfilter/source/dmapper/DomainMapper_Impl.hxx |4 xmloff/source/core/xmltoken.cxx |1 xmloff/source/text/XMLChangeInfoContext.cxx |7 xmloff/source/text/XMLChangeInfoContext.hxx |1 xmloff/source/text/XMLChangedRegionImportContext.cxx|5 xmloff/source/text/XMLChangedRegionImportContext.hxx|3 xmloff/source/text/XMLRedlineExport.cxx |9 xmloff/source/text/txtimp.cxx |1 xmloff/source/token/tokens.txt |1 36 files changed, 666 insertions(+), 180 deletions(-) New commits: commit e4fb4937b3f75ce3544f8de354ed92f7dd314511 Author: Attila Szűcs AuthorDate: Tue Oct 17 09:31:22 2023 +0200 Commit: Caolán McNamara CommitDate: Sun Oct 29 19:30:43 2023 +0100 tdf#157663 SW: Tracked change improve move Made accept/reject handle move redlines other pair, (moveto-movefrom) and handle the whole move redline, even if it is split into small pieces that separated from each other. Added unique ID to every move redline to help find their other parts. This move ID is generated in case of: move recognition moveing a paragraph. (directly create move redline with unique id without calling the recognition it is faster and more stable) (there are other cases that could be improved to not use recognition, but generate ID directly, like moveing selected partial text with mouse) Implemented the odt export/import of this move ID. it is a tag like this: "4" next to creator/date Improved the docx import to generate this move ID, so move redlines can find their other parts (Not changed Docx export... it works a bit, but far from perfect) Improved move reckognition: It can find them even if they are split into multiple parts differently. (like "ab"+"cd" == "a"+"bcd") Disabled this because of probably performance issue. made a complex unit test for it. Note: Left the move recognition on every place, to avoid as much regressions as possible.. but in the future, we may can disable it in some cases. Note2: We will have to keep move recognitnion, because there are documents from past, saved without any move informations in the file, and users expect to see move redlines there. (generated by the recognition.) Change-Id: If968d4235b676c5e538cfaf4187a4482a86eae9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157740 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158611 Tested-by: Jenkins diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx index 24caf36e53d7..c04e577c6573 100644 --- a/include/xmloff/txtimp.hxx +++ b/include/xmloff/txtimp.hxx @@ -381,6 +381,8 @@ public: const OUString& rComment, /// date+time const cs
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/core/doc/docredln.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit ff767b645077c1b10dc541ee2a202ff94446f604 Author: Attila Szűcs AuthorDate: Thu Oct 26 23:11:03 2023 +0200 Commit: Caolán McNamara CommitDate: Fri Oct 27 10:15:18 2023 +0200 tdf#157662 SW: fix connected area calculation Reset pRedline to its origin value between the 2 loops, because the 1. loop may change it. without this fix, if it discover neightbours in the 1. direction, it will not discover them in the other direction. Change-Id: Ia1ab357ada17cb7574907a3aa1bf0dd4d7a90255 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158517 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 4d3493515d6a..c5a6b6885a71 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -811,6 +811,7 @@ void SwRedlineTable::getConnectedArea(size_type nPosOrigin, size_type& rPosStart rPosStart--; pRedline = pOther; } +pRedline = pOrigin; while (rPosEnd + 1 < size() && (pOther = (*this)[rPosEnd + 1]) && lcl_CanCombineWithRange(pOrigin, pRedline, pOther, false, bCheckChilds)) {
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/inc sw/source
sw/inc/IDocumentRedlineAccess.hxx |3 +- sw/source/core/doc/DocumentRedlineManager.cxx | 33 +- sw/source/core/doc/docnum.cxx |2 - sw/source/core/inc/DocumentRedlineManager.hxx |5 +++ 4 files changed, 39 insertions(+), 4 deletions(-) New commits: commit c48bf3432dc894069090a4bd874c294d99224585 Author: Attila Szűcs AuthorDate: Thu Oct 26 01:51:40 2023 +0200 Commit: Caolán McNamara CommitDate: Thu Oct 26 11:45:59 2023 +0200 tdf#157663 SW: fix redline continueing a move Subsequent moves generated new MoveID's, like if they were separete moves. That cause moves to forgot their other parts. Now, if we move a redline that was moved by us it will re-use its moveID as if it was just the continue of the previous movement. It does not work if we move more then 1 of our own movement redlines Note: There are complex cases what it cannot handle.. in those case it just use the new ID, so the newly moved part, will forgot its relation with the old move oroginal parts. Complex case is like.. if we move 2 of our own move redlines, that means there will be 2 MoveId we would want to continue, but only 1 insert redline to write that MoveID. But as long as we moved only 1 of our redlines it will work, even if there are more text redlines, even move redlines of other author. Other move redlines will be separate move anyway. Note2: In complex cases, we may could connect movements. Or we could split the new inserted move part. but those are design questions, they may be not good idea.. and the split one is probably more work to implement. Change-Id: Icb2adf43272181c6a63a4a84750352f4b163383a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158473 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx index e163eb16a6c6..07961a02d9e3 100644 --- a/sw/inc/IDocumentRedlineAccess.hxx +++ b/sw/inc/IDocumentRedlineAccess.hxx @@ -148,7 +148,8 @@ public: MERGED if pNewRedl was deleted but has been merged with existing one IGNORED if pNewRedl was deleted and ignored/invalid */ -virtual AppendResult AppendRedline(/*[in]*/SwRangeRedline* pNewRedl, /*[in]*/bool bCallDelete) = 0; +virtual AppendResult AppendRedline(/*[in]*/ SwRangeRedline* pNewRedl, /*[in]*/ bool bCallDelete, + /*[in]*/ sal_uInt32 nMoveIDToDelete = 0) = 0; virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr) = 0; virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr) = 0; diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 531e76614622..657a67a61720 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -1265,7 +1265,8 @@ Behaviour of Delete-Redline: the Delete */ IDocumentRedlineAccess::AppendResult -DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCallDelete) +DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCallDelete, + sal_uInt32 nMoveIDToDelete) { CHECK_REDLINE( *this ) @@ -1286,6 +1287,9 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall return AppendResult::IGNORED; } +// Collect MoveID's of the redlines we delete. +// If there is only 1, then we should use its ID. (continuing the move) +std::set deletedMoveIDs; bool bMerged = false; @@ -1763,6 +1767,16 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall // and anonymized insertion, i.e. with the same dummy timestamp !pRedl->GetRedlineData(0).IsAnonymized() ) { +// Collect MoveID's of the redlines we delete. +if (nMoveIDToDelete > 1 && maRedlineTable[n]->GetMoved() > 0 +&& (eCmpPos == SwComparePosition::Equal +|| eCmpPos == SwComparePosition::Inside +|| eCmpPos == SwComparePosition::Outside +|| eCmpPos == SwComparePosition::OverlapBefore +|| eCmpPos == SwComparePosition::OverlapBehind)) +{ +deletedMoveIDs.insert(maRedlineTable[n]->GetMoved()); +} // Set to NONE, so that the Delete::Redo merges the Redline data correctly! // The ShowMode needs to be retained! @@ -2378,6 +2392,23 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const b
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/inc sw/source
sw/inc/IDocumentRedlineAccess.hxx |9 ++ sw/source/core/doc/DocumentContentOperationsManager.cxx |9 ++ sw/source/core/doc/DocumentRedlineManager.cxx | 53 +++- sw/source/core/inc/DocumentRedlineManager.hxx | 10 +++ 4 files changed, 78 insertions(+), 3 deletions(-) New commits: commit 9e94583a481b217694bfa21cf4136adc6ab3203b Author: Attila Szűcs AuthorDate: Wed Oct 25 12:46:10 2023 +0200 Commit: Caolán McNamara CommitDate: Thu Oct 26 09:35:04 2023 +0200 SW: fixed redline SwPosition update problem When nodes are removed, SwPosition nNode is updated, but its nContent is not. If nNode change from a non-ContentNodo to a ContentNode, then it is a problem, as nContent 's m_pContentNode remains nullptr, so the Position seems to be inconsistent. Now when redline remove nodes, it check what redlines may effected it, and update them after the node deletion happened. Probably this bug should be handled deeper, as this problem probably effect every SwPosition.. not sure if it can be a problem elsewhere. A special case when it happens, if there is a Table between 2 text. And there are 2 redlines.. 1: any redline positioned 'text start'-'table start' 2: delete redline: 'table begin'-'table end' now if we accept the 2. redline .. that remove the table the 1. redline position will change to: 'text start'-'next text start' but its end's nContent.m_pContentNode remain nullptr so lcl_CheckPosition(...) will assert Change-Id: I2981fd0218a375994d3f55cb5d3463b17ca35849 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158456 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx index f5367715354f..e163eb16a6c6 100644 --- a/sw/inc/IDocumentRedlineAccess.hxx +++ b/sw/inc/IDocumentRedlineAccess.hxx @@ -169,6 +169,11 @@ public: /*[in]*/const SwNode& rNode, /*[in]*/RedlineType nType) const = 0; +virtual SwRedlineTable::size_type GetRedlineEndPos( +/*[in]*/ SwRedlineTable::size_type nStartPos, +/*[in]*/ const SwNode& rNode, +/*[in]*/ RedlineType nType) const = 0; + virtual bool HasRedline( /*[in]*/const SwPaM& rPam, /*[in]*/RedlineType nType, @@ -227,6 +232,10 @@ public: virtual void SetRedlinePassword( /*[in]*/const css::uno::Sequence & rNewPassword) = 0; +virtual void UpdateRedlineContentNode(/*[in]*/ SwRedlineTable::size_type nStartPos, + /*[in]*/ SwRedlineTable::size_type nEndPos) const = 0; + + protected: virtual ~IDocumentRedlineAccess() {}; }; diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 51314f1a7fe1..e2ba9748c503 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2141,8 +2141,17 @@ void DocumentContentOperationsManager::DeleteDummyChar( void DocumentContentOperationsManager::DeleteRange( SwPaM & rPam ) { +// Seek all redlines that are in that PaM to be deleted.. +SwRedlineTable::size_type nRedlStart = m_rDoc.getIDocumentRedlineAccess().GetRedlinePos( +rPam.Start()->GetNode(), RedlineType::Any); +SwRedlineTable::size_type nRedlEnd = m_rDoc.getIDocumentRedlineAccess().GetRedlineEndPos( +nRedlStart, rPam.End()->GetNode(), RedlineType::Any); + lcl_DoWithBreaks(*this, rPam, SwDeleteFlags::Default, &DocumentContentOperationsManager::DeleteRangeImpl); +// update all redlines was in the Pam that is +m_rDoc.getIDocumentRedlineAccess().UpdateRedlineContentNode(nRedlStart, nRedlEnd); + if (!m_rDoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty()) { diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 0a5367e89107..531e76614622 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -53,9 +53,8 @@ using namespace com::sun::star; // 2. check that position is valid and doesn't point after text void lcl_CheckPosition( const SwPosition* pPos ) { -// Commented out because of a random problem, that happened even before my patch -//assert(dynamic_cast(&pPos->GetNode()) -//== pPos->GetContentNode()); +assert(dynamic_cast(&pPos->GetNode()) +== pPos->GetContentNode()); SwTextNode* pTextNode = pPos->GetNode().GetTextNode(); if( pTextNode =
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/uibase/misc/redlndlg.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit 6c3cf5c000ce8c1e82bd834995d1ee52f8c2baeb Author: Attila Szűcs AuthorDate: Wed Oct 25 13:09:22 2023 +0200 Commit: Caolán McNamara CommitDate: Thu Oct 26 09:32:18 2023 +0200 SW: small fix for manage changes dialog. Fixed a continue, as it was planned to effect the outer loop. (probably when it was replaced to an inner loop it was forgot to handle) fixed a nullptr check also. These problems may not result real problem right now, but when interdependedt redlines will be improved, they will result in problems. Change-Id: Ie139f9a657abbacea9450176d2fe138392beddfa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158457 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index de5310de0311..401998451fc4 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -434,13 +434,16 @@ void SwRedlineAcceptDlg::Activate() { while (pRedlineData) { -if (pRedlineData != pBackupData->pChild) +if (!pBackupData || pRedlineData != pBackupData->pChild) { // Redline-Children were inserted, changed or deleted i = CalcDiff(i, true); if (i == SwRedlineTable::npos) return; -continue; + +// here was a continue; targetted to the outer loop +// now a break will do, as there is nothing after it in the outer loop +break; } pBackupData = pBackupData->pNext; pRedlineData = pRedlineData->Next();
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/core/doc/docredln.cxx |8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) New commits: commit 94d578ea6009cfc44cc512171fd453bb0286888b Author: Attila Szűcs AuthorDate: Wed Oct 25 11:40:23 2023 +0200 Commit: Caolán McNamara CommitDate: Thu Oct 26 09:30:11 2023 +0200 tdf#157663 SW: reenable move recognition improvements Re-enabled the improvement of move recognition in redlines, that is able to recognize movements split into more redlines. Probably it does not effect performance too much, but if in some cases it would become a problem then this small patch can be reverted easily. Change-Id: I6598d4d4f98f472f3972aec41b82ec26d90db860 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158455 Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 95498d625c90..4d3493515d6a 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -873,11 +873,7 @@ bool SwRedlineTable::isMoved(size_type rPos) const if (isMovedImpl(rPos, false)) return true; else -{ -// Commented out because of probably performance issue -//return isMovedImpl(rPos, true); -return false; -} +return isMovedImpl(rPos, true); } bool SwRedlineTable::isMovedImpl(size_type rPos, bool bTryCombined) const @@ -947,7 +943,7 @@ bool SwRedlineTable::isMovedImpl(size_type rPos, bool bTryCombined) const size_type nStart = rPos > nLookahead ? rPos - nLookahead : 0; // first, try to compare to single redlines // next, try to compare to combined redlines -for (int nPass = 0; nPass < (bTryCombined ? 2 : 1) && !bRet; nPass++) +for (int nPass = 0; nPass < 2 && !bRet; nPass++) { for (size_type nPosAct = nStart; nPosAct < nEnd && !bRet; ++nPosAct) {
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/xmloff schema/libreoffice sw/inc sw/qa sw/source writerfilter/source xmloff/source
include/xmloff/txtimp.hxx |2 include/xmloff/xmltoken.hxx |1 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |9 sw/inc/IDocumentContentOperations.hxx |2 sw/inc/crsrsh.hxx |2 sw/inc/docary.hxx |8 sw/inc/redline.hxx | 21 sw/inc/unoprnms.hxx |1 sw/qa/extras/layout/layout2.cxx |7 sw/qa/extras/uiwriter/data/tdf157663_redlineMove.odt|binary sw/qa/extras/uiwriter/uiwriter5.cxx | 134 + sw/source/core/doc/DocumentContentOperationsManager.cxx |9 sw/source/core/doc/DocumentRedlineManager.cxx | 201 --- sw/source/core/doc/doccomp.cxx |4 sw/source/core/doc/docnum.cxx |8 sw/source/core/doc/docredln.cxx | 302 +--- sw/source/core/inc/DocumentContentOperationsManager.hxx |2 sw/source/core/inc/DocumentRedlineManager.hxx | 14 sw/source/core/unocore/unocrsrhelper.cxx| 11 sw/source/core/unocore/unoredline.cxx |4 sw/source/filter/basflt/fltshell.cxx|1 sw/source/filter/ww8/writerhelper.cxx |2 sw/source/filter/xml/XMLRedlineImportHelper.cxx | 15 sw/source/filter/xml/XMLRedlineImportHelper.hxx |1 sw/source/filter/xml/xmltexti.cxx |3 sw/source/filter/xml/xmltexti.hxx |1 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 45 + writerfilter/source/dmapper/DomainMapper_Impl.hxx |4 xmloff/source/core/xmltoken.cxx |1 xmloff/source/text/XMLChangeInfoContext.cxx |7 xmloff/source/text/XMLChangeInfoContext.hxx |1 xmloff/source/text/XMLChangedRegionImportContext.cxx|5 xmloff/source/text/XMLChangedRegionImportContext.hxx|3 xmloff/source/text/XMLRedlineExport.cxx |9 xmloff/source/text/txtimp.cxx |1 xmloff/source/token/tokens.txt |1 36 files changed, 663 insertions(+), 179 deletions(-) New commits: commit bf5cbc6adfd7cfcd0d59277a8b1899642038ac88 Author: Attila Szűcs AuthorDate: Tue Oct 17 09:31:22 2023 +0200 Commit: Caolán McNamara CommitDate: Wed Oct 25 09:43:16 2023 +0200 tdf#157663 SW: Tracked change improve move Made accept/reject handle move redlines other pair, (moveto-movefrom) and handle the whole move redline, even if it is split into small pieces that separated from each other. Added unique ID to every move redline to help find their other parts. This move ID is generated in case of: move recognition moveing a paragraph. (directly create move redline with unique id without calling the recognition it is faster and more stable) (there are other cases that could be improved to not use recognition, but generate ID directly, like moveing selected partial text with mouse) Implemented the odt export/import of this move ID. it is a tag like this: "4" next to creator/date Improved the docx import to generate this move ID, so move redlines can find their other parts (Not changed Docx export... it works a bit, but far from perfect) Improved move reckognition: It can find them even if they are split into multiple parts differently. (like "ab"+"cd" == "a"+"bcd") Disabled this because of probably performance issue. made a complex unit test for it. Note: Left the move recognition on every place, to avoid as much regressions as possible.. but in the future, we may can disable it in some cases. Note2: We will have to keep move recognitnion, because there are documents from past, saved without any move informations in the file, and users expect to see move redlines there. (generated by the recognition.) Change-Id: If968d4235b676c5e538cfaf4187a4482a86eae9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157740 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx index 218db6fa7acd..0320c5360aa6 100644 --- a/include/xmloff/txtimp.hxx +++ b/include/xmloff/txtimp.hxx @@ -381,6 +381,8 @@ public: const OUString& rComment, /// date+time const css::util::DateTime& rDateTime, +/// move id, to find other pa
[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source vcl/jsdialog vcl/source
sw/inc/view.hxx|1 + sw/source/uibase/inc/conttree.hxx |3 +++ sw/source/uibase/utlui/content.cxx | 29 + sw/source/uibase/utlui/navipi.cxx | 10 ++ vcl/jsdialog/executor.cxx | 10 ++ vcl/source/treelist/svtabbx.cxx|4 6 files changed, 53 insertions(+), 4 deletions(-) New commits: commit 3649dc202bedf72e37c77993a1f7027bfdfc6d9e Author: Attila Szűcs AuthorDate: Thu Jun 29 18:32:27 2023 +0200 Commit: Caolán McNamara CommitDate: Mon Oct 16 11:39:39 2023 +0200 LOK: Navigator: fix expand problems Save/load content types' expanded status to view, and make sure it is synchronized with client. Treeviews now receive/send collapse event/status from/to client. I've rewritten the way how headings are opened by default (because synch of collapsed status broke that, as sub-headings were not expanded at core side). Change-Id: I80f5b4d99fe5224391a92c4609f94ddbcf37b8ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153771 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar (cherry picked from commit b95750af717e0693a13c3ef3529e1394e0ae) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158016 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index c5967bb4e213..523f86cc8468 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -355,6 +355,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell public: // #i123922# Needs to be called from a 2nd place now as a helper method SAL_DLLPRIVATE bool InsertGraphicDlg( SfxRequest& ); +sal_Int32 m_nNaviExpandedStatus = -1; protected: diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 495cdfa91353..9c6db5b5a5eb 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -274,6 +274,8 @@ public: // return true if it has any children bool RequestingChildren(const weld::TreeIter& rParent); +void ExpandAllHeadings(); + virtual void Notify(SfxBroadcaster& rBC, SfxHint const& rHint) override; sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index d047251ea958..02d3a661e4d1 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1135,6 +1135,12 @@ SwContentTree::SwContentTree(std::unique_ptr xTreeView, SwNaviga OUString sDocTitle = pView->GetDocShell()->GetTitle(); if (lcl_DocOutLineExpandStateMap.find(sDocTitle) != lcl_DocOutLineExpandStateMap.end()) mOutLineNodeMap = lcl_DocOutLineExpandStateMap[sDocTitle]; +if (comphelper::LibreOfficeKit::isActive()) { +if (pView->m_nNaviExpandedStatus < 0) +m_nActiveBlock = 1; +else +m_nActiveBlock = pView->m_nNaviExpandedStatus; +} } m_aUpdTimer.SetInvokeHandler(LINK(this, SwContentTree, TimerUpdate)); @@ -1149,6 +1155,8 @@ SwContentTree::~SwContentTree() { OUString sDocTitle = pView->GetDocShell()->GetTitle(); lcl_DocOutLineExpandStateMap[sDocTitle] = mOutLineNodeMap; +if (comphelper::LibreOfficeKit::isActive()) +pView->m_nNaviExpandedStatus = m_nActiveBlock; } clear(); // If applicable erase content types previously. m_aUpdTimer.Stop(); @@ -2225,6 +2233,19 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent) return false; } +void SwContentTree::ExpandAllHeadings() +{ +if (HasHeadings()) +{ +std::unique_ptr xEntry = GetEntryAtAbsPos(0); +if (xEntry) +{ +if (!IsAllExpanded(*m_xTreeView, *xEntry)) +ExpandOrCollapseAll(*m_xTreeView, *xEntry); +} +} +} + SdrObject* SwContentTree::GetDrawingObjectsByContent(const SwContent *pCnt) { SdrObject *pRetObj = nullptr; diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index c868592e904d..3fd5b7f9b682 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -736,12 +736,11 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xGlobalTree->HideTree(); //Open Headings by default -if (m_xContentTree->HasHeadings()) +SwView *pView = GetCreateView(); +if (pView->m_nNaviExpandedStatus < 0) { -auto& pTreeView = m_xContentTree->get_widget(); -std::unique_ptr itEntry(pTreeView.make_iterator()); -pTreeView.get_iter_first(*itEntry); -pTreeView.expand_row(*itEntry); +pView->m_nNaviExpandedStatus = 1; +m_xContentTree->ExpandAllHeadings(); } } } diff --git a/vcl/jsdial
[Libreoffice-commits] core.git: sw/source
sw/source/uibase/utlui/content.cxx | 29 + 1 file changed, 29 insertions(+) New commits: commit 52500239e8a5a8c897a1af25b40e6b4d004eb21b Author: Attila Szűcs AuthorDate: Thu Jun 8 11:21:16 2023 +0200 Commit: Caolán McNamara CommitDate: Sun Oct 15 11:25:51 2023 +0200 LOK: navigator: hide empty contentTypes In case of LOK, do not insert empty contenttype to tree, and implement new way to find changes in contents, in hidden contentTypes, because the original checked only on the tree. Change-Id: Ib1e4da5e05b2ad4161c6a66a9c54111d558f66f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152735 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar (cherry picked from commit ed3bb61461e4e394bd476b4ec57ff3025eca153f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157983 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 64e2c4aad25b..ca4e431f8038 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include #include @@ -2616,6 +2617,13 @@ void SwContentTree::Display( bool bActive ) OUString aImage(GetImageIdForContentTypeId(nCntType)); bool bChOnDemand = 0 != rpContentT->GetMemberCount(); + +// In case of LOK, empty content types must be hidden in the contenttree +if (comphelper::LibreOfficeKit::isActive() && !bChOnDemand) +{ +continue; +} + OUString sId(weld::toId(rpContentT.get())); insert(nullptr, rpContentT->GetName(), sId, bChOnDemand, xEntry.get()); m_xTreeView->set_image(*xEntry, aImage); @@ -3010,6 +3018,27 @@ bool SwContentTree::HasContentChanged() // is detected only fill member lists for remaining content types. The Display function // will clear and recreate the treeview from the content type member arrays if content has // changed. + +if (comphelper::LibreOfficeKit::isActive()) +{ +// In case of LOK, empty contentTypes are hidden, even in all content view +// so it is not enough to check only the m_xTreeView. +bool bCountChanged = false; +for (ContentTypeId i : o3tl::enumrange()) +{ +if (m_aActiveContentArr[i]) +{ +auto nLastTMCount = m_aActiveContentArr[i]->GetMemberCount(); +m_aActiveContentArr[i]->FillMemberList(); +// If the member count of a type is changed, then the content is surely changed +if (m_aActiveContentArr[i]->GetMemberCount() != nLastTMCount) +bCountChanged = true; +} +} +if (bCountChanged) +return true; +} + std::unique_ptr xEntry(m_xTreeView->make_iterator()); // lambda function to find the next content type entry
[Libreoffice-commits] core.git: sw/inc sw/qa sw/source
sw/inc/IDocumentRedlineAccess.hxx | 16 sw/inc/redline.hxx |2 sw/qa/extras/uiwriter/data/tdf157662_redlineNestedInsertDelete.odt |binary sw/qa/extras/uiwriter/uiwriter5.cxx| 62 ++ sw/source/core/doc/DocumentRedlineManager.cxx | 274 +- sw/source/core/doc/docredln.cxx| 35 + sw/source/core/edit/edredln.cxx|4 sw/source/core/inc/DocumentRedlineManager.hxx | 19 sw/source/core/inc/UndoCore.hxx|4 sw/source/core/inc/UndoRedline.hxx | 10 sw/source/core/undo/undobj.cxx |4 sw/source/core/undo/unredln.cxx| 25 12 files changed, 419 insertions(+), 36 deletions(-) New commits: commit 52fa7aed48632166e064e6a227e034f0981c4205 Author: Attila Szűcs AuthorDate: Mon Aug 28 07:40:20 2023 +0200 Commit: Caolán McNamara CommitDate: Sat Oct 14 11:55:27 2023 +0200 tdf#157662 SW: redline: accept/reject done for all parts Tracked changes divided into smaller parts when they are overlapping. But if the Author, and Change time, and some more is equal, then they can be combined into 1 change later.. Modified AcceptRedline / RejectRedline, to seek for all these parts that are neightbour to each other, and can be combined, and reject/accept them all at once. Even those that are deepen in the tree. i.e.: insert that have a delete redline too. when rejecting an insert redline, that have a delete redline too, the delete redline is accepted instead. (have the same result.) when accepting an insert redline, that have a delete redline too, The delete redline remains, while the insert is deleted. (=accepted) made some limitations to lessen the probability of regression: No anonym, No table, No seqNo, and dont use it in RejectAll/AcceptAll Added unittest to check that accept/reject handle more redlines at once, but not too many.. Change-Id: Ibd0a39f7847b22b279a797babb30ba162e70a513 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157950 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx index 73f87fa8c799..c2b71aa1005a 100644 --- a/sw/inc/IDocumentRedlineAccess.hxx +++ b/sw/inc/IDocumentRedlineAccess.hxx @@ -183,15 +183,23 @@ public: virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0; -virtual bool AcceptRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0; +virtual bool AcceptRedline(/*[in]*/ SwRedlineTable::size_type nPos, /*[in]*/ bool bCallDelete, + /*[in]*/ bool bRange = false) += 0; -virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0; +virtual bool AcceptRedline(/*[in]*/ const SwPaM& rPam, /*[in]*/ bool bCallDelete, + /*[in]*/ sal_Int8 nDepth = 0) += 0; virtual void AcceptRedlineParagraphFormatting(/*[in]*/const SwPaM& rPam ) = 0; -virtual bool RejectRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0; +virtual bool RejectRedline(/*[in]*/ SwRedlineTable::size_type nPos, + /*[in]*/ bool bCallDelete, /*[in]*/ bool bRange = false) += 0; -virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0; +virtual bool RejectRedline(/*[in]*/ const SwPaM& rPam, /*[in]*/ bool bCallDelete, + /*[in]*/ sal_Int8 nDepth = 0) += 0; virtual const SwRangeRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0; diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index 7ef6b9cad20f..d8eba6480618 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -144,6 +144,7 @@ public: void SetMoved() { m_bMoved = true; } bool IsMoved() const { return m_bMoved; } bool CanCombine( const SwRedlineData& rCmp ) const; +bool CanCombineForAcceptReject( const SwRedlineData& rCmp ) const; // ExtraData gets copied, the pointer is therefore not taken over by // the RedlineObject @@ -261,6 +262,7 @@ public: void PushData( const SwRangeRedline& rRedl, bool bOwnAsNext = true ); bool PopData(); +bool PopAllDataAfter(int depth); /** Returns textual description of a redline data element of diff --git a/sw/qa/extras/uiwriter/data/tdf157662_redlineNestedInsertDelete.odt b/sw/qa/extras/uiwriter/data/tdf157662_redlineNestedInsertDelete.odt new file mode 100644 index ..d97521559a84 Binary files /dev/nu
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/inc sw/qa sw/source
sw/inc/IDocumentRedlineAccess.hxx | 16 sw/inc/redline.hxx |2 sw/qa/extras/uiwriter/data/tdf157662_redlineNestedInsertDelete.odt |binary sw/qa/extras/uiwriter/uiwriter5.cxx| 62 ++ sw/source/core/doc/DocumentRedlineManager.cxx | 274 +- sw/source/core/doc/docredln.cxx| 35 + sw/source/core/edit/edredln.cxx|4 sw/source/core/inc/DocumentRedlineManager.hxx | 19 sw/source/core/inc/UndoCore.hxx|4 sw/source/core/inc/UndoRedline.hxx | 10 sw/source/core/undo/undobj.cxx |4 sw/source/core/undo/unredln.cxx| 25 12 files changed, 419 insertions(+), 36 deletions(-) New commits: commit 4fccf983f0750a576fc99712877e41fb34300897 Author: Attila Szűcs AuthorDate: Mon Aug 28 07:40:20 2023 +0200 Commit: Caolán McNamara CommitDate: Fri Oct 13 13:51:44 2023 +0200 tdf#157662 SW: redline: accept/reject done for all parts Tracked changes divided into smaller parts when they are overlapping. But if the Author, and Change time, and some more is equal, then they can be combined into 1 change later.. Modified AcceptRedline / RejectRedline, to seek for all these parts that are neightbour to each other, and can be combined, and reject/accept them all at once. Even those that are deepen in the tree. i.e.: insert that have a delete redline too. when rejecting an insert redline, that have a delete redline too, the delete redline is accepted instead. (have the same result.) when accepting an insert redline, that have a delete redline too, The delete redline remains, while the insert is deleted. (=accepted) made some limitations to lessen the probability of regression: No anonym, No table, No seqNo, and dont use it in RejectAll/AcceptAll Added unittest to check that accept/reject handle more redlines at once, but not too many.. Change-Id: Ibd0a39f7847b22b279a797babb30ba162e70a513 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156179 Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx index 24073b25930c..f5367715354f 100644 --- a/sw/inc/IDocumentRedlineAccess.hxx +++ b/sw/inc/IDocumentRedlineAccess.hxx @@ -184,15 +184,23 @@ public: virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0; -virtual bool AcceptRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0; +virtual bool AcceptRedline(/*[in]*/ SwRedlineTable::size_type nPos, /*[in]*/ bool bCallDelete, + /*[in]*/ bool bRange = false) += 0; -virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0; +virtual bool AcceptRedline(/*[in]*/ const SwPaM& rPam, /*[in]*/ bool bCallDelete, + /*[in]*/ sal_Int8 nDepth = 0) += 0; virtual void AcceptRedlineParagraphFormatting(/*[in]*/const SwPaM& rPam ) = 0; -virtual bool RejectRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0; +virtual bool RejectRedline(/*[in]*/ SwRedlineTable::size_type nPos, + /*[in]*/ bool bCallDelete, /*[in]*/ bool bRange = false) += 0; -virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0; +virtual bool RejectRedline(/*[in]*/ const SwPaM& rPam, /*[in]*/ bool bCallDelete, + /*[in]*/ sal_Int8 nDepth = 0) += 0; virtual const SwRangeRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0; diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index 1fccb405e192..8dfb81fd140b 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -144,6 +144,7 @@ public: void SetMoved() { m_bMoved = true; } bool IsMoved() const { return m_bMoved; } bool CanCombine( const SwRedlineData& rCmp ) const; +bool CanCombineForAcceptReject( const SwRedlineData& rCmp ) const; // ExtraData gets copied, the pointer is therefore not taken over by // the RedlineObject @@ -259,6 +260,7 @@ public: void PushData( const SwRangeRedline& rRedl, bool bOwnAsNext = true ); bool PopData(); +bool PopAllDataAfter(int depth); /** Returns textual description of a redline data element of diff --git a/sw/qa/extras/uiwriter/data/tdf157662_redlineNestedInsertDelete.odt b/sw/qa/extras/uiwriter/data/tdf157662_redlineNestedInsertDelete.odt new file mode 100644 index ..d97521559
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/sfx2 officecfg/registry sc/inc sc/qa sc/source sc/uiconfig
include/sfx2/docfilt.hxx |1 officecfg/registry/schema/org/openoffice/Office/Calc.xcs |7 sc/inc/appoptio.hxx |4 sc/inc/sc.hrc |1 sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py | 124 ++ sc/source/core/tool/appoptio.cxx | 13 + sc/source/ui/app/scmod.cxx| 10 + sc/source/ui/inc/editsh.hxx |1 sc/source/ui/inc/tpcompatibility.hxx |1 sc/source/ui/optdlg/tpcompatibility.cxx | 15 + sc/source/ui/view/editsh.cxx | 95 +- sc/uiconfig/scalc/ui/optcompatibilitypage.ui | 60 ++ 12 files changed, 316 insertions(+), 16 deletions(-) New commits: commit e75f5bdaea570696e1a4fad9c95310781bf60009 Author: Attila Szűcs AuthorDate: Mon Jul 31 04:37:07 2023 +0200 Commit: Andras Timar CommitDate: Sat Aug 26 11:34:38 2023 +0200 tdf#156611 SC: hyperlink option for MS behaviour Added an options that can limit Calc to behave like MS excel in case of inserting hyperlinks, when MS format document is used. Tools -> Options -> LibreOfficeDev Calc -> Compatibility -> Hyperlinks In MS excel, only cells can have a hyperlink, and only 1. In Calc even textfields in a cell can have hyperlinks, so it can have multiple links in a cell, but once saved as MS format, and reloaded, textfield links will become cell links, if there was 1 link in the cell. If there was more links in the cell, then all will be lost. So, when MS excel format document is edited in calc, the ability to make text field links is useless can be missleading, and confuse users. If this option is set, and an MS file format is opened, then insering a hyperlink will work like if we selected the whole cell to insert the hyperlink. Change-Id: I7174216d10cf250d48f23f71ae681c46f7610bbc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155079 Tested-by: Jenkins Reviewed-by: Caolán McNamara Reviewed-by: Tomaž Vajngerl (cherry picked from commit 24cd55341bc3f3e8ed9d5ff23efd47a53532f283) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156009 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/include/sfx2/docfilt.hxx b/include/sfx2/docfilt.hxx index 9dbbb37b87d2..45dd0efb9b29 100644 --- a/include/sfx2/docfilt.hxx +++ b/include/sfx2/docfilt.hxx @@ -80,6 +80,7 @@ public: bool GetSupportsSigning() const { return bool(nFormatType & SfxFilterFlags::SUPPORTSSIGNING); } bool GetGpgEncryption() const { return bool(nFormatType & SfxFilterFlags::GPGENCRYPTION); } bool IsOwnTemplateFormat() const { return bool(nFormatType & SfxFilterFlags::TEMPLATEPATH); } +bool IsMSOFormat() const { return aTypeName.startsWith("MS"); } /// not our built-in format bool IsAlienFormat() const { return bool(nFormatType & SfxFilterFlags::ALIEN); } /// an unusual/legacy file to be loading diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs index dce8685a0a05..030cc51733ac 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs @@ -1864,6 +1864,13 @@ + + + Insert link for the cell, instead of text fields in a cell.(Excel iteropability options) + Links like Excel + +false + diff --git a/sc/inc/appoptio.hxx b/sc/inc/appoptio.hxx index 793dc707a67f..d9e22c9cba78 100644 --- a/sc/inc/appoptio.hxx +++ b/sc/inc/appoptio.hxx @@ -77,6 +77,9 @@ public: ScOptionsUtil::KeyBindingType GetKeyBindingType() const { return meKeyBindingType; } voidSetKeyBindingType( ScOptionsUtil::KeyBindingType e ) { meKeyBindingType = e; } +voidSetLinksInsertedLikeMSExcel(bool bNew) { mbLinksInsertedLikeMSExcel = bNew; } +boolGetLinksInsertedLikeMSExcel() const { return mbLinksInsertedLikeMSExcel; } + ScAppOptions& operator= ( const ScAppOptions& rOpt ); private: @@ -99,6 +102,7 @@ private: sal_Int32 nDefaultObjectSizeHeight; boolmbShowSharedDocumentWarning; ScOptionsUtil::KeyBindingType meKeyBindingType; +boolmbLinksInsertedLikeMSExcel; }; // Config Item containing app options diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 39892c4fb6ec..fa9b55dd8c87 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -621,6 +621,7 @@ static_assert(SID_PREVIEW_END < SID_KEYFUNC_START, "calc slots ids trampling inf #define SID_GROUP_SPARKLINES(SID_NEW_SLOTS+114) #define SI
[Libreoffice-commits] core.git: include/sfx2 officecfg/registry sc/inc sc/qa sc/source sc/uiconfig
include/sfx2/docfilt.hxx |1 officecfg/registry/schema/org/openoffice/Office/Calc.xcs |7 sc/inc/appoptio.hxx |4 sc/inc/sc.hrc |1 sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py | 124 ++ sc/source/core/tool/appoptio.cxx | 13 + sc/source/ui/app/scmod.cxx| 10 + sc/source/ui/inc/editsh.hxx |1 sc/source/ui/inc/tpcompatibility.hxx |1 sc/source/ui/optdlg/tpcompatibility.cxx | 15 + sc/source/ui/view/editsh.cxx | 95 +- sc/uiconfig/scalc/ui/optcompatibilitypage.ui | 60 ++ 12 files changed, 316 insertions(+), 16 deletions(-) New commits: commit 24cd55341bc3f3e8ed9d5ff23efd47a53532f283 Author: Attila Szűcs AuthorDate: Mon Jul 31 04:37:07 2023 +0200 Commit: Tomaž Vajngerl CommitDate: Wed Aug 23 15:23:16 2023 +0200 tdf#156611 SC: hyperlink option for MS behaviour Added an options that can limit Calc to behave like MS excel in case of inserting hyperlinks, when MS format document is used. Tools -> Options -> LibreOfficeDev Calc -> Compatibility -> Hyperlinks In MS excel, only cells can have a hyperlink, and only 1. In Calc even textfields in a cell can have hyperlinks, so it can have multiple links in a cell, but once saved as MS format, and reloaded, textfield links will become cell links, if there was 1 link in the cell. If there was more links in the cell, then all will be lost. So, when MS excel format document is edited in calc, the ability to make text field links is useless can be missleading, and confuse users. If this option is set, and an MS file format is opened, then insering a hyperlink will work like if we selected the whole cell to insert the hyperlink. Change-Id: I7174216d10cf250d48f23f71ae681c46f7610bbc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155079 Tested-by: Jenkins Reviewed-by: Caolán McNamara Reviewed-by: Tomaž Vajngerl diff --git a/include/sfx2/docfilt.hxx b/include/sfx2/docfilt.hxx index 9dbbb37b87d2..45dd0efb9b29 100644 --- a/include/sfx2/docfilt.hxx +++ b/include/sfx2/docfilt.hxx @@ -80,6 +80,7 @@ public: bool GetSupportsSigning() const { return bool(nFormatType & SfxFilterFlags::SUPPORTSSIGNING); } bool GetGpgEncryption() const { return bool(nFormatType & SfxFilterFlags::GPGENCRYPTION); } bool IsOwnTemplateFormat() const { return bool(nFormatType & SfxFilterFlags::TEMPLATEPATH); } +bool IsMSOFormat() const { return aTypeName.startsWith("MS"); } /// not our built-in format bool IsAlienFormat() const { return bool(nFormatType & SfxFilterFlags::ALIEN); } /// an unusual/legacy file to be loading diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs index eff7ac7aa80a..a41de7a36b8a 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs @@ -1861,6 +1861,13 @@ + + + Insert link for the cell, instead of text fields in a cell.(Excel iteropability options) + Links like Excel + +false + diff --git a/sc/inc/appoptio.hxx b/sc/inc/appoptio.hxx index 793dc707a67f..d9e22c9cba78 100644 --- a/sc/inc/appoptio.hxx +++ b/sc/inc/appoptio.hxx @@ -77,6 +77,9 @@ public: ScOptionsUtil::KeyBindingType GetKeyBindingType() const { return meKeyBindingType; } voidSetKeyBindingType( ScOptionsUtil::KeyBindingType e ) { meKeyBindingType = e; } +voidSetLinksInsertedLikeMSExcel(bool bNew) { mbLinksInsertedLikeMSExcel = bNew; } +boolGetLinksInsertedLikeMSExcel() const { return mbLinksInsertedLikeMSExcel; } + ScAppOptions& operator= ( const ScAppOptions& rOpt ); private: @@ -99,6 +102,7 @@ private: sal_Int32 nDefaultObjectSizeHeight; boolmbShowSharedDocumentWarning; ScOptionsUtil::KeyBindingType meKeyBindingType; +boolmbLinksInsertedLikeMSExcel; }; // Config Item containing app options diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 534ff7ab6795..d1b13b767eb0 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -621,6 +621,7 @@ static_assert(SID_PREVIEW_END < SID_KEYFUNC_START, "calc slots ids trampling inf #define SID_GROUP_SPARKLINES(SID_NEW_SLOTS+114) #define SID_UNGROUP_SPARKLINES (SID_NEW_SLOTS+115) #define SID_EDIT_SPARKLINE (SID_NEW_SLOTS+116) +#define SID_SC_OPT_LINKSTypedWhichId(SID_NEW_SLOTS + 117) // idl parameter diff --git a/sc/qa/
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/uibase/utlui/navipi.cxx | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) New commits: commit a4d6f4183ba76c3d03312a9ed16f286e60e3a7c5 Author: Attila Szűcs AuthorDate: Mon Aug 7 04:00:39 2023 +0200 Commit: Caolán McNamara CommitDate: Thu Aug 17 15:07:48 2023 +0200 SW: LOK: crashfix for ios navigator Added conditions to check if m_pNavigateByComboBox exist, because on ios, navigator does not have thit combobox. Change-Id: If5411a1687338caaa9fd76ae5471be4648ab61de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155388 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit c6250e82472f0d36c0c0c4b33c76882c94da8170) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155771 Tested-by: Jenkins CollaboraOffice diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 0f6d2ac78923..bd53813ac64b 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -132,6 +132,8 @@ IMPL_LINK(SwNavigationPI, DocListBoxSelectHdl, weld::ComboBox&, rBox, void) void SwNavigationPI::UpdateNavigateBy() { +if (!m_pNavigateByComboBox) +return; SfxUInt32Item aParam(FN_NAV_ELEMENT, m_pNavigateByComboBox->get_active_id().toUInt32()); const SfxPoolItem* aArgs[2]; aArgs[0] = &aParam; @@ -543,8 +545,17 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xContent2Dispatch->GetControllerForCommand(".uno:NavElement"); NavElementToolBoxControl* pToolBoxControl = dynamic_cast(xController.get()); -assert(pToolBoxControl); -m_pNavigateByComboBox = pToolBoxControl->GetComboBox(); + +// In case of LOK, the xController may not a NavElementToolBoxControl +if (comphelper::LibreOfficeKit::isActive() && !pToolBoxControl) +{ +m_pNavigateByComboBox = nullptr; +} +else +{ +assert(pToolBoxControl); +m_pNavigateByComboBox = pToolBoxControl->GetComboBox(); +} // Restore content tree settings before calling UpdateInitShow. UpdateInitShow calls Fillbox, // which calls Display and UpdateTracking. Incorrect outline levels could be displayed and @@ -652,7 +663,9 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xInsertMenu->connect_activate(LINK(this, SwNavigationPI, GlobalMenuSelectHdl)); m_xGlobalToolBox->connect_menu_toggled(LINK(this, SwNavigationPI, ToolBoxClickHdl)); m_xGlobalToolBox->set_item_active("globaltoggle", true); -m_pNavigateByComboBox->connect_changed(LINK(this, SwNavigationPI, NavigateByComboBoxSelectHdl)); +if (m_pNavigateByComboBox) +m_pNavigateByComboBox->connect_changed( +LINK(this, SwNavigationPI, NavigateByComboBoxSelectHdl)); // set toolbar of both modes to widest of each m_xGlobalToolBox->set_size_request(m_xContent1ToolBox->get_preferred_size().Width() + @@ -1138,6 +1151,8 @@ IMPL_LINK_NOARG(SwNavigationPI, ChangePageHdl, Timer *, void) void SwNavigationPI::SelectNavigateByContentType(const OUString& rContentTypeName) { +if (!m_pNavigateByComboBox) +return; if (auto nPos = m_pNavigateByComboBox->find_text(rContentTypeName); nPos != -1) { m_pNavigateByComboBox->set_active(nPos);
[Libreoffice-commits] core.git: sw/source
sw/source/uibase/utlui/navipi.cxx | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) New commits: commit c6250e82472f0d36c0c0c4b33c76882c94da8170 Author: Attila Szűcs AuthorDate: Mon Aug 7 04:00:39 2023 +0200 Commit: Caolán McNamara CommitDate: Thu Aug 17 14:08:18 2023 +0200 SW: LOK: crashfix for ios navigator Added conditions to check if m_pNavigateByComboBox exist, because on ios, navigator does not have thit combobox. Change-Id: If5411a1687338caaa9fd76ae5471be4648ab61de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155388 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 2506b5c83793..460d4347766f 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -132,6 +132,8 @@ IMPL_LINK(SwNavigationPI, DocListBoxSelectHdl, weld::ComboBox&, rBox, void) void SwNavigationPI::UpdateNavigateBy() { +if (!m_pNavigateByComboBox) +return; SfxUInt32Item aParam(FN_NAV_ELEMENT, m_pNavigateByComboBox->get_active_id().toUInt32()); const SfxPoolItem* aArgs[2]; aArgs[0] = &aParam; @@ -571,8 +573,17 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xContent2Dispatch->GetControllerForCommand(".uno:NavElement"); NavElementToolBoxControl* pToolBoxControl = dynamic_cast(xController.get()); -assert(pToolBoxControl); -m_pNavigateByComboBox = pToolBoxControl->GetComboBox(); + +// In case of LOK, the xController may not a NavElementToolBoxControl +if (comphelper::LibreOfficeKit::isActive() && !pToolBoxControl) +{ +m_pNavigateByComboBox = nullptr; +} +else +{ +assert(pToolBoxControl); +m_pNavigateByComboBox = pToolBoxControl->GetComboBox(); +} // Restore content tree settings before calling UpdateInitShow. UpdateInitShow calls Fillbox, // which calls Display and UpdateTracking. Incorrect outline levels could be displayed and @@ -681,7 +692,9 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xInsertMenu->connect_activate(LINK(this, SwNavigationPI, GlobalMenuSelectHdl)); m_xGlobalToolBox->connect_menu_toggled(LINK(this, SwNavigationPI, ToolBoxClickHdl)); m_xGlobalToolBox->set_item_active("globaltoggle", true); -m_pNavigateByComboBox->connect_changed(LINK(this, SwNavigationPI, NavigateByComboBoxSelectHdl)); +if (m_pNavigateByComboBox) +m_pNavigateByComboBox->connect_changed( +LINK(this, SwNavigationPI, NavigateByComboBoxSelectHdl)); // set toolbar of both modes to widest of each m_xGlobalToolBox->set_size_request(m_xContent1ToolBox->get_preferred_size().Width() + @@ -1159,6 +1172,8 @@ IMPL_LINK_NOARG(SwNavigationPI, ChangePageHdl, Timer *, void) void SwNavigationPI::SelectNavigateByContentType(const OUString& rContentTypeName) { +if (!m_pNavigateByComboBox) +return; if (auto nPos = m_pNavigateByComboBox->find_text(rContentTypeName); nPos != -1) { m_pNavigateByComboBox->set_active(nPos);
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/inc sw/source vcl/jsdialog vcl/source
sw/inc/view.hxx|1 + sw/source/uibase/inc/conttree.hxx |2 ++ sw/source/uibase/utlui/content.cxx | 21 + sw/source/uibase/utlui/navipi.cxx |9 - vcl/jsdialog/executor.cxx | 10 ++ vcl/source/treelist/svtabbx.cxx|4 6 files changed, 42 insertions(+), 5 deletions(-) New commits: commit b95750af717e0693a13c3ef3529e1394e0ae Author: Attila Szűcs AuthorDate: Thu Jun 29 18:32:27 2023 +0200 Commit: Andras Timar CommitDate: Sat Jul 1 16:51:44 2023 +0200 LOK: Navigator: fix expand problems Save/load content types' expanded status to view, and make sure it is synchronized with client. Treeviews now receive/send collapse event/status from/to client. I've rewritten the way how headings are opened by default (because synch of collapsed status broke that, as sub-headings were not expanded at core side). Change-Id: I80f5b4d99fe5224391a92c4609f94ddbcf37b8ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153771 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index b556c2c53f39..9e31e337206b 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -350,6 +350,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell public: // #i123922# Needs to be called from a 2nd place now as a helper method SAL_DLLPRIVATE bool InsertGraphicDlg( SfxRequest& ); +sal_Int32 m_nNaviExpandedStatus = -1; protected: diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index e2cf31028171..c397a15bb20b 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -266,6 +266,8 @@ public: // return true if it has any children bool RequestingChildren(const weld::TreeIter& rParent); +void ExpandAllHeadings(); + virtual void Notify(SfxBroadcaster& rBC, SfxHint const& rHint) override; sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 5367627cad03..c837124b723c 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1130,6 +1130,12 @@ SwContentTree::SwContentTree(std::unique_ptr xTreeView, SwNaviga OUString sDocTitle = pView->GetDocShell()->GetTitle(); if (lcl_DocOutLineExpandStateMap.find(sDocTitle) != lcl_DocOutLineExpandStateMap.end()) mOutLineNodeMap = lcl_DocOutLineExpandStateMap[sDocTitle]; +if (comphelper::LibreOfficeKit::isActive()) { +if (pView->m_nNaviExpandedStatus < 0) +m_nActiveBlock = 1; +else +m_nActiveBlock = pView->m_nNaviExpandedStatus; +} } m_aUpdTimer.SetInvokeHandler(LINK(this, SwContentTree, TimerUpdate)); @@ -1144,6 +1150,8 @@ SwContentTree::~SwContentTree() { OUString sDocTitle = pView->GetDocShell()->GetTitle(); lcl_DocOutLineExpandStateMap[sDocTitle] = mOutLineNodeMap; +if (comphelper::LibreOfficeKit::isActive()) +pView->m_nNaviExpandedStatus = m_nActiveBlock; } clear(); // If applicable erase content types previously. m_aUpdTimer.Stop(); @@ -2177,6 +2185,19 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent) return bChild; } +void SwContentTree::ExpandAllHeadings() +{ +if (HasHeadings()) +{ +std::unique_ptr xEntry = GetEntryAtAbsPos(0); +if (xEntry) +{ +if (!IsAllExpanded(*m_xTreeView, *xEntry)) +ExpandOrCollapseAll(*m_xTreeView, *xEntry); +} +} +} + SdrObject* SwContentTree::GetDrawingObjectsByContent(const SwContent *pCnt) { SdrObject *pRetObj = nullptr; diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index fb3f461f8f64..0f6d2ac78923 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -694,12 +694,11 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xGlobalTree->HideTree(); //Open Headings by default -if (m_xContentTree->HasHeadings()) +SwView *pView = GetCreateView(); +if (pView->m_nNaviExpandedStatus < 0) { -auto& pTreeView = m_xContentTree->get_widget(); -std::unique_ptr itEntry(pTreeView.make_iterator()); -pTreeView.get_iter_first(*itEntry); -pTreeView.expand_row(*itEntry); +pView->m_nNaviExpandedStatus = 1; +m_xContentTree->ExpandAllHeadings(); } } } diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index 1accb3bc1de0..750b10c0b606 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -474,6 +474,16 @@ bool ExecuteAction(const std::string&
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/uibase/inc/conttree.hxx |1 + sw/source/uibase/utlui/content.cxx |8 sw/source/uibase/utlui/navipi.cxx | 11 +++ 3 files changed, 16 insertions(+), 4 deletions(-) New commits: commit 61e2022110d3088bc1653713dc270beaacae4c74 Author: Attila Szűcs AuthorDate: Fri Jun 9 05:56:31 2023 +0200 Commit: Andras Timar CommitDate: Fri Jun 9 07:29:30 2023 +0200 LOK: fix for navigator: hide empty contentTypes fixed that opening heading by default, first check if headings are not hidden, because it blindly opened the 1. type, but from now, that can be an other type, or nothing Change-Id: I86cac472d8cba9a46befc5a84ef073c01fa7243d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152779 Tested-by: Andras Timar Reviewed-by: Andras Timar diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index ec0dbc7c84e8..e2cf31028171 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -236,6 +236,7 @@ public: { return State::HIDDEN == m_eState ? m_pHiddenShell : m_pActiveShell; } boolIsInDrag() const; +boolHasHeadings() const; sal_uInt8 GetOutlineLevel()const {return m_nOutlineLevel;} voidSetOutlineLevel(sal_uInt8 nSet); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 6325347a930e..5367627cad03 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1256,6 +1256,14 @@ bool SwContentTree::IsInDrag() const return m_xTreeView->get_drag_source() == m_xTreeView.get(); } +bool SwContentTree::HasHeadings() const +{ +const std::unique_ptr& rpContentT = m_aActiveContentArr[ContentTypeId::OUTLINE]; +if (rpContentT && rpContentT->GetMemberCount() > 0) +return true; +return false; +} + // QueryDrop will be executed in the navigator sal_Int8 SwContentTree::AcceptDrop(const AcceptDropEvent& rEvt) { diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 61ada3408bbc..fb3f461f8f64 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -694,10 +694,13 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xGlobalTree->HideTree(); //Open Headings by default -auto& pTreeView = m_xContentTree->get_widget(); -std::unique_ptr itEntry(pTreeView.make_iterator()); -pTreeView.get_iter_first(*itEntry); -pTreeView.expand_row(*itEntry); +if (m_xContentTree->HasHeadings()) +{ +auto& pTreeView = m_xContentTree->get_widget(); +std::unique_ptr itEntry(pTreeView.make_iterator()); +pTreeView.get_iter_first(*itEntry); +pTreeView.expand_row(*itEntry); +} } }
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/uibase/utlui/content.cxx | 30 ++ 1 file changed, 30 insertions(+) New commits: commit ed3bb61461e4e394bd476b4ec57ff3025eca153f Author: Attila Szűcs AuthorDate: Thu Jun 8 11:21:16 2023 +0200 Commit: Andras Timar CommitDate: Thu Jun 8 21:51:43 2023 +0200 LOK: navigator: hide empty contentTypes In case of LOK, do not insert empty contenttype to tree, and implement new way to find changes in contents, in hidden contentTypes, because the original checked only on the tree. Change-Id: Ib1e4da5e05b2ad4161c6a66a9c54111d558f66f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152735 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index c54ec983d157..6325347a930e 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -111,6 +111,8 @@ #include #include +#include + #define CTYPE_CNT 0 #define CTYPE_CTT 1 @@ -2544,6 +2546,13 @@ void SwContentTree::Display( bool bActive ) OUString aImage(GetImageIdForContentTypeId(nCntType)); bool bChOnDemand = 0 != rpContentT->GetMemberCount(); + +// In case of LOK, empty content types must be hidden in the contenttree +if (comphelper::LibreOfficeKit::isActive() && !bChOnDemand) +{ +continue; +} + OUString sId(weld::toId(rpContentT.get())); insert(nullptr, rpContentT->GetName(), sId, bChOnDemand, xEntry.get()); m_xTreeView->set_image(*xEntry, aImage); @@ -2947,6 +2956,27 @@ bool SwContentTree::HasContentChanged() // is detected only fill member lists for remaining content types. The Display function // will clear and recreate the treeview from the content type member arrays if content has // changed. + +if (comphelper::LibreOfficeKit::isActive()) +{ +// In case of LOK, empty contentTypes are hidden, even in all content view +// so it is not enough to check only the m_xTreeView. +bool bCountChanged = false; +for (ContentTypeId i : o3tl::enumrange()) +{ +if (m_aActiveContentArr[i]) +{ +auto nLastTMCount = m_aActiveContentArr[i]->GetMemberCount(); +m_aActiveContentArr[i]->FillMemberList(); +// If the member count of a type is changed, then the content is surely changed +if (m_aActiveContentArr[i]->GetMemberCount() != nLastTMCount) +bCountChanged = true; +} +} +if (bCountChanged) +return true; +} + std::unique_ptr xEntry(m_xTreeView->make_iterator()); // lambda function to find the next content type entry
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/uibase/utlui/navipi.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 09c40d669cac5f167fa68cb5c6ad94a6a9e2a844 Author: Attila Szűcs AuthorDate: Thu May 18 10:36:38 2023 +0200 Commit: Szymon Kłos CommitDate: Mon May 22 15:26:34 2023 +0200 LOK: Navigator: headings expanded by default Called an expand_row for the first element of the contetnTree in the navigator constructor. Right now contructor is called every time when navigator is opened, it may change later. (desktop app do it only if navigator opens in a new window, not on sidebar) Change-Id: Ibe4b71e6a6ddb573269178f83c295b0c2cbd53b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151939 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 99f87a13a055..61ada3408bbc 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -692,6 +692,12 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xGlobalBox->hide(); m_xGlobalToolBox->hide(); m_xGlobalTree->HideTree(); + +//Open Headings by default +auto& pTreeView = m_xContentTree->get_widget(); +std::unique_ptr itEntry(pTreeView.make_iterator()); +pTreeView.get_iter_first(*itEntry); +pTreeView.expand_row(*itEntry); } }
Re: package / tmp file usage ...
Thx Michael, you are right, if an other thread would deflate (to disk) while SvXMLExport create the xml stream (in memory), and they would keep the memory stream under a size limitation, then it would be great. I seen this producer / consumer pattern like thing in XBufferedThreadedStream .. and it is called in import time from ScXMLImportWrapper. (i do not rechecked it now.. somehow i remember that still wrote the stream into a file) But in this export case, as i seen, the same thread do both of them, and deflate started only after SvXMLExport finished. the idea of having ready deflated streams on disk to pack into the zip archive sounds good, i bet in basic cases it is not a problem... im not sure about complex cases, like encription On Wednesday, May 17, 2023 16:46 BST, Michael Meeks wrote: On 17/05/2023 15:42, Attila Szűcs wrote: > I can see this file on my hard drive, so it is really here. > i can view its content and it is a half made xml file > content.xml (the whole file) ~110mb big, but the compressed ods is only > ~670kb. > so if it would be stored only in memory, we could avoid a lot of disk > writing. Streaming to a file is fine - and in fact good =) -but- I expect that if we have another thread that deflates this as we do the streaming out - then we could save quite a chunk of I/O I think and perhaps get the compression 'for free' (and deflate is far from free unfortunately). Of course, the idea of having ready deflated streams on disk to pack into the zip archive may not fit perfectly into whatever conceptual model but ... =) > i can understand that in most cases this extra file is not a big > problem... and when the file is big enought to be a problem, than maybe > the memory could be a bigger problem.. :) =) Michael. -- michael.me...@collabora.com <><, GM Collabora Productivity Hangout: mejme...@gmail.com, Skype: mmeeks (M) +44 7795 666 147 - timezone usually UK / Europe
Re: package / tmp file usage ...
i just re-created the situation, and here is a callstack (made in windows), when i save_as an ods file. it writes (still uncomressed) data to a stream, but that stream is a file on my harddrive: C:\\Users\\Szucsi\\AppData\\Local\\Temp\\lu99163n3gde.tmp\\lu9916{8AA24C62-674C-4CFF-BB49-581F27614405}.tmp > mergedlo.dll!utl::OSeekableInputStreamWrapper::seek(__int64 _nLocation) >Line 179 C++ mergedlo.dll!OWriteStream::writeBytes(const com::sun::star::uno::Sequence & aData) Line 2057 C++ expwraplo.dll!`anonymous namespace'::SaxWriterHelper::writeSequence() Line 231 C++ expwraplo.dll!`anonymous namespace'::SaxWriterHelper::convertToXML(const char16_t * pStr, long nStrLen, bool bDoNormalization, bool bNormalizeWhitespace, char * pTarget, unsigned long & rPos) Line 527 C++ expwraplo.dll!`anonymous namespace'::SaxWriterHelper::writeString(const rtl::OUString & rWriteOutString, bool bDoNormalization, bool bNormalizeWhitespace) Line 601 C++ expwraplo.dll!`anonymous namespace'::SaxWriterHelper::startElement(const rtl::OUString & rName, const com::sun::star::uno::Reference & xAttribs) Line 711 C++ expwraplo.dll!`anonymous namespace'::SAXWriter::startElement(const rtl::OUString & aName, const com::sun::star::uno::Reference & xAttribs) Line 1207 C++ mergedlo.dll!SvXMLExport::StartElement(const rtl::OUString & rName, bool bIgnWSOutside) Line 2111 C++ mergedlo.dll!SvXMLElementExport::SvXMLElementExport(SvXMLExport & rExp, const rtl::OUString & rQName, bool bIWSOutside, bool bIWSInside) Line 2460 C++ sclo.dll!ScXMLExport::WriteCell(ScMyCell & aCell, long nEqualCellCount) Line 3268 C++ sclo.dll!ScXMLExport::WriteTable(long nTable, const com::sun::star::uno::Reference & xTable) Line 2962 C++ sclo.dll!ScXMLExport::ExportContent_() Line 1943 C++ mergedlo.dll!SvXMLExport::ImplExportContent() Line 1159 C++ mergedlo.dll!SvXMLExport::exportDoc(xmloff::token::XMLTokenEnum eClass) Line 1384 C++ sclo.dll!ScXMLExport::exportDoc(xmloff::token::XMLTokenEnum eClass) Line 5393 C++ mergedlo.dll!SvXMLExport::filter(const com::sun::star::uno::Sequence & aDescriptor) Line 812 C++ sclo.dll!ScXMLExport::filter(const com::sun::star::uno::Sequence & aDescriptor) Line 5431 C++ sclo.dll!ScXMLImportWrapper::ExportToComponent(const com::sun::star::uno::Reference & xContext, const com::sun::star::uno::Reference & xModel, const com::sun::star::uno::Reference & xWriter, const com::sun::star::uno::Sequence & aDescriptor, const rtl::OUString & sName, const rtl::OUString & sMediaType, const rtl::OUString & sComponentName, const com::sun::star::uno::Sequence & aArgs, std::unique_ptr> & pSharedData) Line 711 C++ sclo.dll!ScXMLImportWrapper::Export(bool bStylesOnly) Line 947 C++ sclo.dll!ScDocShell::SaveXML(SfxMedium * pSaveMedium, const com::sun::star::uno::Reference & xStor) Line 569 C++ sclo.dll!ScDocShell::SaveAs(SfxMedium & rMedium) Line 1861 C++ ... and here is the value of 'this' in (OSeekableInputStreamWrapper::seek): -this 0x0272b1388610 {...} utl::OSeekableInputStreamWrapper * {utl::OStreamWrapper} - [utl::OStreamWrapper] {...} utl::OStreamWrapper - cppu::ImplInheritanceHelper {...} cppu::ImplInheritanceHelper - utl::OSeekableInputStreamWrapper {...} utl::OSeekableInputStreamWrapper - cppu::ImplInheritanceHelper {...} cppu::ImplInheritanceHelper - utl::OInputStreamWrapper {m_aMutex={...} m_pSvStream=0x0272a992ff10 {mxFileHandle=0x49b0 nLockCounter=0 aFilename=...} ...} utl::OInputStreamWrapper + utl::OInputStreamWrapper_Base {...} utl::OInputStreamWrapper_Base + comphelper::ByteReader {...} comphelper::ByteReader + m_aMutex {...} std::mutex - m_pSvStream 0x0272a992ff10 {mxFileHandle=0x49b0 nLockCounter=0 aFilename=u"C:\\Users\\Szucsi\\AppData\\Local\\Temp\\lu99163n3gde.tmp\\lu9916{8AA24C62-674C-4CFF-BB49-581F27614405}.tmp" ...} SvStream * {SvFileStream} - [SvFileStream] {mxFileHandle=0x49b0 nLockCounter=0 aFilename=u"C:\\Users\\Szucsi\\AppData\\Local\\Temp\\lu99163n3gde.tmp\\lu9916{8AA24C62-674C-4CFF-BB49-581F27614405}.tmp" ...} SvFileStream + SvStream {m_xLockBytes=nullptr m_nActPos=0 m_pRWBuf=unique_ptr 205 'Í' ...} SvStream mxFileHandle 0x49b0 void * nLockCounter 0 unsigned short + aFilename u"C:\\Users\\Szucsi\\AppData\\Local\\Temp\\lu99163n3gde.tmp\\lu9916{8AA24C62-674C-4CFF-BB49-581F27614405}.tmp" rtl::OUString bIsOpen true bool ... I
[Libreoffice-commits] core.git: sd/source sfx2/source vcl/jsdialog
sd/source/ui/view/drviews2.cxx | 29 - sfx2/source/sidebar/ResourceManager.cxx |3 +-- sfx2/source/view/viewfrm.cxx| 11 +++ vcl/jsdialog/enabled.cxx|6 +++--- vcl/jsdialog/jsdialogbuilder.cxx|9 ++--- 5 files changed, 41 insertions(+), 17 deletions(-) New commits: commit 4ad89dd8166fac837d7ed6887c17f9255f06285e Author: Attila Szűcs AuthorDate: Wed May 3 04:24:35 2023 +0200 Commit: Szymon Kłos CommitDate: Mon May 15 09:03:04 2023 +0200 LOK: Navi-1 open/close on sidebar Enabling Navigator sidebar in case of LOKit. Change-Id: I3a656fa12822e5866c2cd4fbf82627a88f26903a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151307 Tested-by: Szymon Kłos Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151704 Tested-by: Jenkins diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 7f1b762d6e48..5c5aa56e960d 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -3343,16 +3343,27 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_NAVIGATOR: { -if ( rReq.GetArgs() ) -GetViewFrame()->SetChildWindow(SID_NAVIGATOR, -static_cast(rReq.GetArgs()-> -Get(SID_NAVIGATOR)).GetValue()); -else -GetViewFrame()->ToggleChildWindow( SID_NAVIGATOR ); +if (comphelper::LibreOfficeKit::isActive()) +{ +GetViewFrame()->ShowChildWindow(SID_SIDEBAR); +OUString panelId = "SdNavigatorPanel"; +::sfx2::sidebar::Sidebar::TogglePanel( +panelId, GetViewFrame()->GetFrame().GetFrameInterface()); -GetViewFrame()->GetBindings().Invalidate(SID_NAVIGATOR); -Cancel(); -rReq.Ignore (); +Cancel(); +rReq.Done(); +} else { +if ( rReq.GetArgs() ) +GetViewFrame()->SetChildWindow(SID_NAVIGATOR, +static_cast(rReq.GetArgs()-> +Get(SID_NAVIGATOR)).GetValue()); +else +GetViewFrame()->ToggleChildWindow( SID_NAVIGATOR ); + +GetViewFrame()->GetBindings().Invalidate(SID_NAVIGATOR); +Cancel(); +rReq.Ignore (); +} } break; diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index cfc5437037cc..5974e20af488 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -260,8 +260,7 @@ void ResourceManager::ReadDeckList() if (comphelper::LibreOfficeKit::isActive()) { // Hide these decks in LOK as they aren't fully functional. -if (aDeckName == "GalleryDeck" || aDeckName == "NavigatorDeck" -|| aDeckName == "StyleListDeck") +if (aDeckName == "GalleryDeck" || aDeckName == "StyleListDeck") continue; } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index d62090bad118..bf42fc5de078 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3414,6 +3414,17 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) rReq.Done(); return; } +if (nSID == SID_NAVIGATOR) +{ +if (comphelper::LibreOfficeKit::isActive()) +{ +ShowChildWindow(SID_SIDEBAR); +OUString panelId = "SdNavigatorPanel"; +::sfx2::sidebar::Sidebar::TogglePanel(panelId, GetFrame().GetFrameInterface()); +rReq.Done(); +return; +} +} bool bHasChild = HasChildWindow(nSID); bool bShow = pShowItem ? pShowItem->GetValue() : !bHasChild; diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index 73a4eedf96b4..36707140b927 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -299,7 +299,7 @@ bool isBuilderEnabledForSidebar(std::u16string_view rUIFile) { if (// scalc rUIFile == u"modules/scalc/ui/functionpanel.ui" -//|| rUIFile == u"modules/scalc/ui/navigatorpanel.ui" +|| rUIFile == u"modules/scalc/ui/navigatorpanel.ui" || rUIFile == u"modules/scalc/ui/sidebaralignment.ui" || rUIFile == u"modules/scalc/ui/sidebarcellappearance.ui" || rUIFile == u"modules/scalc/ui/sidebarnumberformat.ui" @@ -316,7 +316,7 @@ bool isBuilderEnabledForSidebar(std::u16string_view rUIFile) || rUIFile == u&q
[Libreoffice-commits] core.git: vcl/inc vcl/jsdialog
vcl/inc/jsdialog/jsdialogbuilder.hxx |4 vcl/jsdialog/executor.cxx| 10 -- vcl/jsdialog/jsdialogbuilder.cxx | 35 +-- 3 files changed, 45 insertions(+), 4 deletions(-) New commits: commit 6be76f54a4e94b952975dfded25afff60257c6dd Author: Attila Szűcs AuthorDate: Wed May 3 04:30:55 2023 +0200 Commit: Szymon Kłos CommitDate: Fri May 12 17:25:36 2023 +0200 LOK: Navi-4 tree dblclick Removed sendUpdate that was called 1/sec, so selection dont revert 1/sec. Put sendUpdate into set_cursor(), that seems to be a better spot. Fixed set_cursor usage in executor, that caused slection to not work in dblclick at all. Because set_cursor(int) use not absolute position, but relative to parent And root was used as parent, so it picked SwContent from the 1. lvl, but the 1. lvl items are not real items, just SwContentTypes .. e.g.:Headings.. that cannot be activated.. so never happened anything. Change-Id: Iea373af3a0832a4f97202122bd36022eddf26efe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151308 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151703 Tested-by: Jenkins diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 27ac31784228..4d38d66fe9f1 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -749,6 +749,10 @@ public: virtual void expand_row(const weld::TreeIter& rIter) override; virtual void collapse_row(const weld::TreeIter& rIter) override; +virtual void set_cursor(const weld::TreeIter& rIter) override; +void set_cursor_without_notify(const weld::TreeIter& rIter); +virtual void set_cursor(int pos) override; + using SalInstanceTreeView::remove; virtual void remove(int pos) override; virtual void remove(const weld::TreeIter& rIter) override; diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index 2784acf0cae8..af514bc70dde 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -441,7 +441,8 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap std::unique_ptr itEntry(pTreeView->make_iterator()); pTreeView->get_iter_abs_pos(*itEntry, nAbsPos); pTreeView->select(*itEntry); -pTreeView->set_cursor(*itEntry); +pTreeView->set_cursor_without_notify(*itEntry); +pTreeView->grab_focus(); LOKTrigger::trigger_changed(*pTreeView); return true; } @@ -450,8 +451,11 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap sal_Int32 nRow = o3tl::toInt32(rData["data"]); pTreeView->unselect_all(); +std::unique_ptr itEntry(pTreeView->make_iterator()); +pTreeView->get_iter_abs_pos(*itEntry, nRow); pTreeView->select(nRow); -pTreeView->set_cursor(nRow); +pTreeView->set_cursor_without_notify(*itEntry); +pTreeView->grab_focus(); LOKTrigger::trigger_changed(*pTreeView); LOKTrigger::trigger_row_activated(*pTreeView); return true; @@ -461,6 +465,8 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap sal_Int32 nAbsPos = o3tl::toInt32(rData["data"]); std::unique_ptr itEntry(pTreeView->make_iterator()); pTreeView->get_iter_abs_pos(*itEntry, nAbsPos); +pTreeView->set_cursor_without_notify(*itEntry); +pTreeView->grab_focus(); pTreeView->expand_row(*itEntry); return true; } diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index ed3a0893dbcb..a3c55e28ddfb 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -2016,16 +2016,47 @@ void JSTreeView::clear() sendUpdate(); } +void JSTreeView::set_cursor_without_notify(const weld::TreeIter& rIter) +{ +SalInstanceTreeView::set_cursor(rIter); +} + +void JSTreeView::set_cursor(const weld::TreeIter& rIter) +{ +SalInstanceTreeView::set_cursor(rIter); +sendUpdate(); +} + +void JSTreeView::set_cursor(int pos) +{ +SalInstanceTreeView::set_cursor(pos); +sendUpdate(); +} + void JSTreeView::expand_row(const weld::TreeIter& rIter) { +bool bNotify = false; +const SalInstanceTreeIter& rVclIter = static_cast(rIter); +if (!m_xTreeView->
[Libreoffice-commits] core.git: sc/source sc/uiconfig sd/source sw/source sw/uiconfig
sc/source/ui/navipi/navipi.cxx |6 ++ sc/uiconfig/scalc/ui/navigatorpanel.ui |2 +- sd/source/ui/dlg/navigatr.cxx|6 ++ sw/source/uibase/utlui/navipi.cxx| 29 - sw/uiconfig/swriter/ui/navigatorpanel.ui |2 +- 5 files changed, 38 insertions(+), 7 deletions(-) New commits: commit 39b25518ce96a50f54459f681edcb95057507251 Author: Attila Szűcs AuthorDate: Thu May 4 16:59:54 2023 +0200 Commit: Szymon Kłos CommitDate: Fri May 12 14:02:59 2023 +0200 LOK: Navi-10 hide not needed controls Hide controls we dont need in navigator now. Change-Id: Ibf6843be2976bcd4d90e67130dd0cc08d0988c0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151397 Tested-by: Szymon Kłos Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151702 Tested-by: Jenkins diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 92a6c5f6c94a..d7682d93a101 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -423,6 +423,12 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, weld::Widget* pParent, SfxNaviga else eNavMode = NAV_LMODE_AREAS; SetListMode(eNavMode); + +if(comphelper::LibreOfficeKit::isActive()) +{ +m_xBuilder->weld_container("gridbuttons")->hide(); +m_xLbDocuments->hide(); +} } weld::Window* ScNavigatorDlg::GetFrameWeld() const diff --git a/sc/uiconfig/scalc/ui/navigatorpanel.ui b/sc/uiconfig/scalc/ui/navigatorpanel.ui index 9e02f0ba5588..a5b9b3038be6 100644 --- a/sc/uiconfig/scalc/ui/navigatorpanel.ui +++ b/sc/uiconfig/scalc/ui/navigatorpanel.ui @@ -101,7 +101,7 @@ 12 - + True False True diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index be0f5919afa9..2bdfaefde410 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -48,6 +48,7 @@ #include #include +#include /** * SdNavigatorWin - FloatingWindow @@ -93,6 +94,11 @@ SdNavigatorWin::SdNavigatorWin(weld::Widget* pParent, SfxBindings* pInBindings, mxToolbox->connect_key_press(LINK(this, SdNavigatorWin, KeyInputHdl)); mxTlbObjects->connect_key_press(LINK(this, SdNavigatorWin, KeyInputHdl)); mxLbDocs->connect_key_press(LINK(this, SdNavigatorWin, KeyInputHdl)); +if(comphelper::LibreOfficeKit::isActive()) +{ +mxToolbox->hide(); +mxLbDocs->hide(); +} } void SdNavigatorWin::FirstFocus() diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index e609aa539e4c..0489f5146ae9 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -49,6 +49,8 @@ #include +#include + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; @@ -682,6 +684,14 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xDocListBox->set_accessible_name(m_aStatusArr[3]); m_aExpandedSize = m_xContainer->get_preferred_size(); + +if(comphelper::LibreOfficeKit::isActive()) +{ +m_xBuilder->weld_container("gridcontent16")->hide(); +m_xDocListBox->hide(); +m_xGlobalBox->hide(); +m_xGlobalToolBox->hide(); +} } weld::Window* SwNavigationPI::GetFrameWeld() const @@ -765,12 +775,15 @@ void SwNavigationPI::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState /*eState*/, } else if (nSID == FN_STAT_PAGE) { -SwView *pActView = GetCreateView(); -if(pActView) +if(!comphelper::LibreOfficeKit::isActive()) { -SwWrtShell &rSh = pActView->GetWrtShell(); -m_xEdit->set_max(rSh.GetPageCnt()); -m_xEdit->set_width_chars(3); +SwView *pActView = GetCreateView(); +if(pActView) +{ +SwWrtShell &rSh = pActView->GetWrtShell(); +m_xEdit->set_max(rSh.GetPageCnt()); +m_xEdit->set_width_chars(3); +} } } } @@ -1045,6 +1058,12 @@ void SwNavigationPI::SetRegionDropMode(RegionMode nNewMode) void SwNavigationPI::ToggleTree() { +if (comphelper::LibreOfficeKit::isActive()) +{ +m_xGlobalTree->HideTree(); +return; +} + bool bGlobalDoc = IsGlobalDoc(); if (!IsGlobalMode() && bGlobalDoc) { diff --git a/sw/uiconfig/swriter/ui/navigatorpanel.ui b/sw/uiconfig/swriter/ui/navigatorpanel.ui index 7c3fd820e2d3..d34e58af1260 100644 --- a/sw/uiconfig/swriter/ui/navigatorpanel.ui +++ b/sw/uiconfig/swriter/ui/navigatorpanel.ui @@ -244,7 +244,7 @@ 6 12 - + True False True
[Libreoffice-commits] core.git: vcl/jsdialog
vcl/jsdialog/executor.cxx |4 1 file changed, 4 insertions(+) New commits: commit 9c8e38ef8c69d519d72737b404d54d6413a98518 Author: Attila Szűcs AuthorDate: Wed May 3 04:46:20 2023 +0200 Commit: Szymon Kłos CommitDate: Fri May 12 13:47:22 2023 +0200 LOK: Navi-6 page selector SpinField Grab the focus back to the spinfield in sidebar, so the document will be able to scroll to the right page. It seems there is a condition check, on move to page, that focus must be not on document, or else it does not move. AFAIK in lok code we dont try to simulate the focus of the core, but maybe we should, for cases like this. Change-Id: Ie9a30e6bd944cfa1729861eb0ac1924b946f4185 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151309 Reviewed-by: Szymon Kłos Tested-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151701 Tested-by: Jenkins diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index f387a64ffc37..2784acf0cae8 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -310,6 +310,10 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap if (rData["data"] == "undefined") return true; +// The Document will not scroll if that is in focus +// maybe we could send a message with: sAction == "grab_focus" +pWidget->grab_focus(); + double nValue = o3tl::toDouble(rData["data"]); pSpinField->set_value(nValue * weld::SpinButton::Power10(pSpinField->get_digits()));
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sd/source sfx2/source vcl/jsdialog
sd/source/ui/view/drviews2.cxx | 29 - sfx2/source/sidebar/ResourceManager.cxx |3 +-- sfx2/source/view/viewfrm.cxx| 11 +++ vcl/jsdialog/enabled.cxx|6 +++--- vcl/jsdialog/jsdialogbuilder.cxx|9 ++--- 5 files changed, 41 insertions(+), 17 deletions(-) New commits: commit 6b734f99a1ca9165b86f6588a720de6dc90d3f7b Author: Attila Szűcs AuthorDate: Wed May 3 04:24:35 2023 +0200 Commit: Szymon Kłos CommitDate: Fri May 5 12:14:04 2023 +0200 LOK: Navi-1 open/close on sidebar Enabling Navigator sidebar in case of LOKit. Change-Id: I3a656fa12822e5866c2cd4fbf82627a88f26903a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151307 Tested-by: Szymon Kłos Reviewed-by: Szymon Kłos diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 94207a01653e..d5bcbec91eaa 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -3350,16 +3350,27 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_NAVIGATOR: { -if ( rReq.GetArgs() ) -GetViewFrame()->SetChildWindow(SID_NAVIGATOR, -static_cast(rReq.GetArgs()-> -Get(SID_NAVIGATOR)).GetValue()); -else -GetViewFrame()->ToggleChildWindow( SID_NAVIGATOR ); +if (comphelper::LibreOfficeKit::isActive()) +{ +GetViewFrame()->ShowChildWindow(SID_SIDEBAR); +OUString panelId = "SdNavigatorPanel"; +::sfx2::sidebar::Sidebar::TogglePanel( +panelId, GetViewFrame()->GetFrame().GetFrameInterface()); -GetViewFrame()->GetBindings().Invalidate(SID_NAVIGATOR); -Cancel(); -rReq.Ignore (); +Cancel(); +rReq.Done(); +} else { +if ( rReq.GetArgs() ) +GetViewFrame()->SetChildWindow(SID_NAVIGATOR, +static_cast(rReq.GetArgs()-> +Get(SID_NAVIGATOR)).GetValue()); +else +GetViewFrame()->ToggleChildWindow( SID_NAVIGATOR ); + +GetViewFrame()->GetBindings().Invalidate(SID_NAVIGATOR); +Cancel(); +rReq.Ignore (); +} } break; diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index cfc5437037cc..5974e20af488 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -260,8 +260,7 @@ void ResourceManager::ReadDeckList() if (comphelper::LibreOfficeKit::isActive()) { // Hide these decks in LOK as they aren't fully functional. -if (aDeckName == "GalleryDeck" || aDeckName == "NavigatorDeck" -|| aDeckName == "StyleListDeck") +if (aDeckName == "GalleryDeck" || aDeckName == "StyleListDeck") continue; } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 6ac5653db267..e082d651073e 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3335,6 +3335,17 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) rReq.Done(); return; } +if (nSID == SID_NAVIGATOR) +{ +if (comphelper::LibreOfficeKit::isActive()) +{ +ShowChildWindow(SID_SIDEBAR); +OUString panelId = "SdNavigatorPanel"; +::sfx2::sidebar::Sidebar::TogglePanel(panelId, GetFrame().GetFrameInterface()); +rReq.Done(); +return; +} +} bool bHasChild = HasChildWindow(nSID); bool bShow = pShowItem ? pShowItem->GetValue() : !bHasChild; diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index 0fd8f6e94293..807f1d14a580 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -292,7 +292,7 @@ bool isBuilderEnabledForSidebar(std::u16string_view rUIFile) { if (// scalc rUIFile == u"modules/scalc/ui/functionpanel.ui" -//|| rUIFile == u"modules/scalc/ui/navigatorpanel.ui" +|| rUIFile == u"modules/scalc/ui/navigatorpanel.ui" || rUIFile == u"modules/scalc/ui/sidebaralignment.ui" || rUIFile == u"modules/scalc/ui/sidebarcellappearance.ui" || rUIFile == u"modules/scalc/ui/sidebarnumberformat.ui" @@ -309,7 +309,7 @@ bool isBuilderEnabledForSidebar(std::u16string_view rUIFile) || rUIFile == u"modules/simpress/ui/masterpagepanel.ui" || rUIFile == u"modules/simpr
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - vcl/inc vcl/jsdialog
vcl/inc/jsdialog/jsdialogbuilder.hxx |4 vcl/jsdialog/executor.cxx| 10 -- vcl/jsdialog/jsdialogbuilder.cxx | 35 +-- 3 files changed, 45 insertions(+), 4 deletions(-) New commits: commit a863bd126ee9a19f305542c836644f7daaa784a7 Author: Attila Szűcs AuthorDate: Wed May 3 04:30:55 2023 +0200 Commit: Szymon Kłos CommitDate: Fri May 5 10:53:26 2023 +0200 LOK: Navi-4 tree dblclick Removed sendUpdate that was called 1/sec, so selection dont revert 1/sec. Put sendUpdate into set_cursor(), that seems to be a better spot. Fixed set_cursor usage in executor, that caused slection to not work in dblclick at all. Because set_cursor(int) use not absolute position, but relative to parent And root was used as parent, so it picked SwContent from the 1. lvl, but the 1. lvl items are not real items, just SwContentTypes .. e.g.:Headings.. that cannot be activated.. so never happened anything. Change-Id: Iea373af3a0832a4f97202122bd36022eddf26efe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151308 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 75ea450ec4c8..25281fb33236 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -749,6 +749,10 @@ public: virtual void expand_row(const weld::TreeIter& rIter) override; virtual void collapse_row(const weld::TreeIter& rIter) override; +virtual void set_cursor(const weld::TreeIter& rIter) override; +void set_cursor_without_notify(const weld::TreeIter& rIter); +virtual void set_cursor(int pos) override; + using SalInstanceTreeView::remove; virtual void remove(int pos) override; virtual void remove(const weld::TreeIter& rIter) override; diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index 737ae2f961b9..1accb3bc1de0 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -445,7 +445,8 @@ bool ExecuteAction(const std::string& nWindowId, const OString& rWidget, StringM std::unique_ptr itEntry(pTreeView->make_iterator()); pTreeView->get_iter_abs_pos(*itEntry, nAbsPos); pTreeView->select(*itEntry); -pTreeView->set_cursor(*itEntry); +pTreeView->set_cursor_without_notify(*itEntry); +pTreeView->grab_focus(); LOKTrigger::trigger_changed(*pTreeView); return true; } @@ -454,8 +455,11 @@ bool ExecuteAction(const std::string& nWindowId, const OString& rWidget, StringM sal_Int32 nRow = o3tl::toInt32(rData["data"]); pTreeView->unselect_all(); +std::unique_ptr itEntry(pTreeView->make_iterator()); +pTreeView->get_iter_abs_pos(*itEntry, nRow); pTreeView->select(nRow); -pTreeView->set_cursor(nRow); +pTreeView->set_cursor_without_notify(*itEntry); +pTreeView->grab_focus(); LOKTrigger::trigger_changed(*pTreeView); LOKTrigger::trigger_row_activated(*pTreeView); return true; @@ -465,6 +469,8 @@ bool ExecuteAction(const std::string& nWindowId, const OString& rWidget, StringM sal_Int32 nAbsPos = o3tl::toInt32(rData["data"]); std::unique_ptr itEntry(pTreeView->make_iterator()); pTreeView->get_iter_abs_pos(*itEntry, nAbsPos); +pTreeView->set_cursor_without_notify(*itEntry); +pTreeView->grab_focus(); pTreeView->expand_row(*itEntry); return true; } diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index ef59d1eb1e8f..3f094891c6eb 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -2021,16 +2021,47 @@ void JSTreeView::clear() sendUpdate(); } +void JSTreeView::set_cursor_without_notify(const weld::TreeIter& rIter) +{ +SalInstanceTreeView::set_cursor(rIter); +} + +void JSTreeView::set_cursor(const weld::TreeIter& rIter) +{ +SalInstanceTreeView::set_cursor(rIter); +sendUpdate(); +} + +void JSTreeView::set_cursor(int pos) +{ +SalInstanceTreeView::set_cursor(pos); +sendUpdate(); +} + void JSTreeView::expand_row(const weld::TreeIter& rIter) { +bool bNotify = false; +const SalInstanceTreeIter& rVclIter = static_cast(rIter); +if (!m_xTreeView->IsExpanded(rVclIter.iter)) +bNotify = true; + SalInstanceTreeView::expand_
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source sc/uiconfig sd/source sw/source sw/uiconfig
sc/source/ui/navipi/navipi.cxx |6 ++ sc/uiconfig/scalc/ui/navigatorpanel.ui |2 +- sd/source/ui/dlg/navigatr.cxx|6 ++ sw/source/uibase/utlui/navipi.cxx| 29 - sw/uiconfig/swriter/ui/navigatorpanel.ui |2 +- 5 files changed, 38 insertions(+), 7 deletions(-) New commits: commit fa93ddc87b86432ab68e43353cd872439895898f Author: Attila Szűcs AuthorDate: Thu May 4 16:59:54 2023 +0200 Commit: Szymon Kłos CommitDate: Fri May 5 10:01:10 2023 +0200 LOK: Navi-10 hide not needed controls Hide controls we dont need in navigator now. Change-Id: Ibf6843be2976bcd4d90e67130dd0cc08d0988c0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151397 Tested-by: Szymon Kłos Reviewed-by: Szymon Kłos diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 6340c1a80f33..1934b14ca374 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -423,6 +423,12 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, weld::Widget* pParent, SfxNaviga else eNavMode = NAV_LMODE_AREAS; SetListMode(eNavMode); + +if(comphelper::LibreOfficeKit::isActive()) +{ +m_xBuilder->weld_container("gridbuttons")->hide(); +m_xLbDocuments->hide(); +} } weld::Window* ScNavigatorDlg::GetFrameWeld() const diff --git a/sc/uiconfig/scalc/ui/navigatorpanel.ui b/sc/uiconfig/scalc/ui/navigatorpanel.ui index 9e02f0ba5588..a5b9b3038be6 100644 --- a/sc/uiconfig/scalc/ui/navigatorpanel.ui +++ b/sc/uiconfig/scalc/ui/navigatorpanel.ui @@ -101,7 +101,7 @@ 12 - + True False True diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index cdc2db1f5a81..459051b9aed4 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -48,6 +48,7 @@ #include #include +#include /** * SdNavigatorWin - FloatingWindow @@ -93,6 +94,11 @@ SdNavigatorWin::SdNavigatorWin(weld::Widget* pParent, SfxBindings* pInBindings, mxToolbox->connect_key_press(LINK(this, SdNavigatorWin, KeyInputHdl)); mxTlbObjects->connect_key_press(LINK(this, SdNavigatorWin, KeyInputHdl)); mxLbDocs->connect_key_press(LINK(this, SdNavigatorWin, KeyInputHdl)); +if(comphelper::LibreOfficeKit::isActive()) +{ +mxToolbox->hide(); +mxLbDocs->hide(); +} } void SdNavigatorWin::FirstFocus() diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index fc92d2d6edda..4f60ba96e874 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -49,6 +49,8 @@ #include +#include + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; @@ -682,6 +684,14 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xDocListBox->set_accessible_name(m_aStatusArr[3]); m_aExpandedSize = m_xContainer->get_preferred_size(); + +if(comphelper::LibreOfficeKit::isActive()) +{ +m_xBuilder->weld_container("gridcontent16")->hide(); +m_xDocListBox->hide(); +m_xGlobalBox->hide(); +m_xGlobalToolBox->hide(); +} } weld::Window* SwNavigationPI::GetFrameWeld() const @@ -765,12 +775,15 @@ void SwNavigationPI::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState /*eState*/, } else if (nSID == FN_STAT_PAGE) { -SwView *pActView = GetCreateView(); -if(pActView) +if(!comphelper::LibreOfficeKit::isActive()) { -SwWrtShell &rSh = pActView->GetWrtShell(); -m_xEdit->set_max(rSh.GetPageCnt()); -m_xEdit->set_width_chars(3); +SwView *pActView = GetCreateView(); +if(pActView) +{ +SwWrtShell &rSh = pActView->GetWrtShell(); +m_xEdit->set_max(rSh.GetPageCnt()); +m_xEdit->set_width_chars(3); +} } } } @@ -1045,6 +1058,12 @@ void SwNavigationPI::SetRegionDropMode(RegionMode nNewMode) void SwNavigationPI::ToggleTree() { +if (comphelper::LibreOfficeKit::isActive()) +{ +m_xGlobalTree->HideTree(); +return; +} + bool bGlobalDoc = IsGlobalDoc(); if (!IsGlobalMode() && bGlobalDoc) { diff --git a/sw/uiconfig/swriter/ui/navigatorpanel.ui b/sw/uiconfig/swriter/ui/navigatorpanel.ui index f38518649c9a..71718d71d572 100644 --- a/sw/uiconfig/swriter/ui/navigatorpanel.ui +++ b/sw/uiconfig/swriter/ui/navigatorpanel.ui @@ -244,7 +244,7 @@ 6 12 - + True False True
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - vcl/jsdialog
vcl/jsdialog/executor.cxx |4 1 file changed, 4 insertions(+) New commits: commit d9d2e4b1c1b660e4727edd21b0c83b7534b6171c Author: Attila Szűcs AuthorDate: Wed May 3 04:46:20 2023 +0200 Commit: Szymon Kłos CommitDate: Fri May 5 09:38:00 2023 +0200 LOK: Navi-6 page selector SpinField Grab the focus back to the spinfield in sidebar, so the document will be able to scroll to the right page. It seems there is a condition check, on move to page, that focus must be not on document, or else it does not move. AFAIK in lok code we dont try to simulate the focus of the core, but maybe we should, for cases like this. Change-Id: Ie9a30e6bd944cfa1729861eb0ac1924b946f4185 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151309 Reviewed-by: Szymon Kłos Tested-by: Szymon Kłos diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index a178d60fc2c3..737ae2f961b9 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -311,6 +311,10 @@ bool ExecuteAction(const std::string& nWindowId, const OString& rWidget, StringM if (rData["data"] == "undefined") return true; +// The Document will not scroll if that is in focus +// maybe we could send a message with: sAction == "grab_focus" +pWidget->grab_focus(); + double nValue = o3tl::toDouble(rData["data"]); pSpinField->set_value(nValue * weld::SpinButton::Power10(pSpinField->get_digits()));
[Libreoffice-commits] core.git: include/package package/inc package/qa package/source sc/qa tools/source unotools/source
include/package/Deflater.hxx |2 package/inc/ByteChucker.hxx| 30 package/inc/ZipFile.hxx|4 package/inc/ZipOutputStream.hxx|3 package/qa/cppunit/data/export64.zip |binary package/qa/cppunit/test_package.cxx| 49 +++ package/source/zipapi/ByteChucker.cxx |2 package/source/zipapi/Deflater.cxx | 18 ++ package/source/zipapi/MemoryByteGrabber.hxx| 32 package/source/zipapi/ZipFile.cxx | 143 +++-- package/source/zipapi/ZipOutputStream.cxx | 69 +- sc/qa/unit/data/xlsx/tdf82984_zip64XLSXImport.xlsx |binary sc/qa/unit/subsequent_filters_test3.cxx|6 tools/source/stream/strmwnt.cxx| 23 ++- unotools/source/streaming/streamwrap.cxx |2 15 files changed, 303 insertions(+), 80 deletions(-) New commits: commit abda72eeac19b18c22f57d5443c3955a463605d7 Author: Attila Szűcs AuthorDate: Mon Feb 20 00:32:22 2023 +0100 Commit: Michael Meeks CommitDate: Wed Mar 8 14:53:57 2023 + tdf#82984 tdf#94915 zip64 support (import + export) Implemented import + export for "Zip64 Extended Information Extra Field", (in "Local file header" and "Central directory file header") and for Data descriptor. Focused only to be able to handle files with over 4GB uncompressed size, in the zip archive. The 64k filecount, and the 4GB compressed size limit is probably still present Tried to follow pkware .ZIP File Format Specification, Some cases were not clear to me and/or some zip compressing tool may not perfectly follow the standard, like 'extra field' should be 28 bytes long, but its reader now can read shorter (or longer) 'extra field'. Replaced some 32bit codes with 64bit codes, in stream handling, in deflater. Tested with an ods file that contained a content.xml that bigger then 4BG+ (import + export + reimport) on windows. I think 4GB+ files import/export would be too slow fot unittest. So, for unit test, used the small but zip64 format files, that was attached to the bugzilla tickets Note: It helps with Bug 128244 too (1 of the unittest tests it), but that ods file missing manifest.xml, so LO won't be able to import it. Change-Id: Idfeb90594388fd34ae719677f5d268ca9a484fb1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147306 Tested-by: Jenkins Reviewed-by: Michael Meeks diff --git a/include/package/Deflater.hxx b/include/package/Deflater.hxx index 3cd528bf5afd..2a5c9d103260 100644 --- a/include/package/Deflater.hxx +++ b/include/package/Deflater.hxx @@ -36,6 +36,8 @@ class DLLPUBLIC_PACKAGE Deflater final boolbFinish; boolbFinished; sal_Int64 nOffset, nLength; +// zlib total_in / total_out may be stored in 32bit, so they can overflow in case of 4gb files +sal_uInt64 nTotalOut64, nTotalIn64; // save the overflowed value here. std::unique_ptr pStream; void init (sal_Int32 nLevel, bool bNowrap); diff --git a/package/inc/ByteChucker.hxx b/package/inc/ByteChucker.hxx index 707b678ff2a5..c502ad6b5c42 100644 --- a/package/inc/ByteChucker.hxx +++ b/package/inc/ByteChucker.hxx @@ -29,8 +29,8 @@ class ByteChucker final { css::uno::Reference < css::io::XOutputStream > xStream; css::uno::Reference < css::io::XSeekable > xSeek; -css::uno::Sequence < sal_Int8 > a2Sequence, a4Sequence; -sal_Int8 * const p2Sequence, * const p4Sequence; +css::uno::Sequence < sal_Int8 > a2Sequence, a4Sequence, a8Sequence; +sal_Int8 * const p2Sequence, * const p4Sequence, * const p8Sequence; public: ByteChucker (css::uno::Reference const & xOstream); @@ -70,6 +70,32 @@ public: p4Sequence[3] = static_cast < sal_Int8 > ((nuInt32 >> 24 ) & 0xFF); WriteBytes( a4Sequence ); } + +void WriteInt64(sal_Int64 nInt64) +{ +p8Sequence[0] = static_cast((nInt64 >> 0) & 0xFF); +p8Sequence[1] = static_cast((nInt64 >> 8) & 0xFF); +p8Sequence[2] = static_cast((nInt64 >> 16) & 0xFF); +p8Sequence[3] = static_cast((nInt64 >> 24) & 0xFF); +p8Sequence[4] = static_cast((nInt64 >> 32) & 0xFF); +p8Sequence[5] = static_cast((nInt64 >> 40) & 0xFF); +p8Sequence[6] = static_cast((nInt64 >> 48) & 0xFF); +p8Sequence[7] = static_cast((nInt64 >> 56) & 0xFF); +WriteBytes( a8Sequence ); +} + +void WriteUInt64(sal_uInt64 nuInt64) +{ +p8Sequence[0] = static_cast((nuInt64 >> 0) & 0xFF); +p8Sequenc
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - include/svx sc/source sd/source svx/qa svx/source sw/source
include/svx/svdmodel.hxx|4 + sc/source/ui/docshell/docsh.cxx |2 sd/source/ui/docshell/docshel4.cxx |1 svx/qa/unit/data/tdf148000_EOLinCurvedText.pptx |binary svx/qa/unit/data/tdf148000_EOLinCurvedText_Legacy.odp |binary svx/qa/unit/data/tdf148000_EOLinCurvedText_New.odp |binary svx/qa/unit/svdraw.cxx | 42 +++ svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 57 svx/source/svdraw/svdmodel.cxx | 42 +++ sw/source/uibase/app/docshini.cxx | 10 +- 10 files changed, 142 insertions(+), 16 deletions(-) New commits: commit 497298874961fb335caf4cc91e531667394588bc Author: Attila Szűcs AuthorDate: Fri Jan 13 04:49:33 2023 +0100 Commit: Andras Timar CommitDate: Mon Jan 23 12:47:04 2023 + tdf#148000 impress: Handle linebreaks on fontwork. Split text lines in a paragraph, right before polygons are created for rendering, so eol will brake line in fontwork just like eop. Change-Id: Ie9e6764f9f91c2e19afd43dc9a212bd18c41c99d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145425 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit f9d6dd788e82a1964dab9cc0d0436c8c54b775c0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145804 Reviewed-by: Andras Timar diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 7c23b5a24712..b5d93fa53eb7 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -575,6 +575,10 @@ public: void SetAnchoredTextOverflowLegacy(bool bEnabled); bool IsAnchoredTextOverflowLegacy() const; +// tdf#148000 compatibility flag +void SetLegacySingleLineFontwork(bool bEnabled); +bool IsLegacySingleLineFontwork() const; + void ReformatAllTextObjects(); std::unique_ptr createOutliner( OutlinerMode nOutlinerMode ); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 2f2f3521ae4e..458feb6dea2a 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -590,6 +590,8 @@ bool ScDocShell::Load( SfxMedium& rMedium ) { if (m_pDocument->GetDrawLayer()) m_pDocument->GetDrawLayer()->SetAnchoredTextOverflowLegacy(true); +if (m_pDocument->GetDrawLayer()) +m_pDocument->GetDrawLayer()->SetLegacySingleLineFontwork(true); //for tdf#148000 } GetUndoManager()->Clear(); diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 13b08deafa1a..0bdfef02b7db 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -269,6 +269,7 @@ bool DrawDocShell::Load( SfxMedium& rMedium ) if (IsOwnStorageFormat(rMedium)) { mpDoc->SetAnchoredTextOverflowLegacy(true); +mpDoc->SetLegacySingleLineFontwork(true); //for tdf#148000 } bool bRet = false; diff --git a/svx/qa/unit/data/tdf148000_EOLinCurvedText.pptx b/svx/qa/unit/data/tdf148000_EOLinCurvedText.pptx new file mode 100644 index ..137fc816697a Binary files /dev/null and b/svx/qa/unit/data/tdf148000_EOLinCurvedText.pptx differ diff --git a/svx/qa/unit/data/tdf148000_EOLinCurvedText_Legacy.odp b/svx/qa/unit/data/tdf148000_EOLinCurvedText_Legacy.odp new file mode 100644 index ..13e7cc4e5c8a Binary files /dev/null and b/svx/qa/unit/data/tdf148000_EOLinCurvedText_Legacy.odp differ diff --git a/svx/qa/unit/data/tdf148000_EOLinCurvedText_New.odp b/svx/qa/unit/data/tdf148000_EOLinCurvedText_New.odp new file mode 100644 index ..7ebdb9431b72 Binary files /dev/null and b/svx/qa/unit/data/tdf148000_EOLinCurvedText_New.odp differ diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index c2a7f244b8ab..7bf1ceb9d4a1 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -382,6 +382,48 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testFontWorks) "32"); } +CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf148000_EOLinCurvedText) +{ +std::vector aFilenames += { u"tdf148000_EOLinCurvedText.pptx", u"tdf148000_EOLinCurvedText_New.odp", +u"tdf148000_EOLinCurvedText_Legacy.odp" }; + +for (int i = 0; i < 3; i++) +{ +loadFromURL(aFilenames[i]); + +SdrPage* pSdrPage = getFirstDrawPageWithAssert(); + +xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage); + +OString aBasePath += "/primitive2D/objectinfo[4]/unhandled/unhandled/polypolygoncolor/polypolygon/"; + +// The text is: "O" + eop + "O" + eol + "O" +// It should be displayed as 3 line of text. (1 "O" letter in every line) +
[Libreoffice-commits] core.git: include/svx sc/source sd/source svx/qa svx/source sw/source
include/svx/svdmodel.hxx|4 + sc/source/ui/docshell/docsh.cxx |2 sd/source/ui/docshell/docshel4.cxx |1 svx/qa/unit/data/tdf148000_EOLinCurvedText.pptx |binary svx/qa/unit/data/tdf148000_EOLinCurvedText_Legacy.odp |binary svx/qa/unit/data/tdf148000_EOLinCurvedText_New.odp |binary svx/qa/unit/svdraw.cxx | 42 +++ svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 57 svx/source/svdraw/svdmodel.cxx | 42 +++ sw/source/uibase/app/docshini.cxx | 10 +- 10 files changed, 142 insertions(+), 16 deletions(-) New commits: commit f9d6dd788e82a1964dab9cc0d0436c8c54b775c0 Author: Attila Szűcs AuthorDate: Fri Jan 13 04:49:33 2023 +0100 Commit: Miklos Vajna CommitDate: Fri Jan 20 07:56:29 2023 + tdf#148000 impress: Handle linebreaks on fontwork. Split text lines in a paragraph, right before polygons are created for rendering, so eol will brake line in fontwork just like eop. Change-Id: Ie9e6764f9f91c2e19afd43dc9a212bd18c41c99d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145425 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 7c23b5a24712..b5d93fa53eb7 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -575,6 +575,10 @@ public: void SetAnchoredTextOverflowLegacy(bool bEnabled); bool IsAnchoredTextOverflowLegacy() const; +// tdf#148000 compatibility flag +void SetLegacySingleLineFontwork(bool bEnabled); +bool IsLegacySingleLineFontwork() const; + void ReformatAllTextObjects(); std::unique_ptr createOutliner( OutlinerMode nOutlinerMode ); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 071c2530f61b..1f58bf43f1b7 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -589,6 +589,8 @@ bool ScDocShell::Load( SfxMedium& rMedium ) { if (m_pDocument->GetDrawLayer()) m_pDocument->GetDrawLayer()->SetAnchoredTextOverflowLegacy(true); +if (m_pDocument->GetDrawLayer()) +m_pDocument->GetDrawLayer()->SetLegacySingleLineFontwork(true); //for tdf#148000 } GetUndoManager()->Clear(); diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 99d6890fe1f0..4df8aee97a4a 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -269,6 +269,7 @@ bool DrawDocShell::Load( SfxMedium& rMedium ) if (IsOwnStorageFormat(rMedium)) { mpDoc->SetAnchoredTextOverflowLegacy(true); +mpDoc->SetLegacySingleLineFontwork(true); //for tdf#148000 } bool bRet = false; diff --git a/svx/qa/unit/data/tdf148000_EOLinCurvedText.pptx b/svx/qa/unit/data/tdf148000_EOLinCurvedText.pptx new file mode 100644 index ..137fc816697a Binary files /dev/null and b/svx/qa/unit/data/tdf148000_EOLinCurvedText.pptx differ diff --git a/svx/qa/unit/data/tdf148000_EOLinCurvedText_Legacy.odp b/svx/qa/unit/data/tdf148000_EOLinCurvedText_Legacy.odp new file mode 100644 index ..13e7cc4e5c8a Binary files /dev/null and b/svx/qa/unit/data/tdf148000_EOLinCurvedText_Legacy.odp differ diff --git a/svx/qa/unit/data/tdf148000_EOLinCurvedText_New.odp b/svx/qa/unit/data/tdf148000_EOLinCurvedText_New.odp new file mode 100644 index ..7ebdb9431b72 Binary files /dev/null and b/svx/qa/unit/data/tdf148000_EOLinCurvedText_New.odp differ diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index c2a7f244b8ab..7bf1ceb9d4a1 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -382,6 +382,48 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testFontWorks) "32"); } +CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf148000_EOLinCurvedText) +{ +std::vector aFilenames += { u"tdf148000_EOLinCurvedText.pptx", u"tdf148000_EOLinCurvedText_New.odp", +u"tdf148000_EOLinCurvedText_Legacy.odp" }; + +for (int i = 0; i < 3; i++) +{ +loadFromURL(aFilenames[i]); + +SdrPage* pSdrPage = getFirstDrawPageWithAssert(); + +xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage); + +OString aBasePath += "/primitive2D/objectinfo[4]/unhandled/unhandled/polypolygoncolor/polypolygon/"; + +// The text is: "O" + eop + "O" + eol + "O" +// It should be displayed as 3 line of text. (1 "O" letter in every line) +sal_Int32 nY1 = getXPath(pXmlDoc, aBasePath + "polygon[1]/point[1]", "y").toInt32(); +sal_Int32 nY2 = getXPath(pXmlDoc, aBasePath + "polygon[3
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - oox/source sd/qa
oox/source/ppt/slidepersist.cxx | 72 +- sd/qa/unit/data/pptx/tdf153036_resizedConnectorL.pptx |binary sd/qa/unit/import-tests.cxx | 17 3 files changed, 69 insertions(+), 20 deletions(-) New commits: commit 379866dd23be2cd3eb9952fbc6b106daaec0cdea Author: Attila Szűcs AuthorDate: Mon Jan 16 04:13:07 2023 +0100 Commit: Xisco Fauli CommitDate: Thu Jan 19 13:29:10 2023 + tdf#153036 PPTX import resized connector broken Fixed the EdgeLine1Delta calculation in case of bentConnector2. (when L shape imported as a special Z shape) Co-authored-by: Tibor Nagy (NISZ) Change-Id: I08c92e63adc744322061e4e433bfdc512745eda1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145548 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 17c68fad2aef917adfdd3d4d651da786e620699c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145766 Reviewed-by: Xisco Fauli diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index 657703fff239..dc068b0b699e 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -342,6 +342,36 @@ void SlidePersist::hideShapesAsMasterShapes() } } +// This angle determines in the direction of the line +static sal_Int32 lcl_GetAngle(uno::Reference& rXShape, awt::Point& rPt) +{ +SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rXShape); +tools::Rectangle aR(pObj->GetSnapRect()); +sal_Int32 nLeftX = rPt.X - aR.Left(); +sal_Int32 nTopY = rPt.Y - aR.Top(); +sal_Int32 nRightX = aR.Right() - rPt.X; +sal_Int32 nBottomY = aR.Bottom() - rPt.Y; +sal_Int32 nX = std::min(nLeftX, nRightX); +sal_Int32 nY = std::min(nTopY, nBottomY); + +sal_Int32 nAngle; +if (nX < nY) +{ +if (nLeftX < nRightX) +nAngle = 180; // Left +else +nAngle = 0; // Right +} +else +{ +if (nTopY < nBottomY) +nAngle = 270; // Top +else +nAngle = 90; // Bottom +} +return nAngle; +} + Reference SlidePersist::getAnimationNode(const OUString& sId) const { const auto& pIter = maAnimNodesMap.find(sId); @@ -373,6 +403,8 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, SdrObject* pEndObj = xEndSp.is() ? SdrObject::getSdrObjectFromXShape(xEndSp) : nullptr; sal_Int32 nStartSpLineW = 0; +sal_Int32 nStartA = -1; +sal_Int32 nEndA = -1; if (pStartObj) { aStartRect = pStartObj->GetSnapRect(); @@ -380,6 +412,7 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, xPropxStartSp->getPropertyValue("LineWidth") >>= nStartSpLineW; if (nStartSpLineW) nStartSpLineW = nStartSpLineW / 2; +nStartA = lcl_GetAngle(xStartSp, aStartPt); } sal_Int32 nEndSpLineW = 0; if (pEndObj) @@ -389,6 +422,7 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, xPropxEndSp->getPropertyValue("LineWidth") >>= nEndSpLineW; if (nEndSpLineW) nEndSpLineW = nEndSpLineW / 2; +nEndA = lcl_GetAngle(xEndSp, aEndPt); } const OUString sConnectorName = rShapePtr->getConnectorName(); @@ -397,27 +431,25 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, awt::Size aConnSize = rXConnector->getSize(); if (xStartSp.is() || xEndSp.is()) { -if (aConnSize.Height < aConnSize.Width) +if (nStartA >= 0) { -if (xStartSp.is()) -nEdge = (aStartPt.Y > aEndPt.Y) -? (nStartSpLineW - (aStartRect.Top() - aEndPt.Y)) -: ((aEndPt.Y - aStartRect.Bottom()) - nStartSpLineW); -else -nEdge = (aStartPt.Y > aEndPt.Y) -? ((aStartPt.Y - aEndRect.Bottom()) - nEndSpLineW) -: (nEndSpLineW - (aEndRect.Top() - aStartPt.Y)); -} -else -{ -if (xStartSp.is()) -nEdge = (aStartPt.X > aEndPt.X) -? (nStartSpLineW - (aStartRect.Left() - aEndPt.X)) -: ((aEndPt.X - aStartRect.Right()) - nStartSpLineW); -else -nEdge = (aStartPt.X > aEndPt.X) -? ((aStartPt.X - aEndRect.Right()) - nEndSpLineW) -: (nEndSpLineW - (aEndRect.Left() - aStartPt.X)); +switch (nStartA) +{ +case 0: nEdge = aEndPt.X - aStartRect.Right(); break; +case 180: nEdge = aEndPt.X - aStartRect.Left(); break; +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - oox/source sd/qa
oox/source/ppt/slidepersist.cxx | 72 +- sd/qa/unit/data/pptx/tdf153036_resizedConnectorL.pptx |binary sd/qa/unit/import-tests.cxx | 16 3 files changed, 68 insertions(+), 20 deletions(-) New commits: commit a44ab07e05521b987c842265184240661e330ea4 Author: Attila Szűcs AuthorDate: Mon Jan 16 04:13:07 2023 +0100 Commit: Xisco Fauli CommitDate: Thu Jan 19 11:13:11 2023 + tdf#153036 PPTX import resized connector broken Fixed the EdgeLine1Delta calculation in case of bentConnector2. (when L shape imported as a special Z shape) Co-authored-by: Tibor Nagy (NISZ) Change-Id: I08c92e63adc744322061e4e433bfdc512745eda1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145548 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 17c68fad2aef917adfdd3d4d651da786e620699c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145728 diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index c875239aac46..ca296561a52f 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -341,6 +341,36 @@ void SlidePersist::hideShapesAsMasterShapes() } } +// This angle determines in the direction of the line +static sal_Int32 lcl_GetAngle(uno::Reference& rXShape, awt::Point& rPt) +{ +SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rXShape); +tools::Rectangle aR(pObj->GetSnapRect()); +sal_Int32 nLeftX = rPt.X - aR.Left(); +sal_Int32 nTopY = rPt.Y - aR.Top(); +sal_Int32 nRightX = aR.Right() - rPt.X; +sal_Int32 nBottomY = aR.Bottom() - rPt.Y; +sal_Int32 nX = std::min(nLeftX, nRightX); +sal_Int32 nY = std::min(nTopY, nBottomY); + +sal_Int32 nAngle; +if (nX < nY) +{ +if (nLeftX < nRightX) +nAngle = 180; // Left +else +nAngle = 0; // Right +} +else +{ +if (nTopY < nBottomY) +nAngle = 270; // Top +else +nAngle = 90; // Bottom +} +return nAngle; +} + Reference SlidePersist::getAnimationNode(const OUString& sId) const { const auto& pIter = maAnimNodesMap.find(sId); @@ -372,6 +402,8 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, SdrObject* pEndObj = xEndSp.is() ? SdrObject::getSdrObjectFromXShape(xEndSp) : nullptr; sal_Int32 nStartSpLineW = 0; +sal_Int32 nStartA = -1; +sal_Int32 nEndA = -1; if (pStartObj) { aStartRect = pStartObj->GetSnapRect(); @@ -379,6 +411,7 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, xPropxStartSp->getPropertyValue("LineWidth") >>= nStartSpLineW; if (nStartSpLineW) nStartSpLineW = nStartSpLineW / 2; +nStartA = lcl_GetAngle(xStartSp, aStartPt); } sal_Int32 nEndSpLineW = 0; if (pEndObj) @@ -388,6 +421,7 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, xPropxEndSp->getPropertyValue("LineWidth") >>= nEndSpLineW; if (nEndSpLineW) nEndSpLineW = nEndSpLineW / 2; +nEndA = lcl_GetAngle(xEndSp, aEndPt); } const OUString sConnectorName = rShapePtr->getConnectorName(); @@ -396,27 +430,25 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, awt::Size aConnSize = rXConnector->getSize(); if (xStartSp.is() || xEndSp.is()) { -if (aConnSize.Height < aConnSize.Width) +if (nStartA >= 0) { -if (xStartSp.is()) -nEdge = (aStartPt.Y > aEndPt.Y) -? (nStartSpLineW - (aStartRect.Top() - aEndPt.Y)) -: ((aEndPt.Y - aStartRect.Bottom()) - nStartSpLineW); -else -nEdge = (aStartPt.Y > aEndPt.Y) -? ((aStartPt.Y - aEndRect.Bottom()) - nEndSpLineW) -: (nEndSpLineW - (aEndRect.Top() - aStartPt.Y)); -} -else -{ -if (xStartSp.is()) -nEdge = (aStartPt.X > aEndPt.X) -? (nStartSpLineW - (aStartRect.Left() - aEndPt.X)) -: ((aEndPt.X - aStartRect.Right()) - nStartSpLineW); -else -nEdge = (aStartPt.X > aEndPt.X) -? ((aStartPt.X - aEndRect.Right()) - nEndSpLineW) -: (nEndSpLineW - (aEndRect.Left() - aStartPt.X)); +switch (nStartA) +{ +case 0: nEdge = aEndPt.X - aStartRect.Right(); break; +case 180: nEdge = aEndPt.X - aStartRect.Left(); break; +case 90:nEdge = aEndPt.Y
[Libreoffice-commits] core.git: oox/source sd/qa
oox/source/ppt/slidepersist.cxx | 72 +- sd/qa/unit/data/pptx/tdf153036_resizedConnectorL.pptx |binary sd/qa/unit/import-tests.cxx | 16 3 files changed, 68 insertions(+), 20 deletions(-) New commits: commit 17c68fad2aef917adfdd3d4d651da786e620699c Author: Attila Szűcs AuthorDate: Mon Jan 16 04:13:07 2023 +0100 Commit: Andras Timar CommitDate: Thu Jan 19 08:27:39 2023 + tdf#153036 PPTX import resized connector broken Fixed the EdgeLine1Delta calculation in case of bentConnector2. (when L shape imported as a special Z shape) Co-authored-by: Tibor Nagy (NISZ) Change-Id: I08c92e63adc744322061e4e433bfdc512745eda1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145548 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index c875239aac46..ca296561a52f 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -341,6 +341,36 @@ void SlidePersist::hideShapesAsMasterShapes() } } +// This angle determines in the direction of the line +static sal_Int32 lcl_GetAngle(uno::Reference& rXShape, awt::Point& rPt) +{ +SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rXShape); +tools::Rectangle aR(pObj->GetSnapRect()); +sal_Int32 nLeftX = rPt.X - aR.Left(); +sal_Int32 nTopY = rPt.Y - aR.Top(); +sal_Int32 nRightX = aR.Right() - rPt.X; +sal_Int32 nBottomY = aR.Bottom() - rPt.Y; +sal_Int32 nX = std::min(nLeftX, nRightX); +sal_Int32 nY = std::min(nTopY, nBottomY); + +sal_Int32 nAngle; +if (nX < nY) +{ +if (nLeftX < nRightX) +nAngle = 180; // Left +else +nAngle = 0; // Right +} +else +{ +if (nTopY < nBottomY) +nAngle = 270; // Top +else +nAngle = 90; // Bottom +} +return nAngle; +} + Reference SlidePersist::getAnimationNode(const OUString& sId) const { const auto& pIter = maAnimNodesMap.find(sId); @@ -372,6 +402,8 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, SdrObject* pEndObj = xEndSp.is() ? SdrObject::getSdrObjectFromXShape(xEndSp) : nullptr; sal_Int32 nStartSpLineW = 0; +sal_Int32 nStartA = -1; +sal_Int32 nEndA = -1; if (pStartObj) { aStartRect = pStartObj->GetSnapRect(); @@ -379,6 +411,7 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, xPropxStartSp->getPropertyValue("LineWidth") >>= nStartSpLineW; if (nStartSpLineW) nStartSpLineW = nStartSpLineW / 2; +nStartA = lcl_GetAngle(xStartSp, aStartPt); } sal_Int32 nEndSpLineW = 0; if (pEndObj) @@ -388,6 +421,7 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, xPropxEndSp->getPropertyValue("LineWidth") >>= nEndSpLineW; if (nEndSpLineW) nEndSpLineW = nEndSpLineW / 2; +nEndA = lcl_GetAngle(xEndSp, aEndPt); } const OUString sConnectorName = rShapePtr->getConnectorName(); @@ -396,27 +430,25 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, awt::Size aConnSize = rXConnector->getSize(); if (xStartSp.is() || xEndSp.is()) { -if (aConnSize.Height < aConnSize.Width) +if (nStartA >= 0) { -if (xStartSp.is()) -nEdge = (aStartPt.Y > aEndPt.Y) -? (nStartSpLineW - (aStartRect.Top() - aEndPt.Y)) -: ((aEndPt.Y - aStartRect.Bottom()) - nStartSpLineW); -else -nEdge = (aStartPt.Y > aEndPt.Y) -? ((aStartPt.Y - aEndRect.Bottom()) - nEndSpLineW) -: (nEndSpLineW - (aEndRect.Top() - aStartPt.Y)); -} -else -{ -if (xStartSp.is()) -nEdge = (aStartPt.X > aEndPt.X) -? (nStartSpLineW - (aStartRect.Left() - aEndPt.X)) -: ((aEndPt.X - aStartRect.Right()) - nStartSpLineW); -else -nEdge = (aStartPt.X > aEndPt.X) -? ((aStartPt.X - aEndRect.Right()) - nEndSpLineW) -: (nEndSpLineW - (aEndRect.Left() - aStartPt.X)); +switch (nStartA) +{ +case 0: nEdge = aEndPt.X - aStartRect.Right(); break; +case 180: nEdge = aEndPt.X - aStartRect.Left(); break; +case 90:nEdge = aEndPt.Y - aStartRect.Bottom(); break; +case 270: nEdge = aEndPt.Y - aStartRect.Top();break; +} +
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - oox/source sd/qa
oox/source/drawingml/shape.cxx |6 +++ sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx |binary sd/qa/unit/import-tests2.cxx | 25 +++ 3 files changed, 31 insertions(+) New commits: commit 0b91db7bdd624bd5351d132fee0b3eadf637b716 Author: Attila Szűcs AuthorDate: Thu Jan 5 13:29:32 2023 +0100 Commit: Andras Timar CommitDate: Sun Jan 8 16:37:53 2023 + tdf#149588 pptx import: transparency at SolidFill When copied color (RGB) property from text content to shape, copy alpha component as well. (If text color have alpha component) Change-Id: Ib86c48ab7b2d3c5f9491a2211b05e90b2c2ea10f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145079 Tested-by: Jenkins Reviewed-by: Andras Timar Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145140 Tested-by: Jenkins CollaboraOffice diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index bbea8f21abab..7740c2e153be 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -545,6 +545,12 @@ static void lcl_createPresetShape(const uno::Reference& xShape, const sal_Int32 aFillColor = static_cast( pProperties.maFillProperties.maFillColor.getColor( rGraphicHelper ).GetRGBColor() ); xSet->setPropertyValue( UNO_NAME_FILLCOLOR, uno::makeAny( aFillColor ) ); + +if (pProperties.maFillProperties.maFillColor.hasTransparency()) +{ +const sal_Int16 aTransparence = pProperties.maFillProperties.maFillColor.getTransparency(); +xSet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, uno::Any(aTransparence)); +} } else { diff --git a/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx b/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx new file mode 100644 index ..8967590b9284 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 41b3a77cf5ab..da74fafb6a9c 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -177,6 +177,7 @@ public: void testCropToZero(); void testTdf144092TableHeight(); void testTdf151547TransparentWhiteText(); +void testTdf149588TransparentSolidFill(); CPPUNIT_TEST_SUITE(SdImportTest2); @@ -246,6 +247,7 @@ public: CPPUNIT_TEST(testCropToZero); CPPUNIT_TEST(testTdf144092TableHeight); CPPUNIT_TEST(testTdf151547TransparentWhiteText); +CPPUNIT_TEST(testTdf149588TransparentSolidFill); CPPUNIT_TEST_SUITE_END(); }; @@ -2040,6 +2042,29 @@ void SdImportTest2::testTdf151547TransparentWhiteText() xDocShRef->DoClose(); } +void SdImportTest2::testTdf149588TransparentSolidFill() +{ +sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx"), +PPTX); + +xDocShRef = saveAndReload(xDocShRef.get(), PPTX); + +uno::Reference xShape(getShapeFromPage(6, 0, xDocShRef)); +uno::Reference xParagraph(getParagraphFromShape(0, xShape)); +uno::Reference xRun(getRunFromParagraph(0, xParagraph)); +uno::Reference xPropSet(xRun, uno::UNO_QUERY_THROW); + +Color nCharColor; +xPropSet->getPropertyValue("CharColor") >>= nCharColor; +// Without the accompanying fix in place, this test would have failed with: +// - Expected: Color: R:99 G:99 B:99 A 51 (T:204) +// - Actual : Color: R:99 G:99 B:99 A: 255 (T: 0) +CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xCC636363), nCharColor); + +xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2); CPPUNIT_PLUGIN_IMPLEMENT();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - oox/source sd/qa
oox/source/drawingml/shape.cxx |6 sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx |binary sd/qa/unit/import-tests2.cxx | 20 +++ 3 files changed, 26 insertions(+) New commits: commit c27ba904366a966c2f4cc8fe2a04d47a41b3cc1d Author: Attila Szűcs AuthorDate: Wed Jan 4 00:40:23 2023 +0100 Commit: Andras Timar CommitDate: Fri Jan 6 09:29:22 2023 + tdf#149588 pptx import: transparency at SolidFill When copied color (RGB) property from text content to shape, copy alpha component as well. (If text color have alpha component) Change-Id: Ib86c48ab7b2d3c5f9491a2211b05e90b2c2ea10f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145031 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 0cc9aaae5dc6655490513e8e4a93967f6248e23c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145004 diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index a9b869e86af2..059785edf6e5 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -852,6 +852,12 @@ static void lcl_copyCharPropsToShape(const uno::Reference& xSha aFillColor = static_cast( rCharProps.maFillProperties.maFillColor.getColor(rFilter.getGraphicHelper()) .GetRGBColor()); +if (rCharProps.maFillProperties.maFillColor.hasTransparency()) +{ +const sal_Int16 aTransparence += rCharProps.maFillProperties.maFillColor.getTransparency(); +xSet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, uno::Any(aTransparence)); +} } xSet->setPropertyValue(UNO_NAME_FILLCOLOR, uno::Any(aFillColor)); diff --git a/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx b/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx new file mode 100644 index ..8967590b9284 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index b258c535e2c6..5d5864a2891e 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -145,6 +145,7 @@ public: void testTdf89928BlackWhiteThreshold(); void testTdf151547TransparentWhiteText(); void testTdf149961AutofitIndentation(); +void testTdf149588TransparentSolidFill(); CPPUNIT_TEST_SUITE(SdImportTest2); @@ -223,6 +224,7 @@ public: CPPUNIT_TEST(testTdf89928BlackWhiteThreshold); CPPUNIT_TEST(testTdf151547TransparentWhiteText); CPPUNIT_TEST(testTdf149961AutofitIndentation); +CPPUNIT_TEST(testTdf149588TransparentSolidFill); CPPUNIT_TEST_SUITE_END(); }; @@ -2009,6 +2011,24 @@ void SdImportTest2::testTdf149961AutofitIndentation() } } +void SdImportTest2::testTdf149588TransparentSolidFill() +{ +createSdImpressDoc("pptx/tdf149588_transparentSolidFill.pptx"); +saveAndReload("Impress MS PowerPoint 2007 XML"); + +uno::Reference xShape(getShapeFromPage(6, 0)); +uno::Reference xParagraph(getParagraphFromShape(0, xShape)); +uno::Reference xRun(getRunFromParagraph(0, xParagraph)); +uno::Reference xPropSet(xRun, uno::UNO_QUERY_THROW); + +Color nCharColor; +xPropSet->getPropertyValue("CharColor") >>= nCharColor; +// Without the accompanying fix in place, this test would have failed with: +// - Expected: Color: R:99 G:99 B:99 A 51 (T:204) +// - Actual : Color: R:99 G:99 B:99 A: 255 (T: 0) +CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xCC636363), nCharColor); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2); CPPUNIT_PLUGIN_IMPLEMENT();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - oox/source sd/qa
oox/source/drawingml/shape.cxx |6 +++ sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx |binary sd/qa/unit/import-tests2.cxx | 25 +++ 3 files changed, 31 insertions(+) New commits: commit 2e3cf5e21c9a4aba8623e89e5e472efa6586619d Author: Attila Szűcs AuthorDate: Thu Jan 5 13:29:32 2023 +0100 Commit: Andras Timar CommitDate: Fri Jan 6 09:29:32 2023 + tdf#149588 pptx import: transparency at SolidFill When copied color (RGB) property from text content to shape, copy alpha component as well. (If text color have alpha component) Change-Id: Ib86c48ab7b2d3c5f9491a2211b05e90b2c2ea10f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145079 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 1dd4eb319c26..8fefc18fdbf6 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -662,6 +662,12 @@ static void lcl_createPresetShape(const uno::Reference& xShape, const sal_Int32 aFillColor = static_cast( pProperties.maFillProperties.maFillColor.getColor( rGraphicHelper ).GetRGBColor() ); xSet->setPropertyValue( UNO_NAME_FILLCOLOR, uno::Any( aFillColor ) ); + +if (pProperties.maFillProperties.maFillColor.hasTransparency()) +{ +const sal_Int16 aTransparence = pProperties.maFillProperties.maFillColor.getTransparency(); +xSet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, uno::Any(aTransparence)); +} } else { diff --git a/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx b/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx new file mode 100644 index ..8967590b9284 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 969eb250fb80..e9f2ce067740 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -141,6 +141,7 @@ public: void testTdf89928BlackWhiteThreshold(); void testTdf151547TransparentWhiteText(); void testTdf149961AutofitIndentation(); +void testTdf149588TransparentSolidFill(); CPPUNIT_TEST_SUITE(SdImportTest2); @@ -216,6 +217,7 @@ public: CPPUNIT_TEST(testTdf89928BlackWhiteThreshold); CPPUNIT_TEST(testTdf151547TransparentWhiteText); CPPUNIT_TEST(testTdf149961AutofitIndentation); +CPPUNIT_TEST(testTdf149588TransparentSolidFill); CPPUNIT_TEST_SUITE_END(); }; @@ -2206,6 +2208,29 @@ void SdImportTest2::testTdf149961AutofitIndentation() } } +void SdImportTest2::testTdf149588TransparentSolidFill() +{ +sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx"), +PPTX); + +xDocShRef = saveAndReload(xDocShRef.get(), PPTX); + +uno::Reference xShape(getShapeFromPage(6, 0, xDocShRef)); +uno::Reference xParagraph(getParagraphFromShape(0, xShape)); +uno::Reference xRun(getRunFromParagraph(0, xParagraph)); +uno::Reference xPropSet(xRun, uno::UNO_QUERY_THROW); + +Color nCharColor; +xPropSet->getPropertyValue("CharColor") >>= nCharColor; +// Without the accompanying fix in place, this test would have failed with: +// - Expected: Color: R:99 G:99 B:99 A 51 (T:204) +// - Actual : Color: R:99 G:99 B:99 A: 255 (T: 0) +CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xCC636363), nCharColor); + +xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2); CPPUNIT_PLUGIN_IMPLEMENT();
[Libreoffice-commits] core.git: oox/source sd/qa
oox/source/drawingml/shape.cxx |6 sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx |binary sd/qa/unit/import-tests2.cxx | 20 +++ 3 files changed, 26 insertions(+) New commits: commit 0cc9aaae5dc6655490513e8e4a93967f6248e23c Author: Attila Szűcs AuthorDate: Wed Jan 4 00:40:23 2023 +0100 Commit: Andras Timar CommitDate: Wed Jan 4 20:38:38 2023 + tdf#149588 pptx import: transparency at SolidFill When copied color (RGB) property from text content to shape, copy alpha component as well. (If text color have alpha component) Change-Id: Ib86c48ab7b2d3c5f9491a2211b05e90b2c2ea10f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145031 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index fcc1e9016170..7cd02f77f91f 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -708,6 +708,12 @@ static void lcl_copyCharPropsToShape(const uno::Reference& xSha aFillColor = static_cast( rCharProps.maFillProperties.maFillColor.getColor(rFilter.getGraphicHelper()) .GetRGBColor()); +if (rCharProps.maFillProperties.maFillColor.hasTransparency()) +{ +const sal_Int16 aTransparence += rCharProps.maFillProperties.maFillColor.getTransparency(); +xSet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, uno::Any(aTransparence)); +} } xSet->setPropertyValue(UNO_NAME_FILLCOLOR, uno::Any(aFillColor)); diff --git a/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx b/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx new file mode 100644 index ..8967590b9284 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index b258c535e2c6..5d5864a2891e 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -145,6 +145,7 @@ public: void testTdf89928BlackWhiteThreshold(); void testTdf151547TransparentWhiteText(); void testTdf149961AutofitIndentation(); +void testTdf149588TransparentSolidFill(); CPPUNIT_TEST_SUITE(SdImportTest2); @@ -223,6 +224,7 @@ public: CPPUNIT_TEST(testTdf89928BlackWhiteThreshold); CPPUNIT_TEST(testTdf151547TransparentWhiteText); CPPUNIT_TEST(testTdf149961AutofitIndentation); +CPPUNIT_TEST(testTdf149588TransparentSolidFill); CPPUNIT_TEST_SUITE_END(); }; @@ -2009,6 +2011,24 @@ void SdImportTest2::testTdf149961AutofitIndentation() } } +void SdImportTest2::testTdf149588TransparentSolidFill() +{ +createSdImpressDoc("pptx/tdf149588_transparentSolidFill.pptx"); +saveAndReload("Impress MS PowerPoint 2007 XML"); + +uno::Reference xShape(getShapeFromPage(6, 0)); +uno::Reference xParagraph(getParagraphFromShape(0, xShape)); +uno::Reference xRun(getRunFromParagraph(0, xParagraph)); +uno::Reference xPropSet(xRun, uno::UNO_QUERY_THROW); + +Color nCharColor; +xPropSet->getPropertyValue("CharColor") >>= nCharColor; +// Without the accompanying fix in place, this test would have failed with: +// - Expected: Color: R:99 G:99 B:99 A 51 (T:204) +// - Actual : Color: R:99 G:99 B:99 A: 255 (T: 0) +CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xCC636363), nCharColor); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2); CPPUNIT_PLUGIN_IMPLEMENT();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 15 + sc/source/filter/excel/xeroot.cxx|1 sc/source/filter/excel/xestyle.cxx | 16 ++ sc/source/filter/inc/xestyle.hxx |3 + 5 files changed, 35 insertions(+) New commits: commit 3e9e457f931502b9a64fd8b58b37ad1fe4c9ebbe Author: Attila Szűcs AuthorDate: Mon Dec 19 05:35:36 2022 +0100 Commit: Xisco Fauli CommitDate: Tue Dec 20 14:45:23 2022 + tdf#152581 SC: fix export of conditional border color Call XclExpDxf::mpBorder->SetFinalColors(..) during export, before SaveXml(). It will calculate the prepered colors from mnLeftColorId to mnLeftColor, so saveXml() will be able to save it. Change-Id: I1a1ed621c6d0e883cb9016e60ae0b344bf90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144576 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit b66e35c721742d2ad1c8c2cc3251661b6ce81952) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144600 Reviewed-by: Xisco Fauli diff --git a/sc/qa/unit/data/xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx b/sc/qa/unit/data/xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx new file mode 100644 index ..2423f4cc0243 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 40fb4f360536..ce7ac0c43d2f 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -167,6 +167,7 @@ public: void testTdf144642_RowHeightRounding(); void testTdf145129_DefaultRowHeightRounding(); void testTdf151755_stylesLostOnXLSXExport(); +void testTdf152581_bordercolorNotExportedToXLSX(); void testTdf140431(); void testCheckboxFormControlXlsxExport(); void testButtonFormControlXlsxExport(); @@ -295,6 +296,7 @@ public: CPPUNIT_TEST(testTdf144642_RowHeightRounding); CPPUNIT_TEST(testTdf145129_DefaultRowHeightRounding); CPPUNIT_TEST(testTdf151755_stylesLostOnXLSXExport); +CPPUNIT_TEST(testTdf152581_bordercolorNotExportedToXLSX); CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testCheckboxFormControlXlsxExport); CPPUNIT_TEST(testButtonFormControlXlsxExport); @@ -2290,6 +2292,19 @@ void ScExportTest2::testTdf151755_stylesLostOnXLSXExport() assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[4]", "s", aCellStyleId); } +void ScExportTest2::testTdf152581_bordercolorNotExportedToXLSX() +{ +createScDoc("xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx"); + +// Resave the xlsx file without any modification. +save("Calc Office Open XML"); +xmlDocUniquePtr pStyles = parseExport("xl/styles.xml"); +CPPUNIT_ASSERT(pStyles); + +// Check if conditional format border color is exported +assertXPath(pStyles, "/x:styleSheet/x:dxfs/x:dxf/x:border/x:left/x:color", "rgb", "FFED7D31"); +} + void ScExportTest2::testTdf140431() { createScDoc("xlsx/129969-min.xlsx"); diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index 38884c48415c..807a24aae60b 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -276,6 +276,7 @@ void XclExpRoot::InitializeSave() { GetPalette().Finalize(); GetXFBuffer().Finalize(); +GetDxfs().Finalize(); } XclExpRecordRef XclExpRoot::CreateRecord( sal_uInt16 nRecId ) const diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index cb1c3c8fe26a..3e335a50110c 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -3210,6 +3210,14 @@ void XclExpDxfs::SaveXml( XclExpXmlStream& rStrm ) rStyleSheet->endElement( XML_dxfs ); } +void XclExpDxfs::Finalize() +{ +for (auto& rxDxf : maDxf) +{ +rxDxf->SetFinalColors(); +} +} + XclExpDxf::XclExpDxf( const XclExpRoot& rRoot, std::unique_ptr pAlign, std::unique_ptr pBorder, std::unique_ptr pFont, std::unique_ptr pNumberFmt, std::unique_ptr pProt, std::unique_ptr pColor) @@ -3233,6 +3241,14 @@ XclExpDxf::~XclExpDxf() { } +void XclExpDxf::SetFinalColors() +{ +if (mpBorder) +{ +mpBorder->SetFinalColors(GetPalette()); +} +} + void XclExpDxf::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream(); diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx index 7857e215557b..8c3493d352f3 100644 --- a/sc/source/filter/inc/xestyle.hxx +++ b/sc/source/filter/inc/xestyle.hxx @@ -734
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 16 ++ sc/source/filter/excel/xeroot.cxx|1 sc/source/filter/excel/xestyle.cxx | 16 ++ sc/source/filter/inc/xestyle.hxx |4 ++ 5 files changed, 37 insertions(+) New commits: commit 77449c9877bff4979e4d9ff0fe489f61e340c975 Author: Attila Szűcs AuthorDate: Mon Dec 19 03:48:13 2022 +0100 Commit: Andras Timar CommitDate: Tue Dec 20 12:57:24 2022 + tdf#152581 SC: fix export of conditional border color Call XclExpDxf::mpBorder->SetFinalColors(..) during export, before SaveXml(). It will calculate the prepered colors from mnLeftColorId to mnLeftColor, so saveXml() will be able to save it. Change-Id: I1a1ed621c6d0e883cb9016e60ae0b344bf90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144411 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx b/sc/qa/unit/data/xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx new file mode 100644 index ..2423f4cc0243 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index bcf262dd42e9..329210a6d9eb 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -205,6 +205,7 @@ public: void testTdf144642_RowHeightRounding(); void testTdf145129_DefaultRowHeightRounding(); void testTdf151755_stylesLostOnXLSXExport(); +void testTdf152581_bordercolorNotExportedToXLSX(); void testTdf140431(); void testCheckboxFormControlXlsxExport(); void testButtonFormControlXlsxExport(); @@ -324,6 +325,7 @@ public: CPPUNIT_TEST(testTdf144642_RowHeightRounding); CPPUNIT_TEST(testTdf145129_DefaultRowHeightRounding); CPPUNIT_TEST(testTdf151755_stylesLostOnXLSXExport); +CPPUNIT_TEST(testTdf152581_bordercolorNotExportedToXLSX); CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testCheckboxFormControlXlsxExport); CPPUNIT_TEST(testButtonFormControlXlsxExport); @@ -2628,6 +2630,20 @@ void ScExportTest2::testTdf151755_stylesLostOnXLSXExport() pShell->DoClose(); } +void ScExportTest2::testTdf152581_bordercolorNotExportedToXLSX() +{ +ScDocShellRef pShell = loadDoc(u"tdf152581_bordercolorNotExportedToXLSX.", FORMAT_XLSX); + +// Resave the xlsx file without any modification. +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(*pShell, FORMAT_XLSX); +xmlDocUniquePtr pStyles = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); +CPPUNIT_ASSERT(pStyles); + +// Check if conditional format border color is exported +assertXPath(pStyles, "/x:styleSheet/x:dxfs/x:dxf/x:border/x:left/x:color", "rgb", "FFED7D31"); +pShell->DoClose(); +} + void ScExportTest2::testTdf140431() { ScDocShellRef xShell = loadDoc(u"129969-min.", FORMAT_XLSX); diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index b0ac71643674..ea6ad3098a29 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -277,6 +277,7 @@ void XclExpRoot::InitializeSave() { GetPalette().Finalize(); GetXFBuffer().Finalize(); +GetDxfs().Finalize(); } XclExpRecordRef XclExpRoot::CreateRecord( sal_uInt16 nRecId ) const diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 1dd6401a79eb..63386c63555c 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -3210,6 +3210,14 @@ void XclExpDxfs::SaveXml( XclExpXmlStream& rStrm ) rStyleSheet->endElement( XML_dxfs ); } +void XclExpDxfs::Finalize() +{ +for (auto& rxDxf : maDxf) +{ +rxDxf->SetFinalColors(); +} +} + XclExpDxf::XclExpDxf( const XclExpRoot& rRoot, std::unique_ptr pAlign, std::unique_ptr pBorder, std::unique_ptr pFont, std::unique_ptr pNumberFmt, std::unique_ptr pProt, std::unique_ptr pColor) @@ -3233,6 +3241,14 @@ XclExpDxf::~XclExpDxf() { } +void XclExpDxf::SetFinalColors() +{ +if (mpBorder) +{ +mpBorder->SetFinalColors(GetPalette()); +} +} + void XclExpDxf::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream(); diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx index 26ba9fcf8e39..84b03dc846a7 100644 --- a/sc/source/filter/inc/xestyle.hxx +++ b/sc/source/filter/inc/xestyle.hxx @@ -734,6 +734,8 @@ public: virtual void SaveXml( XclExpXmlStream& rSt
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 15 + sc/source/filter/excel/xeroot.cxx|1 sc/source/filter/excel/xestyle.cxx | 16 ++ sc/source/filter/inc/xestyle.hxx |3 + 5 files changed, 35 insertions(+) New commits: commit b66e35c721742d2ad1c8c2cc3251661b6ce81952 Author: Attila Szűcs AuthorDate: Mon Dec 19 05:35:36 2022 +0100 Commit: Andras Timar CommitDate: Tue Dec 20 12:57:14 2022 + tdf#152581 SC: fix export of conditional border color Call XclExpDxf::mpBorder->SetFinalColors(..) during export, before SaveXml(). It will calculate the prepered colors from mnLeftColorId to mnLeftColor, so saveXml() will be able to save it. Change-Id: I1a1ed621c6d0e883cb9016e60ae0b344bf90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144576 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx b/sc/qa/unit/data/xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx new file mode 100644 index ..2423f4cc0243 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 9717f3579972..5a1ebc5c2d3c 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -167,6 +167,7 @@ public: void testTdf144642_RowHeightRounding(); void testTdf145129_DefaultRowHeightRounding(); void testTdf151755_stylesLostOnXLSXExport(); +void testTdf152581_bordercolorNotExportedToXLSX(); void testTdf140431(); void testCheckboxFormControlXlsxExport(); void testButtonFormControlXlsxExport(); @@ -295,6 +296,7 @@ public: CPPUNIT_TEST(testTdf144642_RowHeightRounding); CPPUNIT_TEST(testTdf145129_DefaultRowHeightRounding); CPPUNIT_TEST(testTdf151755_stylesLostOnXLSXExport); +CPPUNIT_TEST(testTdf152581_bordercolorNotExportedToXLSX); CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testCheckboxFormControlXlsxExport); CPPUNIT_TEST(testButtonFormControlXlsxExport); @@ -2290,6 +2292,19 @@ void ScExportTest2::testTdf151755_stylesLostOnXLSXExport() assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[4]", "s", aCellStyleId); } +void ScExportTest2::testTdf152581_bordercolorNotExportedToXLSX() +{ +createScDoc("xlsx/tdf152581_bordercolorNotExportedToXLSX.xlsx"); + +// Resave the xlsx file without any modification. +save("Calc Office Open XML"); +xmlDocUniquePtr pStyles = parseExport("xl/styles.xml"); +CPPUNIT_ASSERT(pStyles); + +// Check if conditional format border color is exported +assertXPath(pStyles, "/x:styleSheet/x:dxfs/x:dxf/x:border/x:left/x:color", "rgb", "FFED7D31"); +} + void ScExportTest2::testTdf140431() { createScDoc("xlsx/129969-min.xlsx"); diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index 38884c48415c..807a24aae60b 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -276,6 +276,7 @@ void XclExpRoot::InitializeSave() { GetPalette().Finalize(); GetXFBuffer().Finalize(); +GetDxfs().Finalize(); } XclExpRecordRef XclExpRoot::CreateRecord( sal_uInt16 nRecId ) const diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index cb1c3c8fe26a..3e335a50110c 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -3210,6 +3210,14 @@ void XclExpDxfs::SaveXml( XclExpXmlStream& rStrm ) rStyleSheet->endElement( XML_dxfs ); } +void XclExpDxfs::Finalize() +{ +for (auto& rxDxf : maDxf) +{ +rxDxf->SetFinalColors(); +} +} + XclExpDxf::XclExpDxf( const XclExpRoot& rRoot, std::unique_ptr pAlign, std::unique_ptr pBorder, std::unique_ptr pFont, std::unique_ptr pNumberFmt, std::unique_ptr pProt, std::unique_ptr pColor) @@ -3233,6 +3241,14 @@ XclExpDxf::~XclExpDxf() { } +void XclExpDxf::SetFinalColors() +{ +if (mpBorder) +{ +mpBorder->SetFinalColors(GetPalette()); +} +} + void XclExpDxf::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream(); diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx index 7857e215557b..8c3493d352f3 100644 --- a/sc/source/filter/inc/xestyle.hxx +++ b/sc/source/filter/inc/xestyle.hxx @@ -734,6 +734,7 @@ public: virtual void SaveXml( XclExpXmlStream& rStrm ) override; void SaveXmlExt( XclExpXmlStream& rStrm); +void SetFinalColors();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 22 + sc/source/filter/excel/xetable.cxx |8 ++-- 3 files changed, 27 insertions(+), 3 deletions(-) New commits: commit 8a6851964134915d29cfbcd409ac80dc7f257261 Author: Attila Szűcs AuthorDate: Tue Nov 29 09:45:36 2022 +0100 Commit: Xisco Fauli CommitDate: Mon Dec 19 15:12:28 2022 + tdf#151755 fix export of borders of contentless cells Change-Id: I650aeebb4d021911c1f14d4867c5beee84020155 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143880 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit c57d113e9ef8608f5690e8707a97879cb4f6a185) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144424 Reviewed-by: Xisco Fauli Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144459 diff --git a/sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx b/sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx new file mode 100644 index ..e48562022af8 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 7e9282e6a53c..ce53077fc451 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -175,6 +175,7 @@ public: void testTdf142854_GridVisibilityImportXlsxInHeadlessMode(); void testTdf144642_RowHeightRounding(); void testTdf145129_DefaultRowHeightRounding(); +void testTdf151755_stylesLostOnXLSXExport(); void testTdf140431(); void testCheckboxFormControlXlsxExport(); void testButtonFormControlXlsxExport(); @@ -299,6 +300,7 @@ public: CPPUNIT_TEST(testTdf142854_GridVisibilityImportXlsxInHeadlessMode); CPPUNIT_TEST(testTdf144642_RowHeightRounding); CPPUNIT_TEST(testTdf145129_DefaultRowHeightRounding); +CPPUNIT_TEST(testTdf151755_stylesLostOnXLSXExport); CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testCheckboxFormControlXlsxExport); CPPUNIT_TEST(testButtonFormControlXlsxExport); @@ -2542,6 +2544,26 @@ void ScExportTest2::testTdf145129_DefaultRowHeightRounding() xShell->DoClose(); } +void ScExportTest2::testTdf151755_stylesLostOnXLSXExport() +{ +// Check if empty cells with custom sytle are exported, even if +// there is other empty cells with default style, left of it. +ScDocShellRef xShell = loadDoc(u"tdf151755_stylesLostOnXLSXExport.", FORMAT_XLSX); + +// Resave the xlsx file without any modification. +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); +xmlDocUniquePtr pSheet += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pSheet); + +// Check if all the 3 empty cells with styles are saved, and have the same style id. +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c", 4); +OUString aCellStyleId = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]", "s"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]", "s", aCellStyleId); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[3]", "s", aCellStyleId); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[4]", "s", aCellStyleId); +} + void ScExportTest2::testTdf140431() { ScDocShellRef xShell = loadDoc(u"129969-min.", FORMAT_XLSX); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 83c7f5048d6a..728ea23397d2 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -1310,12 +1310,14 @@ void XclExpMultiCellBase::RemoveUnusedXFIndexes( const ScfUInt16Vec& rXFIndexes, sal_uInt16 XclExpMultiCellBase::GetStartColAllDefaultCell() const { sal_uInt16 col = GetXclCol(); +sal_uInt16 nMaxNonDefCol = col; for( const auto& rXFId : maXFIds ) { -if( rXFId.mnXFIndex != EXC_XF_DEFAULTCELL ) -col += rXFId.mnCount; +col += rXFId.mnCount; +if (rXFId.mnXFIndex != EXC_XF_DEFAULTCELL) +nMaxNonDefCol = col; } -return col; +return nMaxNonDefCol; } XclExpBlankCell::XclExpBlankCell( const XclAddress& rXclPos, const XclExpMultiXFId& rXFId ) :
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 21 + sc/source/filter/excel/xetable.cxx |8 +++- 3 files changed, 26 insertions(+), 3 deletions(-) New commits: commit c79bd967dc26259115bf2a5f36e60f34575fbd97 Author: Attila Szűcs AuthorDate: Tue Nov 29 09:45:36 2022 +0100 Commit: Xisco Fauli CommitDate: Mon Dec 19 09:30:49 2022 + tdf#151755 fix export of borders of contentless cells Change-Id: I650aeebb4d021911c1f14d4867c5beee84020155 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143880 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit c57d113e9ef8608f5690e8707a97879cb4f6a185) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144424 Reviewed-by: Xisco Fauli diff --git a/sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx b/sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx new file mode 100644 index ..e48562022af8 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 4010cc9dce1f..40fb4f360536 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -166,6 +166,7 @@ public: void testTdf139258_rotated_image(); void testTdf144642_RowHeightRounding(); void testTdf145129_DefaultRowHeightRounding(); +void testTdf151755_stylesLostOnXLSXExport(); void testTdf140431(); void testCheckboxFormControlXlsxExport(); void testButtonFormControlXlsxExport(); @@ -293,6 +294,7 @@ public: CPPUNIT_TEST(testTdf139258_rotated_image); CPPUNIT_TEST(testTdf144642_RowHeightRounding); CPPUNIT_TEST(testTdf145129_DefaultRowHeightRounding); +CPPUNIT_TEST(testTdf151755_stylesLostOnXLSXExport); CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testCheckboxFormControlXlsxExport); CPPUNIT_TEST(testButtonFormControlXlsxExport); @@ -2269,6 +2271,25 @@ void ScExportTest2::testTdf145129_DefaultRowHeightRounding() CPPUNIT_ASSERT_EQUAL(tools::Long(555 * 52), pDoc->GetRowHeight(0, 51, 0, true)); } +void ScExportTest2::testTdf151755_stylesLostOnXLSXExport() +{ +// Check if empty cells with custom sytle are exported, even if +// there is other empty cells with default style, left of it. +createScDoc("xlsx/tdf151755_stylesLostOnXLSXExport.xlsx"); + +// Resave the xlsx file without any modification. +save("Calc Office Open XML"); +xmlDocUniquePtr pSheet = parseExport("xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pSheet); + +// Check if all the 3 empty cells with styles are saved, and have the same style id. +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c", 4); +OUString aCellStyleId = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]", "s"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]", "s", aCellStyleId); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[3]", "s", aCellStyleId); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[4]", "s", aCellStyleId); +} + void ScExportTest2::testTdf140431() { createScDoc("xlsx/129969-min.xlsx"); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 146f6a06833b..e7abb111c63e 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -1310,12 +1310,14 @@ void XclExpMultiCellBase::RemoveUnusedXFIndexes( const ScfUInt16Vec& rXFIndexes, sal_uInt16 XclExpMultiCellBase::GetStartColAllDefaultCell() const { sal_uInt16 col = GetXclCol(); +sal_uInt16 nMaxNonDefCol = col; for( const auto& rXFId : maXFIds ) { -if( rXFId.mnXFIndex != EXC_XF_DEFAULTCELL ) -col += rXFId.mnCount; +col += rXFId.mnCount; +if (rXFId.mnXFIndex != EXC_XF_DEFAULTCELL) +nMaxNonDefCol = col; } -return col; +return nMaxNonDefCol; } XclExpBlankCell::XclExpBlankCell( const XclAddress& rXclPos, const XclExpMultiXFId& rXFId ) :
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 21 + sc/source/filter/excel/xetable.cxx |8 +++- 3 files changed, 26 insertions(+), 3 deletions(-) New commits: commit c57d113e9ef8608f5690e8707a97879cb4f6a185 Author: Attila Szűcs AuthorDate: Tue Nov 29 09:45:36 2022 +0100 Commit: Andras Timar CommitDate: Mon Dec 19 06:16:08 2022 + tdf#151755 fix export of borders of contentless cells Change-Id: I650aeebb4d021911c1f14d4867c5beee84020155 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143880 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx b/sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx new file mode 100644 index ..e48562022af8 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 4010cc9dce1f..40fb4f360536 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -166,6 +166,7 @@ public: void testTdf139258_rotated_image(); void testTdf144642_RowHeightRounding(); void testTdf145129_DefaultRowHeightRounding(); +void testTdf151755_stylesLostOnXLSXExport(); void testTdf140431(); void testCheckboxFormControlXlsxExport(); void testButtonFormControlXlsxExport(); @@ -293,6 +294,7 @@ public: CPPUNIT_TEST(testTdf139258_rotated_image); CPPUNIT_TEST(testTdf144642_RowHeightRounding); CPPUNIT_TEST(testTdf145129_DefaultRowHeightRounding); +CPPUNIT_TEST(testTdf151755_stylesLostOnXLSXExport); CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testCheckboxFormControlXlsxExport); CPPUNIT_TEST(testButtonFormControlXlsxExport); @@ -2269,6 +2271,25 @@ void ScExportTest2::testTdf145129_DefaultRowHeightRounding() CPPUNIT_ASSERT_EQUAL(tools::Long(555 * 52), pDoc->GetRowHeight(0, 51, 0, true)); } +void ScExportTest2::testTdf151755_stylesLostOnXLSXExport() +{ +// Check if empty cells with custom sytle are exported, even if +// there is other empty cells with default style, left of it. +createScDoc("xlsx/tdf151755_stylesLostOnXLSXExport.xlsx"); + +// Resave the xlsx file without any modification. +save("Calc Office Open XML"); +xmlDocUniquePtr pSheet = parseExport("xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pSheet); + +// Check if all the 3 empty cells with styles are saved, and have the same style id. +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c", 4); +OUString aCellStyleId = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]", "s"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]", "s", aCellStyleId); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[3]", "s", aCellStyleId); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[4]", "s", aCellStyleId); +} + void ScExportTest2::testTdf140431() { createScDoc("xlsx/129969-min.xlsx"); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 146f6a06833b..e7abb111c63e 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -1310,12 +1310,14 @@ void XclExpMultiCellBase::RemoveUnusedXFIndexes( const ScfUInt16Vec& rXFIndexes, sal_uInt16 XclExpMultiCellBase::GetStartColAllDefaultCell() const { sal_uInt16 col = GetXclCol(); +sal_uInt16 nMaxNonDefCol = col; for( const auto& rXFId : maXFIds ) { -if( rXFId.mnXFIndex != EXC_XF_DEFAULTCELL ) -col += rXFId.mnCount; +col += rXFId.mnCount; +if (rXFId.mnXFIndex != EXC_XF_DEFAULTCELL) +nMaxNonDefCol = col; } -return col; +return nMaxNonDefCol; } XclExpBlankCell::XclExpBlankCell( const XclAddress& rXclPos, const XclExpMultiXFId& rXFId ) :
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 23 + sc/source/filter/excel/xetable.cxx |8 ++-- 3 files changed, 28 insertions(+), 3 deletions(-) New commits: commit 9934947c36bf1a1e548f667c72fba1891bbb2cff Author: Attila Szűcs AuthorDate: Tue Nov 29 09:45:36 2022 +0100 Commit: Andras Timar CommitDate: Tue Dec 13 15:51:35 2022 + tdf#151755 fix export of borders of contentless cells Change-Id: I650aeebb4d021911c1f14d4867c5beee84020155 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143431 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx b/sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx new file mode 100644 index ..e48562022af8 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf151755_stylesLostOnXLSXExport.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index c958f40402ef..bcf262dd42e9 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -204,6 +204,7 @@ public: void testTdf142854_GridVisibilityImportXlsxInHeadlessMode(); void testTdf144642_RowHeightRounding(); void testTdf145129_DefaultRowHeightRounding(); +void testTdf151755_stylesLostOnXLSXExport(); void testTdf140431(); void testCheckboxFormControlXlsxExport(); void testButtonFormControlXlsxExport(); @@ -322,6 +323,7 @@ public: CPPUNIT_TEST(testTdf142854_GridVisibilityImportXlsxInHeadlessMode); CPPUNIT_TEST(testTdf144642_RowHeightRounding); CPPUNIT_TEST(testTdf145129_DefaultRowHeightRounding); +CPPUNIT_TEST(testTdf151755_stylesLostOnXLSXExport); CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testCheckboxFormControlXlsxExport); CPPUNIT_TEST(testButtonFormControlXlsxExport); @@ -2605,6 +2607,27 @@ void ScExportTest2::testTdf145129_DefaultRowHeightRounding() xShell->DoClose(); } +void ScExportTest2::testTdf151755_stylesLostOnXLSXExport() +{ +// Check if empty cells with custom sytle are exported, even if +// there is other empty cells with default style, left of it. +ScDocShellRef pShell = loadDoc(u"tdf151755_stylesLostOnXLSXExport.", FORMAT_XLSX); + +// Resave the xlsx file without any modification. +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(*pShell, FORMAT_XLSX); +xmlDocUniquePtr pSheet += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pSheet); + +// Check if all the 3 empty cells with styles are saved, and have the same style id. +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c", 4); +OUString aCellStyleId = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]", "s"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]", "s", aCellStyleId); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[3]", "s", aCellStyleId); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[4]", "s", aCellStyleId); +pShell->DoClose(); +} + void ScExportTest2::testTdf140431() { ScDocShellRef xShell = loadDoc(u"129969-min.", FORMAT_XLSX); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index dcbcba7251bb..804c09bd447f 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -1310,12 +1310,14 @@ void XclExpMultiCellBase::RemoveUnusedXFIndexes( const ScfUInt16Vec& rXFIndexes, sal_uInt16 XclExpMultiCellBase::GetStartColAllDefaultCell() const { sal_uInt16 col = GetXclCol(); +sal_uInt16 nMaxNonDefCol = col; for( const auto& rXFId : maXFIds ) { -if( rXFId.mnXFIndex != EXC_XF_DEFAULTCELL ) -col += rXFId.mnCount; +col += rXFId.mnCount; +if (rXFId.mnXFIndex != EXC_XF_DEFAULTCELL) +nMaxNonDefCol = col; } -return col; +return nMaxNonDefCol; } XclExpBlankCell::XclExpBlankCell( const XclAddress& rXclPos, const XclExpMultiXFId& rXFId ) :
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/core/text/data/tdf43100_tdf120715_cursorOnSpacesOverMargin.docx |binary sw/qa/core/text/text.cxx | 68 ++ sw/source/core/text/guess.cxx | 10 + sw/source/core/text/guess.hxx |4 sw/source/core/text/itrcrsr.cxx | 48 +++ sw/source/core/text/itrpaint.cxx |1 sw/source/core/text/itrtxt.hxx|1 sw/source/core/text/porlin.hxx|7 - sw/source/core/text/portxt.cxx| 20 ++ sw/source/core/text/portxt.hxx|1 10 files changed, 132 insertions(+), 28 deletions(-) New commits: commit 690d4eb71509649ad147cfe60f5b97e2cfaaa519 Author: Attila Szűcs AuthorDate: Wed Jun 15 09:16:32 2022 +0200 Commit: László Németh CommitDate: Mon Jul 4 15:34:57 2022 +0200 tdf#43100 tdf#104683 tdf#120715 sw: cursor on spaces over margin Allow cursor movement on spaces over margin (or clicking it it to position the cursor), like MSO does instead of stopping cursor before the stripped (from the typesetting) spaces. This way it's possible to follow the modification of these characters, e.g. removing spaces or inserting other characters at the cursor position. Follow-up to commit 8741fd0e0ae9e346de2e09887f0668b831c9b48b "tdf#43244 sw: show stripped line-end spaces on margin". Details: extend SwHolePortion to calculate its width, that can be used for cursor movement, even over the right margin. Removed some code that not allowed cursor to be positioned over the right margin. Layout calculation uses m_nWidth variable (that was 0) to make frames. To keep the layout unchanged, this new width calculated into m_nExtraBlankWidth temporarily, and this extra width is added to m_nWidth only after the layout calculation is finished. (Ideally this 2 width values could be stored and used separately, but that would require a bigger refactor of the cursor calculation.) Known regression: lost selection at Search & Replace, e.g. searching double spaces: there was a narrow selection at end of the line showing the position. Other issues: when a different character inserted on the margin resulting new line break, space formatting marks aren't updated according to the less spaces. Removing the inserted character by Backspace results losing of the cursor movement on the spaces. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I342b3ac68bef508389f1e227e52a03a22919301e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136613 Reviewed-by: László Németh Tested-by: László Németh diff --git a/sw/qa/core/text/data/tdf43100_tdf120715_cursorOnSpacesOverMargin.docx b/sw/qa/core/text/data/tdf43100_tdf120715_cursorOnSpacesOverMargin.docx new file mode 100644 index ..474d805d893e Binary files /dev/null and b/sw/qa/core/text/data/tdf43100_tdf120715_cursorOnSpacesOverMargin.docx differ diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 2db4d6dab348..99d80f649fef 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -470,6 +470,74 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRedlineDelete) pDoc->getIDocumentRedlineAccess().GetRedlineTable().size()); } +CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf120715_CursorMoveWhenTypingSpaceAtCenteredLineEnd) +{ +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + +// Make a paint to force the call of AddExtraBlankWidth, that calculate width for holePortions. +pDoc->GetDocShell()->GetPreviewBitmap(); + +// Move the cursor to the last character of the document. +pWrtShell->EndOfSection(); + +//Press space and check if the cursor move right with the additional space. +sal_Int32 nOldCursorPos = pWrtShell->GetCharRect().Left(); +pWrtShell->Insert(" "); +sal_Int32 nNewCursorPos = pWrtShell->GetCharRect().Left(); +CPPUNIT_ASSERT_GREATER(nOldCursorPos, nNewCursorPos); +} + +CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf43100_CursorMoveToSpacesOverMargin) +{ +// Test the cursor movement over the right margin in several different paragraphs. +// These differences are based on its paragraphs +// - alignment (left, center, right, justified), +// - line count (1 line, 2 lines, blank line containing only spaces) +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); +SwWrtShell* pWrtShell = pDoc->GetDocShell()-
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/core/text/data/tdf43100_tdf120715_cursorOnSpacesOverMargin.docx |binary sw/qa/core/text/text.cxx | 68 ++ sw/source/core/text/guess.cxx | 10 + sw/source/core/text/guess.hxx |4 sw/source/core/text/itrcrsr.cxx | 46 +++--- sw/source/core/text/itrpaint.cxx |1 sw/source/core/text/itrtxt.hxx|1 sw/source/core/text/porlin.hxx|7 - sw/source/core/text/portxt.cxx| 20 ++ sw/source/core/text/portxt.hxx|1 10 files changed, 131 insertions(+), 27 deletions(-) New commits: commit 7ef9c3ef30023cc40068e1f735aa4bec4811288b Author: Attila Szűcs AuthorDate: Wed Jun 15 09:16:32 2022 +0200 Commit: László Németh CommitDate: Fri Jun 24 14:14:58 2022 +0200 tdf#43100 tdf#104683 tdf#120715 sw: cursor on spaces over margin Allow cursor movement on spaces over margin (or clicking it it to position the cursor), like MSO does instead of stopping cursor before the stripped (from the typesetting) spaces. This way it's possible to follow the modification of these characters, e.g. removing spaces or inserting other characters at the cursor position. Follow-up to commit 8741fd0e0ae9e346de2e09887f0668b831c9b48b "tdf#43244 sw: show stripped line-end spaces on margin". Details: extend SwHolePortion to calculate its width, that can be used for cursor movement, even over the right margin. Removed some code that not allowed cursor to be positioned over the right margin. Layout calculation uses m_nWidth variable (that was 0) to make frames. To keep the layout unchanged, this new width calculated into m_nExtraBlankWidth temporarily, and this extra width is added to m_nWidth only after the layout calculation is finished. (Ideally this 2 width values could be stored and used separately, but that would require a bigger refactor of the cursor calculation.) Known regression: lost selection at Search & Replace, e.g. searching double spaces: there was a narrow selection at end of the line showing the position. Other issues: when a different character inserted on the margin resulting new line break, space formatting marks aren't updated according to the less spaces. Removing the inserted character by Backspace results losing of the cursor movement on the spaces. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I94b4ed40b8c560e1ef32f4d0d3537e070c08666f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135895 Reviewed-by: László Németh Tested-by: László Németh diff --git a/sw/qa/core/text/data/tdf43100_tdf120715_cursorOnSpacesOverMargin.docx b/sw/qa/core/text/data/tdf43100_tdf120715_cursorOnSpacesOverMargin.docx new file mode 100644 index ..474d805d893e Binary files /dev/null and b/sw/qa/core/text/data/tdf43100_tdf120715_cursorOnSpacesOverMargin.docx differ diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 2db4d6dab348..99d80f649fef 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -470,6 +470,74 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRedlineDelete) pDoc->getIDocumentRedlineAccess().GetRedlineTable().size()); } +CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf120715_CursorMoveWhenTypingSpaceAtCenteredLineEnd) +{ +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + +// Make a paint to force the call of AddExtraBlankWidth, that calculate width for holePortions. +pDoc->GetDocShell()->GetPreviewBitmap(); + +// Move the cursor to the last character of the document. +pWrtShell->EndOfSection(); + +//Press space and check if the cursor move right with the additional space. +sal_Int32 nOldCursorPos = pWrtShell->GetCharRect().Left(); +pWrtShell->Insert(" "); +sal_Int32 nNewCursorPos = pWrtShell->GetCharRect().Left(); +CPPUNIT_ASSERT_GREATER(nOldCursorPos, nNewCursorPos); +} + +CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf43100_CursorMoveToSpacesOverMargin) +{ +// Test the cursor movement over the right margin in several different paragraphs. +// These differences are based on its paragraphs +// - alignment (left, center, right, justified), +// - line count (1 line, 2 lines, blank line containing only spaces) +SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); +SwWrtShell* pWrtShell = pDoc->GetDocShell()-
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/source
sc/source/ui/view/viewdata.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit cb232588e15e9b80cbba1ce698a962eb02e15e5e Author: Attila Szűcs AuthorDate: Tue Jun 21 15:27:35 2022 +0200 Commit: Xisco Fauli CommitDate: Fri Jun 24 13:48:41 2022 +0200 tdf#149574 sc: fix missing nullptr check Regression from commit 605b4ba57b2daa447af9d43d3759079e15df8148 "tdf#43958 sc: fix fill by selecting merged cell". Check if GetPattern(actual cell) is not nullptr, before using it. This is not the real problem of Bug 149574, but it is a problem anyway, and it fixes this bug. The real problem is the wrong ViewData::nTabNo, that point to an already deleted table, (fixed in 954d119db932434dc976ef739c643be0d9c7023c "tdf#149502 sc: crash fix: Change in Table destruction"). Co-authored-by: Tibor Nagy (NISZ) Change-Id: I26fc629ccf354c9e0c2662d61254d01be91d08f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136230 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit c4c827e1d370dcc351c4dddc601b3c37fc71564b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136322 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 88d57f106a3b..69ebe09d22d4 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1155,7 +1155,7 @@ ScMarkType ScViewData::GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) if (eMarkType == SC_MARK_NONE) eMarkType = SC_MARK_SIMPLE; const ScPatternAttr* pMarkPattern = mrDoc.GetPattern(GetCurX(), GetCurY(), GetTabNo()); -if (pMarkPattern->GetItemSet().GetItemState(ATTR_MERGE, false) == SfxItemState::SET) +if (pMarkPattern && pMarkPattern->GetItemSet().GetItemState(ATTR_MERGE, false) == SfxItemState::SET) { SCROW nRow = pMarkPattern->GetItem(ATTR_MERGE).GetRowMerge(); SCCOL nCol = pMarkPattern->GetItem(ATTR_MERGE).GetColMerge();
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 38 commits - basctl/source chart2/source drawinglayer/source emfio/qa external/breakpad external/liborcus external/pdfium external/
| 111 sw/source/uibase/inc/wrtsh.hxx| 2 sw/source/uibase/lingu/hhcwrp.cxx | 4 sw/source/uibase/ribbar/inputwin.cxx | 4 sw/source/uibase/utlui/content.cxx| 2 sw/source/uibase/wrtsh/delete.cxx | 30 sw/source/uibase/wrtsh/select.cxx | 4 sw/source/uibase/wrtsh/wrtsh1.cxx | 5 toolkit/source/helper/unowrapper.cxx | 6 ucb/source/ucp/gio/gio_content.cxx| 10 vcl/source/app/salvtables.cxx | 2 vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx | 2 vcl/source/bitmap/BitmapFilterStackBlur.cxx | 2 vcl/source/treelist/treelist.cxx | 8 vcl/unx/gtk3/gtkinst.cxx | 39 133 files changed, 4349 insertions(+), 3081 deletions(-) New commits: commit d6754ec27db24e0049089c84c82c8ea406fe1748 Author: Attila Szűcs AuthorDate: Tue Jun 21 15:27:35 2022 +0200 Commit: Andras Timar CommitDate: Fri Jun 24 13:42:30 2022 +0200 tdf#149574 sc: fix missing nullptr check Regression from commit 605b4ba57b2daa447af9d43d3759079e15df8148 "tdf#43958 sc: fix fill by selecting merged cell". Check if GetPattern(actual cell) is not nullptr, before using it. This is not the real problem of Bug 149574, but it is a problem anyway, and it fixes this bug. The real problem is the wrong ViewData::nTabNo, that point to an already deleted table, (fixed in 954d119db932434dc976ef739c643be0d9c7023c "tdf#149502 sc: crash fix: Change in Table destruction"). Co-authored-by: Tibor Nagy (NISZ) Change-Id: I26fc629ccf354c9e0c2662d61254d01be91d08f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136230 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit c4c827e1d370dcc351c4dddc601b3c37fc71564b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136323 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 62bdca38a3e4..26387834f45a 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1151,7 +1151,7 @@ ScMarkType ScViewData::GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) if (eMarkType == SC_MARK_NONE) eMarkType = SC_MARK_SIMPLE; const ScPatternAttr* pMarkPattern = mrDoc.GetPattern(GetCurX(), GetCurY(), GetTabNo()); -if (pMarkPattern->GetItemSet().GetItemState(ATTR_MERGE, false) == SfxItemState::SET) +if (pMarkPattern && pMarkPattern->GetItemSet().GetItemState(ATTR_MERGE, false) == SfxItemState::SET) { SCROW nRow = pMarkPattern->GetItem(ATTR_MERGE).GetRowMerge(); SCCOL nCol = pMarkPattern->GetItem(ATTR_MERGE).GetColMerge(); commit 932af81916bd36605e689598f5bad2130e5eebf0 Author: Stephan Bergmann AuthorDate: Wed Jun 22 20:37:34 2022 +0200 Commit: Andras Timar CommitDate: Fri Jun 24 13:42:29 2022 +0200 Pump XInputStream into an SvMemoryStream rather than an OStringBuffer ...to avoid overflow with streams >= 2^31 bytes. This should fix <https://crashreport.libreoffice.org/stats/crash_details/d9613c81-de37-4de2-8c64-e36634d10ddc> which I could reproduce with a recent master Linux build with > $ truncate -s 3G test.xml > $ instdir/program/soffice test.xml causing a SIGSEGV at > #0 0x77f193a0 in rtl::str::stringbuffer_insert<_rtl_String, char>(_rtl_String**, int*, int, char const*, int) (ppThis=0x7fffb330, capacity=, offset=2147479552, pStr=0x20a92e8 "", len=4096) at sal/rtl/strtmpl.hxx:1424 > #1 0x7fffb6af04e5 in rtl::OStringBuffer::append(char const*, int) (len=4096, str=, this=0x7fffb330) at include/rtl/strbuf.hxx:594 > #2 (anonymous namespace)::OrcusFormatDetect::detect(com::sun::star::uno::Sequence&) (this=, rMediaDescSeq=) at sc/source/filter/orcus/filterdetect.cxx:80 [...] (Ideally, orcus::detect would only need a short prefix of the stream's content, but the implementation in workdir/UnpackedTarball/liborcus/src/liborcus/format_detection.cpp delegates to functions like orcus_ods::detect in workdir/UnpackedTarball/liborcus/src/liborcus/orcus_ods.cpp, which passes the content through some zip_archive that presumably needs the full content.) Change-Id: Ifaa37ee887d8296cbcf971313bde34
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/qa sc/source
sc/qa/unit/uicalc/data/tdf149502_HangOnDeletingSheet1.ods |binary sc/qa/unit/uicalc/uicalc.cxx | 17 ++ sc/source/core/data/document.cxx |7 + 3 files changed, 24 insertions(+) New commits: commit e0e59aae287268cb633df340e565647ec8c14cb2 Author: Attila Szűcs AuthorDate: Wed Jun 22 14:43:04 2022 +0200 Commit: Xisco Fauli CommitDate: Fri Jun 24 11:34:46 2022 +0200 tdf#149502 sc: crash fix: Change in Table destruction Postpone ScTable destruction a bit, when ScTable::nTab is synchronized with ScDocument::maTabs[] to avoid crashing. Before the fix random crashing occurred if the ScTable::nTab was already updated when ~ScTable() called, but the ScDocument::maTabs[] was not reordered yet, so nTab could have pointed to the actually deleted table in mTabs[]. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I2ac1450e3483ab334b4e20ac2598c2191e0135c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136284 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit c84c43320cc66152b00c0c0dad8b65de8a4b9015) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136320 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/qa/unit/uicalc/data/tdf149502_HangOnDeletingSheet1.ods b/sc/qa/unit/uicalc/data/tdf149502_HangOnDeletingSheet1.ods new file mode 100644 index ..e34a75c32308 Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf149502_HangOnDeletingSheet1.ods differ diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index a6f648ce9766..2e48f42f2e73 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1512,6 +1512,23 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf86166) CPPUNIT_ASSERT_EQUAL(static_cast(1), pDoc->GetTableCount()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf149502_HangOnDeletingSheet1) +{ +ScModelObj* pModelObj = createDoc("tdf149502_HangOnDeletingSheet1.ods"); +ScDocument* pDoc = pModelObj->GetDocument(); +CPPUNIT_ASSERT(pDoc); + +CPPUNIT_ASSERT_EQUAL(static_cast(4), pDoc->GetTableCount()); + +uno::Sequence aArgs( +comphelper::InitPropertySequence({ { "Index", uno::Any(sal_uInt16(0)) } })); + +// Before the fix in place, this test frozen here +dispatchCommand(mxComponent, ".uno:Remove", aArgs); + +CPPUNIT_ASSERT_EQUAL(static_cast(3), pDoc->GetTableCount()); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf149503) { ScModelObj* pModelObj = createDoc("tdf149503.xls"); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index a458f4d765e6..beb3e049d94c 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -727,7 +727,14 @@ bool ScDocument::DeleteTab( SCTAB nTab ) if (pTab) pTab->UpdateDeleteTab(aCxt); +// tdf#149502 make sure ScTable destructor called after the erase is finished, when +// maTabs[x].nTab==x is true again, as it should be always true. +// In the end of maTabs.erase, maTabs indexes change, but nTab updated before erase. +// ~ScTable expect that maTabs[x].nTab==x so it shouldn't be called during erase. +ScTableUniquePtr pErasedTab = std::move(maTabs[nTab]); maTabs.erase(maTabs.begin() + nTab); +delete pErasedTab.release(); + // UpdateBroadcastAreas must be called between UpdateDeleteTab, // which ends listening, and StartAllListeners, to not modify // areas that are to be inserted by starting listeners.
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/source
sc/source/ui/view/viewdata.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit dc8d912884f4893f2a3f553ecfe732a234d04e0d Author: Attila Szűcs AuthorDate: Tue Jun 21 15:27:35 2022 +0200 Commit: Xisco Fauli CommitDate: Fri Jun 24 11:33:13 2022 +0200 tdf#149574 sc: fix missing nullptr check Regression from commit 605b4ba57b2daa447af9d43d3759079e15df8148 "tdf#43958 sc: fix fill by selecting merged cell". Check if GetPattern(actual cell) is not nullptr, before using it. This is not the real problem of Bug 149574, but it is a problem anyway, and it fixes this bug. The real problem is the wrong ViewData::nTabNo, that point to an already deleted table, (fixed in 954d119db932434dc976ef739c643be0d9c7023c "tdf#149502 sc: crash fix: Change in Table destruction"). Co-authored-by: Tibor Nagy (NISZ) Change-Id: I26fc629ccf354c9e0c2662d61254d01be91d08f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136230 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit c4c827e1d370dcc351c4dddc601b3c37fc71564b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136323 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 6ac95430a84e..5cee19f21eb7 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1153,7 +1153,7 @@ ScMarkType ScViewData::GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) if (eMarkType == SC_MARK_NONE) eMarkType = SC_MARK_SIMPLE; const ScPatternAttr* pMarkPattern = mrDoc.GetPattern(GetCurX(), GetCurY(), GetTabNo()); -if (pMarkPattern->GetItemSet().GetItemState(ATTR_MERGE, false) == SfxItemState::SET) +if (pMarkPattern && pMarkPattern->GetItemSet().GetItemState(ATTR_MERGE, false) == SfxItemState::SET) { SCROW nRow = pMarkPattern->GetItem(ATTR_MERGE).GetRowMerge(); SCCOL nCol = pMarkPattern->GetItem(ATTR_MERGE).GetColMerge();
[Libreoffice-commits] core.git: sc/source
sc/source/ui/view/viewdata.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 12fd3f7ba73d2fd03b88513160545fab8edc8a20 Author: Attila Szűcs AuthorDate: Tue Jun 21 15:27:35 2022 +0200 Commit: László Németh CommitDate: Thu Jun 23 15:43:00 2022 +0200 tdf#149574 sc: fix missing nullptr check Regression from commit 605b4ba57b2daa447af9d43d3759079e15df8148 "tdf#43958 sc: fix fill by selecting merged cell". Check if GetPattern(actual cell) is not nullptr, before using it. This is not the real problem of Bug 149574, but it is a problem anyway, and it fixes this bug. The real problem is the wrong ViewData::nTabNo, that point to an already deleted table, (fixed in 954d119db932434dc976ef739c643be0d9c7023c "tdf#149502 sc: crash fix: Change in Table destruction"). Co-authored-by: Tibor Nagy (NISZ) Change-Id: I26fc629ccf354c9e0c2662d61254d01be91d08f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136230 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 88d57f106a3b..69ebe09d22d4 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1155,7 +1155,7 @@ ScMarkType ScViewData::GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) if (eMarkType == SC_MARK_NONE) eMarkType = SC_MARK_SIMPLE; const ScPatternAttr* pMarkPattern = mrDoc.GetPattern(GetCurX(), GetCurY(), GetTabNo()); -if (pMarkPattern->GetItemSet().GetItemState(ATTR_MERGE, false) == SfxItemState::SET) +if (pMarkPattern && pMarkPattern->GetItemSet().GetItemState(ATTR_MERGE, false) == SfxItemState::SET) { SCROW nRow = pMarkPattern->GetItem(ATTR_MERGE).GetRowMerge(); SCCOL nCol = pMarkPattern->GetItem(ATTR_MERGE).GetColMerge();
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/uicalc/data/tdf149502_HangOnDeletingSheet1.ods |binary sc/qa/unit/uicalc/uicalc.cxx | 17 ++ sc/source/core/data/document.cxx |7 + 3 files changed, 24 insertions(+) New commits: commit 954d119db932434dc976ef739c643be0d9c7023c Author: Attila Szűcs AuthorDate: Wed Jun 22 14:43:04 2022 +0200 Commit: László Németh CommitDate: Thu Jun 23 15:34:02 2022 +0200 tdf#149502 sc: crash fix: Change in Table destruction Postpone ScTable destruction a bit, when ScTable::nTab is synchronized with ScDocument::maTabs[] to avoid crashing. Before the fix random crashing occurred if the ScTable::nTab was already updated when ~ScTable() called, but the ScDocument::maTabs[] was not reordered yet, so nTab could have pointed to the actually deleted table in mTabs[]. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I2ac1450e3483ab334b4e20ac2598c2191e0135c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136284 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/uicalc/data/tdf149502_HangOnDeletingSheet1.ods b/sc/qa/unit/uicalc/data/tdf149502_HangOnDeletingSheet1.ods new file mode 100644 index ..e34a75c32308 Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf149502_HangOnDeletingSheet1.ods differ diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index a6f648ce9766..2e48f42f2e73 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1512,6 +1512,23 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf86166) CPPUNIT_ASSERT_EQUAL(static_cast(1), pDoc->GetTableCount()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf149502_HangOnDeletingSheet1) +{ +ScModelObj* pModelObj = createDoc("tdf149502_HangOnDeletingSheet1.ods"); +ScDocument* pDoc = pModelObj->GetDocument(); +CPPUNIT_ASSERT(pDoc); + +CPPUNIT_ASSERT_EQUAL(static_cast(4), pDoc->GetTableCount()); + +uno::Sequence aArgs( +comphelper::InitPropertySequence({ { "Index", uno::Any(sal_uInt16(0)) } })); + +// Before the fix in place, this test frozen here +dispatchCommand(mxComponent, ".uno:Remove", aArgs); + +CPPUNIT_ASSERT_EQUAL(static_cast(3), pDoc->GetTableCount()); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf149503) { ScModelObj* pModelObj = createDoc("tdf149503.xls"); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 15f44a1ef4d5..db6500e5b390 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -727,7 +727,14 @@ bool ScDocument::DeleteTab( SCTAB nTab ) if (pTab) pTab->UpdateDeleteTab(aCxt); +// tdf#149502 make sure ScTable destructor called after the erase is finished, when +// maTabs[x].nTab==x is true again, as it should be always true. +// In the end of maTabs.erase, maTabs indexes change, but nTab updated before erase. +// ~ScTable expect that maTabs[x].nTab==x so it shouldn't be called during erase. +ScTableUniquePtr pErasedTab = std::move(maTabs[nTab]); maTabs.erase(maTabs.begin() + nTab); +delete pErasedTab.release(); + // UpdateBroadcastAreas must be called between UpdateDeleteTab, // which ends listening, and StartAllListeners, to not modify // areas that are to be inserted by starting listeners.
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/tiledrendering/data/tdf43244_SpacesOnMargin.odt |binary sw/qa/extras/tiledrendering/tiledrendering.cxx | 46 +++ sw/source/core/text/portxt.cxx | 15 +++ 3 files changed, 59 insertions(+), 2 deletions(-) New commits: commit 8741fd0e0ae9e346de2e09887f0668b831c9b48b Author: Attila Szűcs AuthorDate: Fri May 27 13:12:27 2022 +0200 Commit: László Németh CommitDate: Tue Jun 7 19:28:48 2022 +0200 tdf#43244 sw: show stripped line-end spaces on margin in View->Formatting Marks mode instead of hiding them This way it's possible to avoid interoperability issues better, when these (now visible) spaces are stripped only in Writer, but not in MSO, resulting different layout, i.e. bad paragraph alignment, because the users can notice the extra spaces and remove them in Writer. Extend SwHolePortion::Paint() to paint its text, what is probably just a bunch of spaces. It's an initial fix for tdf#43100, tdf#120715 and tdf#104683 (cursor movement on the hidden spaces, end of paragraph sign before the hidden spaces, unable to select spaces after the margin). Follow-up to commit 93d7bdcb855362b88cdcfcb18ea401d89da973fb "fdo#33167, i#20878: Show spaces at the end of line". Co-authored-by: Tibor Nagy (NISZ) Change-Id: I48df3b41af37c77fd594bb6776ca30e845c51490 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135104 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sw/qa/extras/tiledrendering/data/tdf43244_SpacesOnMargin.odt b/sw/qa/extras/tiledrendering/data/tdf43244_SpacesOnMargin.odt new file mode 100644 index ..76c293dc0bd5 Binary files /dev/null and b/sw/qa/extras/tiledrendering/data/tdf43244_SpacesOnMargin.odt differ diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 42f7f9e21889..7354782563c4 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -2809,6 +2809,52 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPilcrowRedlining) comphelper::dispatchCommand(".uno:ControlCodes", {}); } +CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testTdf43244_SpacesOnMargin) +{ +// Load a document where the top left tile contains +// paragraph and line break symbols with redlining. +SwXTextDocument* pXTextDocument = createDoc("tdf43244_SpacesOnMargin.odt"); + +// show non printing characters, including pilcrow and +// line break symbols with redlining +comphelper::dispatchCommand(".uno:ControlCodes", {}); + +// Render a larger area, and then get the colors from the right side of the page. +size_t nCanvasWidth = 1024; +size_t nCanvasHeight = 512; +size_t nTileSize = 64; +std::vector aPixmap(nCanvasWidth * nCanvasHeight * 4, 0); +ScopedVclPtrInstance pDevice(DeviceFormat::DEFAULT); +pDevice->SetBackground(Wallpaper(COL_TRANSPARENT)); +pDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(nCanvasWidth, nCanvasHeight), +Fraction(1.0), Point(), aPixmap.data()); +pXTextDocument->paintTile(*pDevice, nCanvasWidth, nCanvasHeight, /*nTilePosX=*/0, +/*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680); +pDevice->EnableMapMode(false); +Bitmap aBitmap = pDevice->GetBitmap(Point(730, 120), Size(nTileSize, nTileSize)); +Bitmap::ScopedReadAccess pAccess(aBitmap); + +//Test if we see any spaces on the right margin in a 47x48 rectangle +bool bSpaceFound = false; +for (int i = 1; i < 48 && !bSpaceFound; i++) +{ +for (int j = 0; j < i; j++) +{ +Color aColor2(pAccess->GetPixel(j, i)); +Color aColor1(pAccess->GetPixel(i, j + 1)); + +if (aColor1.GetRed() < 255 || aColor2.GetRed() < 255) +{ +bSpaceFound = true; +break; +} +} +} +CPPUNIT_ASSERT(bSpaceFound); + +comphelper::dispatchCommand(".uno:ControlCodes", {}); +} + CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testClipText) { // Load a document where the top left tile contains table text with diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 140e29c168cc..a5ae0ea7e287 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -760,8 +760,10 @@ void SwHolePortion::Paint( const SwTextPaintInfo &rInf ) const if( !rInf.GetOut() ) return; +bool bPDFExport = rInf.GetVsh()->GetViewOptions()->IsPDFExport(); + // #i16816# export stuff only needed for tagged pdf support -if (!SwTaggedPDFHelper::IsExportTaggedPDF( *rInf.GetOut()) ) +if (bPDFExport && !SwTaggedPDFHelper::IsExportTaggedPDF( *rInf.GetOut()) )