Bugzilla – Attachment 143670 Details for
Bug 118812
FILEOPEN: Direct formatting overwriting style in DOCX tables, wrong spacing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
ugly patch that "works" for comment 0's example, but not comment 2
tdf118812_debug.patch (text/plain), 4.32 KB, created by
Justin L
on 2018-07-21 09:44:59 UTC
(
hide
)
Description:
ugly patch that "works" for comment 0's example, but not comment 2
Filename:
MIME Type:
Creator:
Justin L
Created:
2018-07-21 09:44:59 UTC
Size:
4.32 KB
patch
obsolete
>diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx >index 287028c..813f154 100644 >--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx >+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx >@@ -966,8 +966,8 @@ css::uno::Sequence<css::beans::PropertyValues> DomainMapperTableHandler::endTabl > } > > // Apply paragraph property to each paragraph within a cell. >-static void lcl_ApplyCellParaProps(uno::Reference<table::XCell> const& xCell, >- const uno::Any& rBottomMargin) >+static void lcl_ApplyCellParaProps(uno::Reference<table::XCell> const& xCell, const OUString sPropertyName, >+ const uno::Any& rValue, DomainMapper_Impl& rDMapper_Impl) > { > uno::Reference<container::XEnumerationAccess> xEnumerationAccess(xCell, uno::UNO_QUERY); > uno::Reference<container::XEnumeration> xEnumeration = xEnumerationAccess->createEnumeration(); >@@ -975,10 +975,33 @@ static void lcl_ApplyCellParaProps(uno::Reference<table::XCell> const& xCell, > { > uno::Reference<beans::XPropertySet> xParagraph(xEnumeration->nextElement(), uno::UNO_QUERY); > uno::Reference<beans::XPropertyState> xPropertyState(xParagraph, uno::UNO_QUERY); >+ >+ if ( xPropertyState.is() && xPropertyState->getPropertyState("ParaStyleName") == beans::PropertyState_DIRECT_VALUE ) >+ { >+ OUString sStyleName; >+ xParagraph->getPropertyValue("ParaStyleName") >>= sStyleName; >+ const StyleSheetEntryPtr pStyleSheet = rDMapper_Impl.GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( sStyleName ); >+ if ( pStyleSheet && sStyleName != rDMapper_Impl.GetDefaultParaStyleName() ) >+ { >+ PropertyIds eId = PROP_PARA_BOTTOM_MARGIN; >+ uno::Any aStyleValue = rDMapper_Impl.GetAnyProperty(eId, pStyleSheet->pProperties); >+ if ( aStyleValue != uno::Any() ) >+ { >+SAL_WARN("DEBUG","::ApplyCellParaProps["<<sPropertyName<<"]["<<aStyleValue<<"] using style["<<aStyleValue<<"] instead of table["<<rValue<<"] set["<<(int)xPropertyState->getPropertyState(sPropertyName)<<"]"); >+//assert(aStyleValue == rValue); >+ if ( xPropertyState->getPropertyState(sPropertyName) == beans::PropertyState_DIRECT_VALUE ) >+ xParagraph->setPropertyValue(sPropertyName, aStyleValue); >+ return; >+ } >+ } >+ } >+ > // Don't apply in case direct formatting is already present. >- // TODO: probably paragraph style has priority over table style here. >- if (xPropertyState.is() && xPropertyState->getPropertyState("ParaBottomMargin") == beans::PropertyState_DEFAULT_VALUE) >- xParagraph->setPropertyValue("ParaBottomMargin", rBottomMargin); >+ if (xPropertyState.is() && xPropertyState->getPropertyState(sPropertyName) == beans::PropertyState_DEFAULT_VALUE) >+ { >+ SAL_WARN("DEBUG","Setting ParaBottomMargin to["<<rValue<<"] from table style."); >+ xParagraph->setPropertyValue(sPropertyName, rValue); >+ } > } > } > >@@ -1083,14 +1106,14 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab > if (aTableInfo.aTableProperties[i].Name == "ParaBottomMargin") > { > uno::Reference<table::XCellRange> xCellRange(xTable, uno::UNO_QUERY); >- uno::Any aBottomMargin = aTableInfo.aTableProperties[i].Value; >+ uno::Any aValue = aTableInfo.aTableProperties[i].Value; > sal_Int32 nRows = aCellProperties.getLength(); > for (sal_Int32 nRow = 0; nRow < nRows; ++nRow) > { > const uno::Sequence< beans::PropertyValues > aCurrentRow = aCellProperties[nRow]; > sal_Int32 nCells = aCurrentRow.getLength(); > for (sal_Int32 nCell = 0; nCell < nCells; ++nCell) >- lcl_ApplyCellParaProps(xCellRange->getCellByPosition(nCell, nRow), aBottomMargin); >+ lcl_ApplyCellParaProps(xCellRange->getCellByPosition(nCell, nRow), aTableInfo.aTableProperties[i].Name, aValue, m_rDMapper_Impl); > } > break; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 118812
:
143610
|
143668
|
143669
| 143670 |
148876
|
154795
|
154853
|
154855
|
154856
|
154857
|
157158
|
157631