24#include <com/sun/star/table/BorderLine2.hpp>
25#include <com/sun/star/container/XNameContainer.hpp>
26#include <com/sun/star/lang/XServiceInfo.hpp>
27#include <com/sun/star/lang/XMultiServiceFactory.hpp>
28#include <com/sun/star/frame/XModel.hpp>
29#include <com/sun/star/beans/XPropertySet.hpp>
34#define XML_LINE_LEFT 0
35#define XML_LINE_RIGHT 1
37#define XML_LINE_BOTTOM 3
57 std::vector< XMLPropertyState >& rProperties,
58 const OUString& rValue,
63 sal_Int16 nContextID =
70 Reference < XNameContainer > xParaStyles =
71 rImport.GetTextImport()->GetParaStyles();
72 if( xParaStyles.is() && xParaStyles->hasByName(
sDisplayName ) )
81 rProperty, rProperties, rValue,
82 rUnitConverter, rNamespaceMap );
101 XMLPropertyState* pHeaderPadding[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
102 XMLPropertyState* pHeaderNewPadding[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
104 XMLPropertyState* pHeaderBorders[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
105 XMLPropertyState* pHeaderNewBorders[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
107 XMLPropertyState* pHeaderBorderWidths[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
109 XMLPropertyState* pFooterPadding[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
110 XMLPropertyState* pFooterNewPadding[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
112 XMLPropertyState* pFooterBorders[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
113 XMLPropertyState* pFooterNewBorders[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
115 XMLPropertyState* pFooterBorderWidths[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
118 std::optional<XMLPropertyState> xHeaderDynamic;
121 std::optional<XMLPropertyState> xFooterDynamic;
124 std::optional<XMLPropertyState> pNewMargins[4];
126 XMLPropertyState* pHeaderMargins[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
127 std::optional<XMLPropertyState> pNewHeaderMargins[4];
129 XMLPropertyState* pFooterMargins[4] = {
nullptr,
nullptr,
nullptr,
nullptr };
130 std::optional<XMLPropertyState> pNewFooterMargins[4];
134 for (
auto& rProp : rProperties)
192 pAllMarginProperty =
property;
break;
208 pAllHeaderMarginProperty =
property;
break;
218 pAllFooterMarginProperty =
property;
break;
231 for (sal_uInt16
i = 0;
i < 4;
i++)
233 if (pAllMarginProperty && !pMargins[
i])
235 pNewMargins[
i].emplace(
236 pAllMarginProperty->
mnIndex + 1 +
i,
239 if (pAllHeaderMarginProperty && !pHeaderMargins[
i])
241 pNewHeaderMargins[
i].emplace(
242 pAllHeaderMarginProperty->
mnIndex + 1 +
i,
243 pAllHeaderMarginProperty->
maValue);
245 if (pAllFooterMarginProperty && !pFooterMargins[
i])
247 pNewFooterMargins[
i].emplace(
248 pAllFooterMarginProperty->
mnIndex + 1 +
i,
249 pAllFooterMarginProperty->
maValue);
251 if (pAllPaddingProperty && !pPadding[
i])
253 if (pAllBorderProperty && !pBorders[
i])
256 pBorders[
i] = pNewBorders[
i];
258 if( !pBorderWidths[
i] )
259 pBorderWidths[
i] = pAllBorderWidthProperty;
264 table::BorderLine2 aBorderLine;
265 pBorders[
i]->
maValue >>= aBorderLine;
266 if( pBorderWidths[
i] )
268 table::BorderLine2 aBorderLineWidth;
269 pBorderWidths[
i]->
maValue >>= aBorderLineWidth;
270 aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
271 aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
272 aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
273 aBorderLine.LineWidth = aBorderLineWidth.LineWidth;
274 pBorders[
i]->
maValue <<= aBorderLine;
277 if (pAllHeaderPaddingProperty && !pHeaderPadding[
i])
279 if (pAllHeaderBorderProperty && !pHeaderBorders[
i])
281 if( !pHeaderBorderWidths[
i] )
282 pHeaderBorderWidths[
i] = pAllHeaderBorderWidthProperty;
284 pHeaderBorderWidths[
i]->
mnIndex = -1;
285 if( pHeaderBorders[
i] )
287 table::BorderLine2 aBorderLine;
288 pHeaderBorders[
i]->
maValue >>= aBorderLine;
289 if( pHeaderBorderWidths[
i] )
291 table::BorderLine2 aBorderLineWidth;
292 pHeaderBorderWidths[
i]->
maValue >>= aBorderLineWidth;
293 aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
294 aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
295 aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
296 aBorderLine.LineWidth = aBorderLineWidth.LineWidth;
297 pHeaderBorders[
i]->
maValue <<= aBorderLine;
300 if (pAllFooterPaddingProperty && !pFooterPadding[
i])
302 if (pAllFooterBorderProperty && !pFooterBorders[
i])
304 if( !pFooterBorderWidths[
i] )
305 pFooterBorderWidths[
i] = pAllFooterBorderWidthProperty;
307 pFooterBorderWidths[
i]->
mnIndex = -1;
308 if( pFooterBorders[
i] )
310 table::BorderLine2 aBorderLine;
311 pFooterBorders[
i]->
maValue >>= aBorderLine;
312 if( pFooterBorderWidths[
i] )
314 table::BorderLine2 aBorderLineWidth;
315 pFooterBorderWidths[
i]->
maValue >>= aBorderLineWidth;
316 aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
317 aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
318 aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
319 aBorderLine.LineWidth = aBorderLineWidth.LineWidth;
320 pFooterBorders[
i]->
maValue <<= aBorderLine;
327 xHeaderDynamic.emplace(pHeaderHeight->
mnIndex + 2,
Any(
false));
329 if (pHeaderMinHeight)
331 xHeaderDynamic.emplace(pHeaderMinHeight->
mnIndex + 1,
Any(
true));
335 xFooterDynamic.emplace(pFooterHeight->
mnIndex + 2,
Any(
false));
337 if (pFooterMinHeight)
339 xFooterDynamic.emplace(pFooterMinHeight->
mnIndex + 1,
Any(
true));
344 if (pAllPaddingProperty)
346 pAllPaddingProperty->
mnIndex = -1;
348 if (pAllBorderProperty)
350 pAllBorderProperty->
mnIndex = -1;
352 if (pAllBorderWidthProperty)
354 pAllBorderWidthProperty->
mnIndex = -1;
356 if (pAllHeaderPaddingProperty)
358 pAllHeaderPaddingProperty->
mnIndex = -1;
360 if (pAllHeaderBorderProperty)
362 pAllHeaderBorderProperty->
mnIndex = -1;
364 if (pAllHeaderBorderWidthProperty)
366 pAllHeaderBorderWidthProperty->
mnIndex = -1;
368 if (pAllFooterPaddingProperty)
370 pAllFooterPaddingProperty->
mnIndex = -1;
372 if (pAllFooterBorderProperty)
374 pAllFooterBorderProperty->
mnIndex = -1;
376 if (pAllFooterBorderWidthProperty)
378 pAllFooterBorderWidthProperty->
mnIndex = -1;
380 if (pAllMarginProperty)
382 pAllMarginProperty->
mnIndex = -1;
384 if (pAllHeaderMarginProperty)
386 pAllHeaderMarginProperty->
mnIndex = -1;
388 if (pAllFooterMarginProperty)
390 pAllFooterMarginProperty->
mnIndex = -1;
395 sal_Int32 nGutterMargin{};
396 pMarginGutter->
maValue >>= nGutterMargin;
399 uno::Reference<lang::XServiceInfo> xSI(
GetImport().GetModel(), uno::UNO_QUERY);
400 if (xSI.is() && xSI->supportsService(
"com.sun.star.text.TextDocument"))
402 uno::Reference<lang::XMultiServiceFactory> xFac(
GetImport().GetModel(), uno::UNO_QUERY);
405 uno::Reference<beans::XPropertySet> xProps(
406 xFac->createInstance(
"com.sun.star.document.Settings"), uno::UNO_QUERY);
409 xProps->getPropertyValue(
"GutterAtTop") >>= bGutterAtTop;
427 if (nGutterMargin && pRtlGutter)
429 pRtlGutter->
maValue >>= bRtlGutter;
461 for (sal_uInt16
i = 0;
i < 4;
i++)
465 rProperties.push_back(*pNewMargins[
i]);
467 if (pNewHeaderMargins[
i])
469 rProperties.push_back(*pNewHeaderMargins[
i]);
471 if (pNewFooterMargins[
i])
473 rProperties.push_back(*pNewFooterMargins[
i]);
477 rProperties.push_back(*pNewPadding[
i]);
478 delete pNewPadding[
i];
482 rProperties.push_back(*pNewBorders[
i]);
483 delete pNewBorders[
i];
485 if (pHeaderNewPadding[
i])
487 rProperties.push_back(*pHeaderNewPadding[
i]);
488 delete pHeaderNewPadding[
i];
490 if (pHeaderNewBorders[
i])
492 rProperties.push_back(*pHeaderNewBorders[
i]);
493 delete pHeaderNewBorders[
i];
495 if (pFooterNewPadding[
i])
497 rProperties.push_back(*pFooterNewPadding[
i]);
498 delete pFooterNewPadding[
i];
500 if (pFooterNewBorders[
i])
502 rProperties.push_back(*pFooterNewBorders[
i]);
503 delete pFooterNewBorders[
i];
511 rProperties.push_back(*xHeaderDynamic);
512 xHeaderDynamic.reset();
516 rProperties.push_back(*xFooterDynamic);
517 xFooterDynamic.reset();
#define CTF_PM_BORDERLEFT
#define CTF_PM_BORDERWIDTHTOP
#define CTF_PM_FOOTERMINHEIGHT
#define CTF_PM_FOOTERHEIGHT
#define CTF_PM_HEADERMARGINRIGHT
#define CTF_PM_HEADERMARGINTOP
#define CTF_PM_HEADERBORDERLEFT
#define CTF_PM_BORDERWIDTHRIGHT
#define CTF_PM_HEADERBORDERWIDTHTOP
#define CTF_PM_PADDINGLEFT
#define CTF_PM_FOOTERBORDERWIDTHTOP
#define CTF_PM_HEADERPADDINGRIGHT
#define CTF_PM_FOOTERBORDERTOP
#define CTF_PM_HEADERPADDINGALL
#define CTF_PM_FOOTERPADDINGRIGHT
#define CTF_PM_BORDERWIDTHLEFT
#define CTF_PM_PADDINGTOP
#define CTF_PM_FOOTERBORDERBOTTOM
#define CTF_PM_HEADERBORDERBOTTOM
#define CTF_PM_FOOTERBORDERWIDTHRIGHT
#define CTF_PM_HEADERMARGINBOTTOM
#define CTF_PM_FOOTERBORDERWIDTHALL
#define CTF_PM_FOOTERBORDERALL
#define CTF_PM_FOOTERBORDERRIGHT
#define CTF_PM_HEADERBORDERWIDTHALL
#define CTF_PM_HEADERHEIGHT
#define CTF_PM_BORDERBOTTOM
#define CTF_PM_PADDINGRIGHT
#define CTF_PM_PADDINGALL
#define CTF_PM_PADDINGBOTTOM
#define CTF_PM_FOOTERPADDINGBOTTOM
#define CTF_PM_HEADERBORDERRIGHT
#define CTF_PM_HEADERPADDINGBOTTOM
#define CTF_PM_BORDERWIDTHBOTTOM
#define CTF_PM_HEADERBORDERWIDTHRIGHT
#define CTF_PM_HEADERBORDERWIDTHLEFT
#define CTF_PM_FOOTERMARGINBOTTOM
#define CTF_PM_FOOTERMARGINRIGHT
#define CTF_PM_HEADERMARGINLEFT
#define CTF_PM_HEADERBORDERALL
#define CTF_PM_FOOTERBORDERWIDTHLEFT
#define CTF_PM_MARGINLEFT
#define CTF_PM_FOOTERMARGINALL
#define CTF_PM_FOOTERMARGINTOP
#define CTF_PM_BORDERWIDTHALL
#define CTF_PM_FOOTERPADDINGLEFT
#define CTF_PM_HEADERMARGINALL
#define CTF_PM_FOOTERBORDERWIDTHBOTTOM
#define CTF_PM_MARGINRIGHT
#define CTF_PM_MARGINBOTTOM
#define CTF_PM_HEADERBORDERWIDTHBOTTOM
#define CTF_PM_BORDERRIGHT
#define CTF_PM_FOOTERPADDINGTOP
#define CTF_PM_HEADERBORDERTOP
#define CTF_PM_HEADERPADDINGLEFT
#define CTF_PM_MARGINGUTTER
#define CTF_PM_HEADERMINHEIGHT
#define CTF_PM_FOOTERBORDERLEFT
#define CTF_PM_FOOTERMARGINLEFT
#define CTF_PM_HEADERPADDINGTOP
#define CTF_PM_FOOTERPADDINGALL
#define CTF_PM_REGISTER_STYLE
virtual void finished(::std::vector< XMLPropertyState > &rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex) const override
This method is called when all attributes have been processed.
PageMasterImportPropertyMapper(const rtl::Reference< XMLPropertySetMapper > &rMapper, SvXMLImport &rImp)
virtual bool handleSpecialItem(XMLPropertyState &rProperty, ::std::vector< XMLPropertyState > &rProperties, const OUString &rValue, const SvXMLUnitConverter &rUnitConverter, const SvXMLNamespaceMap &rNamespaceMap) const override
this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set
virtual ~PageMasterImportPropertyMapper() override
virtual bool handleSpecialItem(XMLPropertyState &rProperty, ::std::vector< XMLPropertyState > &rProperties, const OUString &rValue, const SvXMLUnitConverter &rUnitConverter, const SvXMLNamespaceMap &rNamespaceMap) const
this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set
const rtl::Reference< XMLPropertySetMapper > & getPropertySetMapper() const
virtual void finished(::std::vector< XMLPropertyState > &rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex) const
This method is called when all attributes have benn processed.
SvXMLImport & GetImport() const
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
tools::Long const nRightMargin
tools::Long const nTopMargin
tools::Long const nLeftMargin
Smart struct to transport an Any with an index to the appropriate property-name.