24#include <rtl/ustrbuf.hxx>
27#include <osl/diagnose.h>
28#include <com/sun/star/lang/XServiceInfo.hpp>
29#include <com/sun/star/container/XEnumerationAccess.hpp>
30#include <com/sun/star/container/XEnumeration.hpp>
31#include <com/sun/star/container/XIndexReplace.hpp>
32#include <com/sun/star/beans/XPropertySet.hpp>
33#include <com/sun/star/beans/XMultiPropertySet.hpp>
34#include <com/sun/star/beans/XPropertyState.hpp>
35#include <com/sun/star/graphic/XGraphic.hpp>
36#include <com/sun/star/text/XTextDocument.hpp>
37#include <com/sun/star/text/XTextSectionsSupplier.hpp>
38#include <com/sun/star/text/XTextTablesSupplier.hpp>
39#include <com/sun/star/text/XNumberingRulesSupplier.hpp>
40#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
41#include <com/sun/star/text/XTextTable.hpp>
42#include <com/sun/star/text/XText.hpp>
43#include <com/sun/star/text/XTextContent.hpp>
44#include <com/sun/star/text/XTextRange.hpp>
45#include <com/sun/star/text/XTextField.hpp>
46#include <com/sun/star/container/XNamed.hpp>
47#include <com/sun/star/container/XContentEnumerationAccess.hpp>
48#include <com/sun/star/text/XTextFrame.hpp>
49#include <com/sun/star/container/XNameAccess.hpp>
50#include <com/sun/star/text/SizeType.hpp>
51#include <com/sun/star/text/HoriOrientation.hpp>
52#include <com/sun/star/text/VertOrientation.hpp>
53#include <com/sun/star/text/TextContentAnchorType.hpp>
54#include <com/sun/star/text/XTextFramesSupplier.hpp>
55#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
56#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
57#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
58#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
59#include <com/sun/star/document/XEventsSupplier.hpp>
60#include <com/sun/star/document/XRedlinesSupplier.hpp>
61#include <com/sun/star/text/XFormField.hpp>
62#include <com/sun/star/text/XTextSection.hpp>
63#include <com/sun/star/drawing/XShape.hpp>
64#include <com/sun/star/style/XAutoStylesSupplier.hpp>
65#include <com/sun/star/style/XAutoStyleFamily.hpp>
66#include <com/sun/star/text/XTextFieldsSupplier.hpp>
67#include <com/sun/star/drawing/XControlShape.hpp>
68#include <com/sun/star/util/DateTime.hpp>
100#include <com/sun/star/embed/ElementModes.hpp>
101#include <com/sun/star/embed/XTransactedObject.hpp>
102#include <com/sun/star/document/XStorageBasedDocument.hpp>
104#include <com/sun/star/rdf/XMetadatable.hpp>
106#include <unordered_map>
111#include <officecfg/Office/Common.hxx>
115using namespace ::
std;
161constexpr OUStringLiteral
gsRuby(u
"Ruby");
169constexpr OUStringLiteral
gsText(u
"Text");
193 typedef list<Reference<XTextContent>> contents_t;
194 typedef back_insert_iterator<contents_t> inserter_t;
195 typedef contents_t::const_iterator const_iterator_t;
197 inserter_t getInserter()
198 {
return back_insert_iterator<contents_t>(m_vTextContents); };
199 const_iterator_t getBegin()
const
200 {
return m_vTextContents.begin(); };
201 const_iterator_t getEnd()
const
202 {
return m_vTextContents.end(); };
205 contents_t m_vTextContents;
210 size_t operator()(
const Reference<XTextFrame>& rFrame)
const
211 {
return sal::static_int_cast<size_t>(
reinterpret_cast<sal_uIntPtr
>(rFrame.get())); }
214 bool lcl_TextContentsUnfiltered(
const Reference<XTextContent>&)
217 bool lcl_ShapeFilter(
const Reference<XTextContent>& xTxtContent)
219 Reference<XShape> xShape(xTxtContent, UNO_QUERY);
222 Reference<XServiceInfo> xServiceInfo(xTxtContent, UNO_QUERY);
223 return !xServiceInfo->supportsService(
"com.sun.star.text.TextFrame") &&
224 !xServiceInfo->supportsService(
"com.sun.star.text.TextGraphicObject") &&
225 !xServiceInfo->supportsService(
"com.sun.star.text.TextEmbeddedObject");
231 typedef bool (*filter_t)(
const Reference<XTextContent>&);
233 const Reference<XEnumerationAccess>& rEnumAccess,
234 const filter_t& rFilter)
235 : m_xEnumAccess(rEnumAccess)
241 const TextContentSet& GetPageBoundContents()
const
242 {
return m_vPageBounds; };
243 const TextContentSet* GetFrameBoundContents(
const Reference<XTextFrame>& rParentFrame)
const
245 framebound_map_t::const_iterator it = m_vFrameBoundsOf.find(rParentFrame);
246 if(it == m_vFrameBoundsOf.end())
248 return &(it->second);
250 Reference<XEnumeration> createEnumeration()
const
252 if(!m_xEnumAccess.is())
253 return Reference<XEnumeration>();
254 return m_xEnumAccess->createEnumeration();
258 typedef std::unordered_map<
259 Reference<XTextFrame>,
261 FrameRefHash> framebound_map_t;
262 TextContentSet m_vPageBounds;
263 framebound_map_t m_vFrameBoundsOf;
264 const Reference<XEnumerationAccess> m_xEnumAccess;
265 void Fill(
const filter_t& rFilter);
268 class FieldParamExporter
271 FieldParamExporter(
SvXMLExport*
const pExport, Reference<XNameContainer>
const & xFieldParams)
273 , m_xFieldParams(xFieldParams)
279 const Reference<XNameContainer> m_xFieldParams;
286 OUString href,
name, targetFrame, ustyleName, vstyleName;
287 bool serverMap =
false;
288 css::uno::Reference<css::container::XNameReplace> events;
290 HyperlinkData() =
default;
291 HyperlinkData(
const css::uno::Reference<css::beans::XPropertySet>& rPropSet);
300 HyperlinkData::HyperlinkData(
const css::uno::Reference<css::beans::XPropertySet>& rPropSet)
302 const css::uno::Reference<css::beans::XPropertyState> xPropState(rPropSet, UNO_QUERY);
303 const auto xPropSetInfo(rPropSet->getPropertySetInfo());
306 || PropertyState_DIRECT_VALUE == xPropState->getPropertyState(
gsHyperLinkURL)))
316 || PropertyState_DIRECT_VALUE == xPropState->getPropertyState(
gsHyperLinkName)))
323 || PropertyState_DIRECT_VALUE == xPropState->getPropertyState(
gsHyperLinkTarget)))
330 || PropertyState_DIRECT_VALUE == xPropState->getPropertyState(
gsServerMap)))
332 serverMap = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(
gsServerMap));
337 || PropertyState_DIRECT_VALUE
345 || PropertyState_DIRECT_VALUE
351 static constexpr OUStringLiteral sHyperLinkEvents(u
"HyperLinkEvents");
352 if (xPropSetInfo->hasPropertyByName(sHyperLinkEvents))
354 events.set(rPropSet->getPropertyValue(sHyperLinkEvents), uno::UNO_QUERY);
360 if (href != rOther.href || name != rOther.name || targetFrame != rOther.targetFrame
361 || ustyleName != rOther.ustyleName || vstyleName != rOther.vstyleName
362 || serverMap != rOther.serverMap)
365 if (events == rOther.events)
367 if (!events || !rOther.events)
370 const css::uno::Sequence<OUString> aNames = events->getElementNames();
371 if (aNames != rOther.events->getElementNames())
373 for (
const auto& rName : aNames)
375 const css::uno::Any aAny = events->getByName(rName);
376 const css::uno::Any aOtherAny = rOther.events->getByName(rName);
377 if (aAny != aOtherAny)
383 bool HyperlinkData::addHyperlinkAttributes(
SvXMLExport& rExport)
388 OSL_ENSURE(
false,
"hyperlink without a URL --> no export to ODF");
398 if (!targetFrame.isEmpty())
408 if (!ustyleName.isEmpty())
412 if (!vstyleName.isEmpty())
419 void HyperlinkData::exportEvents(
SvXMLExport& rExport)
477 "ParaConditionalStyleName",
484enum eParagraphPropertyNamesEnumAuto
486 NUMBERING_RULES_AUTO = 0,
487 PARA_CONDITIONAL_STYLE_NAME_AUTO = 1,
488 PARA_STYLE_NAME_AUTO = 2
496 "NumberingStyleName",
498 "ParaConditionalStyleName",
501 "OutlineContentVisible",
507enum eParagraphPropertyNamesEnum
509 NUMBERING_IS_NUMBER = 0,
510 PARA_NUMBERING_STYLENAME = 1,
511 PARA_OUTLINE_LEVEL=2,
512 PARA_CONDITIONAL_STYLE_NAME = 3,
515 PARA_OUTLINE_CONTENT_VISIBLE = 6
520void BoundFrames::Fill(
const filter_t& rFilter)
522 if(!m_xEnumAccess.is())
524 const Reference< XEnumeration > xEnum = m_xEnumAccess->createEnumeration();
527 static const OUStringLiteral our_sAnchorType(u
"AnchorType");
528 static const OUStringLiteral our_sAnchorFrame(u
"AnchorFrame");
529 while(xEnum->hasMoreElements())
531 Reference<XPropertySet> xPropSet(xEnum->nextElement(), UNO_QUERY);
532 Reference<XTextContent> xTextContent(xPropSet, UNO_QUERY);
533 if(!xPropSet.is() || !xTextContent.is())
535 TextContentAnchorType eAnchor;
536 xPropSet->getPropertyValue(our_sAnchorType) >>= eAnchor;
537 if(TextContentAnchorType_AT_PAGE != eAnchor && TextContentAnchorType_AT_FRAME != eAnchor)
539 if(!rFilter(xTextContent))
542 TextContentSet::inserter_t pInserter = m_vPageBounds.getInserter();
543 if(TextContentAnchorType_AT_FRAME == eAnchor)
545 Reference<XTextFrame> xAnchorTxtFrame(
546 xPropSet->getPropertyValue(our_sAnchorFrame),
548 pInserter = m_vFrameBoundsOf[xAnchorTxtFrame].getInserter();
550 *pInserter++ = xTextContent;
554BoundFrameSets::BoundFrameSets(
const Reference<XInterface>& rModel)
555 : m_pTexts(new BoundFrames())
556 , m_pGraphics(new BoundFrames())
557 , m_pEmbeddeds(new BoundFrames())
558 , m_pShapes(new BoundFrames())
560 const Reference<XTextFramesSupplier> xTFS(rModel, UNO_QUERY);
561 const Reference<XTextGraphicObjectsSupplier> xGOS(rModel, UNO_QUERY);
562 const Reference<XTextEmbeddedObjectsSupplier> xEOS(rModel, UNO_QUERY);
563 const Reference<XDrawPageSupplier> xDPS(rModel, UNO_QUERY);
566 Reference<XEnumerationAccess>(xTFS->getTextFrames(), UNO_QUERY),
567 &lcl_TextContentsUnfiltered));
570 Reference<XEnumerationAccess>(xGOS->getGraphicObjects(), UNO_QUERY),
571 &lcl_TextContentsUnfiltered));
574 Reference<XEnumerationAccess>(xEOS->getEmbeddedObjects(), UNO_QUERY),
575 &lcl_TextContentsUnfiltered));
578 Reference<XEnumerationAccess>(xDPS->getDrawPage(), UNO_QUERY),
582void FieldParamExporter::Export()
588 const Sequence<OUString> vParameters(m_xFieldParams->getElementNames());
589 for(
const auto & rParameter : vParameters)
591 const Any aValue = m_xFieldParams->getByName(rParameter);
592 const Type& aValueType = aValue.getValueType();
593 if(aValueType == aStringType)
602 Reference< embed::XStorage > xTargetStg = m_pExport->GetTargetStorage();
603 if (xTargetStg.is()) {
604 Reference< embed::XStorage > xDstStg = xTargetStg->openStorageElement(
605 "OLELinks", embed::ElementModes::WRITE );
607 if ( !xDstStg->hasByName( sValue ) ) {
608 Reference< XStorageBasedDocument > xStgDoc (
609 m_pExport->GetModel( ), UNO_QUERY );
610 Reference< embed::XStorage > xDocStg = xStgDoc->getDocumentStorage();
611 Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
612 "OLELinks", embed::ElementModes::READ );
614 xOleStg->copyElementTo( sValue, xDstStg, sValue );
615 Reference< embed::XTransactedObject > xTransact( xDstStg, UNO_QUERY );
616 if ( xTransact.is( ) )
617 xTransact->commit( );
620 SAL_WARN(
"xmloff",
"no target storage");
624 else if(aValueType == aBoolType)
630 else if(aValueType == aSeqType)
632 Sequence<OUString> vValue;
634 for(
const OUString & i : std::as_const(vValue))
639 else if(aValueType == aIntType)
657 const Reference < XPropertySet > & rPropSet,
665 xPropMapper = GetParaPropMapper();
668 xPropMapper = GetTextPropMapper();
671 xPropMapper = GetAutoFramePropMapper();
674 xPropMapper = GetSectionPropMapper();
677 xPropMapper = GetRubyPropMapper();
681 SAL_WARN_IF( !xPropMapper.is(),
"xmloff",
"There is the property mapper?" );
683 vector< XMLPropertyState > aPropStates =
684 xPropMapper->Filter(GetExport(), rPropSet);
686 aPropStates.insert( aPropStates.end(), aAddStates.
begin(), aAddStates.
end() );
688 if( aPropStates.empty() )
691 Reference< XPropertySetInfo > xPropSetInfo(rPropSet->getPropertySetInfo());
692 OUString sParent, sCondParent;
693 sal_uInt16 nIgnoreProps = 0;
697 if( xPropSetInfo->hasPropertyByName( gsParaStyleName ) )
699 rPropSet->getPropertyValue( gsParaStyleName ) >>= sParent;
707 Reference < XIndexReplace > xNumRule(rPropSet->getPropertyValue(
gsNumberingRules ), uno::UNO_QUERY);
708 if( xNumRule.is() && xNumRule->getCount() )
710 Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
713 sName = xNamed->getName();
714 bool bAdd =
sName.isEmpty();
717 Reference < XPropertySet > xNumPropSet( xNumRule,
719 if( xNumPropSet.is() &&
720 xNumPropSet->getPropertySetInfo()
721 ->hasPropertyByName(
"IsAutomatic" ) )
723 bAdd = *o3tl::doAccess<bool>(xNumPropSet->getPropertyValue(
"IsAutomatic" ));
726 xNumPropSet->getPropertySetInfo()
727 ->hasPropertyByName(
"NumberingIsOutline" ) )
729 bAdd = !(*o3tl::doAccess<bool>(xNumPropSet->getPropertyValue(
"NumberingIsOutline" )));
738 maListAutoPool.Add( xNumRule );
746 for( ::std::vector< XMLPropertyState >::iterator
i(aPropStates.begin());
747 nIgnoreProps < 2 && i != aPropStates.end(); )
749 if(
i->mnIndex == -1 )
755 switch( xPM->GetEntryContextId(
i->mnIndex) )
761 i = aPropStates.erase( i );
771 if( xPropSetInfo->hasPropertyByName( gsFrameStyleName ) )
773 rPropSet->getPropertyValue( gsFrameStyleName ) >>= sParent;
782 if (aPropStates.size() - nIgnoreProps)
784 GetAutoStylePool().Add( nFamily, sParent, std::vector(aPropStates), bDontSeek );
785 if( !sCondParent.isEmpty() && sParent != sCondParent )
786 GetAutoStylePool().Add( nFamily, sCondParent, std::move(aPropStates) );
797 const Reference < XPropertySet > & rPropSet)
803 xPropMapper = GetParaPropMapper();
807 SAL_WARN_IF( !xPropMapper.is(),
"xmloff",
"There is the property mapper?" );
809 vector<XMLPropertyState> aPropStates(xPropMapper->Filter(GetExport(), rPropSet));
811 if( rPropSetHelper.
hasProperty( NUMBERING_RULES_AUTO ) )
813 Reference < XIndexReplace > xNumRule(rPropSetHelper.
getValue( NUMBERING_RULES_AUTO,
814 rPropSet,
true ), uno::UNO_QUERY);
815 if( xNumRule.is() && xNumRule->getCount() )
817 Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
820 sName = xNamed->getName();
821 bool bAdd =
sName.isEmpty();
824 Reference < XPropertySet > xNumPropSet( xNumRule,
826 if( xNumPropSet.is() &&
827 xNumPropSet->getPropertySetInfo()
828 ->hasPropertyByName(
"IsAutomatic" ) )
830 bAdd = *o3tl::doAccess<bool>(xNumPropSet->getPropertyValue(
"IsAutomatic" ));
833 xNumPropSet->getPropertySetInfo()
834 ->hasPropertyByName(
"NumberingIsOutline" ) )
836 bAdd = !(*o3tl::doAccess<bool>(xNumPropSet->getPropertyValue(
"NumberingIsOutline" )));
845 maListAutoPool.Add( xNumRule );
849 if( aPropStates.empty() )
852 OUString sParent, sCondParent;
856 if( rPropSetHelper.
hasProperty( PARA_STYLE_NAME_AUTO ) )
858 rPropSetHelper.
getValue( PARA_STYLE_NAME_AUTO, rPropSet,
861 if( rPropSetHelper.
hasProperty( PARA_CONDITIONAL_STYLE_NAME_AUTO ) )
863 rPropSetHelper.
getValue( PARA_CONDITIONAL_STYLE_NAME_AUTO,
864 rPropSet,
true ) >>= sCondParent;
873 GetAutoStylePool().Add( nFamily, sParent, std::vector(aPropStates) );
874 if( !sCondParent.isEmpty() && sParent != sCondParent )
875 GetAutoStylePool().Add( nFamily, sCondParent, std::move(aPropStates) );
881 const Reference < XPropertySet > & rPropSet,
882 const OUString& rParent,
885 OUString
sName( rParent );
890 xPropMapper = GetParaPropMapper();
893 xPropMapper = GetAutoFramePropMapper();
896 xPropMapper = GetSectionPropMapper();
899 xPropMapper = GetRubyPropMapper();
903 SAL_WARN_IF( !xPropMapper.is(),
"xmloff",
"There is the property mapper?" );
904 if( !xPropMapper.is() )
906 vector<XMLPropertyState> aPropStates(xPropMapper->Filter(GetExport(), rPropSet));
907 aPropStates.insert( aPropStates.end(), aAddStates.
begin(), aAddStates.
end() );
909 sName = GetAutoStylePool().Find( nFamily,
sName, aPropStates );
915 const Reference < XPropertySet > & rPropSet,
916 bool& rbHasCharStyle,
917 bool& rbHasAutoStyle,
921 vector<XMLPropertyState> aPropStates(xPropMapper->Filter(GetExport(), rPropSet));
925 rbHasCharStyle = rbHasAutoStyle =
false;
926 sal_uInt16 nIgnoreProps = 0;
928 ::std::vector< XMLPropertyState >::iterator aFirstDel = aPropStates.end();
929 ::std::vector< XMLPropertyState >::iterator aSecondDel = aPropStates.end();
931 for( ::std::vector< XMLPropertyState >::iterator
932 i = aPropStates.begin();
933 nIgnoreProps < 2 &&
i != aPropStates.end();
936 if(
i->mnIndex == -1 )
939 switch( xPM->GetEntryContextId(
i->mnIndex) )
944 rbHasCharStyle = !
sName.isEmpty();
963 while( *ppAddStates )
965 aPropStates.push_back( **ppAddStates );
969 if (aPropStates.size() - nIgnoreProps)
978 aPropStates.erase( aSecondDel );
979 aPropStates.erase( aFirstDel );
981 sName = GetAutoStylePool().Find(
985 rbHasAutoStyle =
true;
999 sal_Int16 nListLevelsToBeClosed = 0;
1004 nListLevelsToBeClosed = rPrevInfo.
GetLevel();
1010 "<rPrevInfo.GetLevel() > 0> not hold. Serious defect." );
1014 if ( nListLevelsToBeClosed > 0 &&
1015 maListElements.size() >= sal::static_int_cast< sal_uInt32 >( 2 * nListLevelsToBeClosed ) )
1018 for(
size_t j = 0; j < 2; ++j)
1020 OUString aElem(maListElements.back());
1021 maListElements.pop_back();
1022 GetExport().EndElement(aElem,
true);
1026 mpTextListsHelper->PopListFromStack();
1028 --nListLevelsToBeClosed;
1029 }
while ( nListLevelsToBeClosed > 0 );
1033 const bool bExportODF =
1036 GetExport().getSaneDefaultVersion();
1041 bool bRootListToBeStarted =
false;
1042 sal_Int16 nListLevelsToBeOpened = 0;
1047 bRootListToBeStarted =
true;
1048 nListLevelsToBeOpened = rNextInfo.
GetLevel();
1054 "<rPrevInfo.GetLevel() > 0> not hold. Serious defect." );
1058 if ( nListLevelsToBeOpened > 0 )
1063 const OUString& sListId( rNextInfo.
GetListId() );
1064 bool bExportListStyle(
true );
1065 bool bRestartNumberingAtContinuedList(
false );
1066 sal_Int32 nRestartValueForContinuedList( -1 );
1067 bool bContinueingPreviousSubList = !bRootListToBeStarted &&
1070 GetExport().CheckAttrList();
1072 if ( bRootListToBeStarted )
1074 if ( !mpTextListsHelper->IsListProcessed( sListId ) )
1087 mpTextListsHelper->KeepListAsProcessed( sListId,
1093 const OUString sNewListId(
1094 mpTextListsHelper->GenerateNewListId() );
1107 const OUString sContinueListId =
1108 mpTextListsHelper->GetLastContinuingListId( sListId );
1111 mpTextListsHelper->StoreLastContinuingList( sListId,
1113 if ( sListStyleName ==
1114 mpTextListsHelper->GetListStyleOfLastProcessedList() &&
1117 mpTextListsHelper->GetLastProcessedListId() &&
1128 !sListId.isEmpty() )
1136 ( nListLevelsToBeOpened != 1 ||
1139 bRestartNumberingAtContinuedList =
true;
1140 nRestartValueForContinuedList =
1145 mpTextListsHelper->KeepListAsProcessed( sNewListId,
1151 GetExport().EncodeStyleName( sListStyleName ) );
1152 bExportListStyle =
false;
1154 bRootListToBeStarted =
false;
1156 else if ( bExportListStyle &&
1157 !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) )
1160 GetExport().EncodeStyleName( sListStyleName ) );
1161 bExportListStyle =
false;
1169 bRestartNumberingAtContinuedList =
true;
1170 nRestartValueForContinuedList =
1175 if ( bContinueingPreviousSubList )
1179 bContinueingPreviousSubList =
false;
1184 OUString aElem(GetExport().GetNamespaceMap().GetQNameByKey(
1187 GetExport().IgnorableWhitespace();
1188 GetExport().StartElement(aElem,
false);
1190 maListElements.push_back(aElem);
1192 mpTextListsHelper->PushListOnStack( sListId,
1196 GetExport().CheckAttrList();
1199 if ( nListLevelsToBeOpened == 1 )
1206 aBuffer.makeStringAndClear() );
1208 else if (bRestartNumberingAtContinuedList)
1212 OUString::number(nRestartValueForContinuedList) );
1213 bRestartNumberingAtContinuedList =
false;
1217 eLName = ( rNextInfo.
IsNumbered() || nListLevelsToBeOpened > 1 )
1220 aElem = GetExport().GetNamespaceMap().GetQNameByKey(
1223 GetExport().IgnorableWhitespace();
1224 GetExport().StartElement(aElem,
false);
1225 maListElements.push_back(aElem);
1228 if ( GetExport().exportTextNumberElement() &&
1232 const OUString aTextNumberElem =
1233 GetExport().GetNamespaceMap().GetQNameByKey(
1236 GetExport().IgnorableWhitespace();
1237 GetExport().StartElement( aTextNumberElem,
false );
1239 GetExport().EndElement( aTextNumberElem,
true );
1241 --nListLevelsToBeOpened;
1242 }
while ( nListLevelsToBeOpened > 0 );
1246 bool bEndElement =
false;
1253 assert(maListElements.size() >= 2 &&
"list elements missing");
1254 bEndElement = maListElements.size() >= 2;
1261 GetExport().EndElement(maListElements.back(),
true );
1262 maListElements.pop_back();
1269 GetExport().EndElement(maListElements.back(),
true );
1270 GetExport().IgnorableWhitespace();
1271 GetExport().StartElement(maListElements.back(),
false);
1275 GetExport().CheckAttrList();
1281 aBuffer.makeStringAndClear() );
1290 aBuffer.makeStringAndClear() );
1296 if ( !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) )
1300 GetExport().EncodeStyleName( sListStyleName ) );
1303 OUString aElem( GetExport().GetNamespaceMap().GetQNameByKey(
1306 GetExport().IgnorableWhitespace();
1307 GetExport().StartElement(aElem,
false );
1308 maListElements.push_back(aElem);
1311 if ( GetExport().exportTextNumberElement() &&
1314 const OUString aTextNumberElem =
1315 GetExport().GetNamespaceMap().GetQNameByKey(
1318 GetExport().IgnorableWhitespace();
1319 GetExport().StartElement( aTextNumberElem,
false );
1321 GetExport().EndElement( aTextNumberElem,
true );
1334 assert(m_FieldMarkMap.find(i_xFieldMark) == m_FieldMarkMap.end());
1335 sal_Int32
const ret(m_FieldMarkMap.size());
1336 m_FieldMarkMap.insert(::std::make_pair(i_xFieldMark, ret));
1341 FieldMarkMap_t::const_iterator
const it(
1342 m_FieldMarkMap.find(i_xFieldMark));
1345 assert(it != m_FieldMarkMap.end());
1356 rAutoStylePool( rASP ),
1357 pBoundFrameSets(new BoundFrameSets(GetExport().GetModel())),
1358 maListAutoPool( GetExport() ),
1362 mpTextListsHelper( nullptr ),
1364 aCharStyleNamesPropInfoCache( gsCharStyleNames )
1371 OUString aPrefix(
u'P');
1414 Reference<XRedlinesSupplier>(
GetExport().GetModel(), UNO_QUERY ).is())
1440 "misusage of text lists helper stack - it is not empty. Serious defect" );
1477 const TextContentSet& rTexts =
pBoundFrameSets->GetTexts()->GetPageBoundContents();
1478 const TextContentSet& rGraphics =
pBoundFrameSets->GetGraphics()->GetPageBoundContents();
1479 const TextContentSet& rEmbeddeds =
pBoundFrameSets->GetEmbeddeds()->GetPageBoundContents();
1480 const TextContentSet& rShapes =
pBoundFrameSets->GetShapes()->GetPageBoundContents();
1481 for(TextContentSet::const_iterator_t it = rTexts.getBegin();
1482 it != rTexts.getEnd();
1485 for(TextContentSet::const_iterator_t it = rGraphics.getBegin();
1486 it != rGraphics.getEnd();
1489 for(TextContentSet::const_iterator_t it = rEmbeddeds.getBegin();
1490 it != rEmbeddeds.getEnd();
1493 for(TextContentSet::const_iterator_t it = rShapes.getBegin();
1494 it != rShapes.getEnd();
1502 const Reference < XTextFrame > *pParentTxtFrame )
1504 const TextContentSet*
const pTexts =
pBoundFrameSets->GetTexts()->GetFrameBoundContents(*pParentTxtFrame);
1506 for(TextContentSet::const_iterator_t it = pTexts->getBegin();
1507 it != pTexts->getEnd();
1510 const TextContentSet*
const pGraphics =
pBoundFrameSets->GetGraphics()->GetFrameBoundContents(*pParentTxtFrame);
1512 for(TextContentSet::const_iterator_t it = pGraphics->getBegin();
1513 it != pGraphics->getEnd();
1516 const TextContentSet*
const pEmbeddeds =
pBoundFrameSets->GetEmbeddeds()->GetFrameBoundContents(*pParentTxtFrame);
1518 for(TextContentSet::const_iterator_t it = pEmbeddeds->getBegin();
1519 it != pEmbeddeds->getEnd();
1522 const TextContentSet*
const pShapes =
pBoundFrameSets->GetShapes()->GetFrameBoundContents(*pParentTxtFrame);
1524 for(TextContentSet::const_iterator_t it = pShapes->getBegin();
1525 it != pShapes->getEnd();
1547 const bool bAutoStyles =
true;
1548 const bool bExportContent =
false;
1551 Reference< XAutoStylesSupplier > xAutoStylesSupp(
GetExport().GetModel(), UNO_QUERY );
1552 if ( xAutoStylesSupp.is() )
1554 Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles();
1555 const auto collectFamily = [
this, &xAutoStyleFamilies](
const OUString&
sName,
1557 Any aAny = xAutoStyleFamilies->getByName(
sName );
1558 Reference< XAutoStyleFamily > xAutoStyles = *o3tl::doAccess<Reference<XAutoStyleFamily>>(aAny);
1559 Reference < XEnumeration > xAutoStylesEnum( xAutoStyles->createEnumeration() );
1561 while ( xAutoStylesEnum->hasMoreElements() )
1563 aAny = xAutoStylesEnum->nextElement();
1564 Reference< XAutoStyle > xAutoStyle = *o3tl::doAccess<Reference<XAutoStyle>>(aAny);
1565 Reference < XPropertySet > xPSet( xAutoStyle, uno::UNO_QUERY );
1566 Add( nFamily, xPSet, {}, true );
1575 Reference< XTextFieldsSupplier > xTextFieldsSupp(
GetExport().GetModel(), UNO_QUERY );
1576 if ( xTextFieldsSupp.is() )
1578 Reference< XEnumerationAccess > xTextFields = xTextFieldsSupp->getTextFields();
1579 Reference < XEnumeration > xTextFieldsEnum( xTextFields->createEnumeration() );
1581 while ( xTextFieldsEnum->hasMoreElements() )
1583 Any aAny = xTextFieldsEnum->nextElement();
1584 Reference< XTextField > xTextField = *o3tl::doAccess<Reference<XTextField>>(aAny);
1586 !xAutoStylesSupp.is(),
nullptr );
1589 Reference < XPropertySet > xSet( xTextField, UNO_QUERY );
1590 Reference < XText > xText;
1591 Any a = xSet->getPropertyValue(
"TextRange");
1595 exportText( xText,
true, bIsProgress, bExportContent );
1597 ->collectTextAutoStyles( xText );
1607 Reference<XEnumeration> xTextFramesEnum =
pBoundFrameSets->GetTexts()->createEnumeration();
1608 if(xTextFramesEnum.is())
1609 while(xTextFramesEnum->hasMoreElements())
1611 Reference<XTextContent> xTxtCntnt(xTextFramesEnum->nextElement(), UNO_QUERY);
1617 Reference<XEnumeration> xGraphicsEnum =
pBoundFrameSets->GetGraphics()->createEnumeration();
1618 if(xGraphicsEnum.is())
1619 while(xGraphicsEnum->hasMoreElements())
1621 Reference<XTextContent> xTxtCntnt(xGraphicsEnum->nextElement(), UNO_QUERY);
1627 Reference<XEnumeration> xEmbeddedsEnum =
pBoundFrameSets->GetEmbeddeds()->createEnumeration();
1628 if(xEmbeddedsEnum.is())
1629 while(xEmbeddedsEnum->hasMoreElements())
1631 Reference<XTextContent> xTxtCntnt(xEmbeddedsEnum->nextElement(), UNO_QUERY);
1637 Reference<XEnumeration> xShapesEnum =
pBoundFrameSets->GetShapes()->createEnumeration();
1638 if(xShapesEnum.is())
1639 while(xShapesEnum->hasMoreElements())
1641 Reference<XTextContent> xTxtCntnt(xShapesEnum->nextElement(), UNO_QUERY);
1644 Reference<XServiceInfo> xServiceInfo(xTxtCntnt, UNO_QUERY);
1652 Reference< XTextSectionsSupplier > xSectionsSupp(
GetExport().GetModel(), UNO_QUERY );
1653 if ( xSectionsSupp.is() )
1655 Reference< XIndexAccess > xSections( xSectionsSupp->getTextSections(), UNO_QUERY );
1656 if ( xSections.is() )
1658 nCount = xSections->getCount();
1661 Any aAny = xSections->getByIndex(
i );
1662 Reference< XTextSection > xSection = *o3tl::doAccess<Reference<XTextSection>>(aAny);
1663 Reference < XPropertySet > xPSet( xSection, uno::UNO_QUERY );
1670 Reference< XTextTablesSupplier > xTablesSupp(
GetExport().GetModel(), UNO_QUERY );
1671 if ( xTablesSupp.is() )
1673 Reference< XIndexAccess > xTables( xTablesSupp->getTextTables(), UNO_QUERY );
1676 nCount = xTables->getCount();
1679 Any aAny = xTables->getByIndex(
i );
1680 Reference< XTextTable > xTable = *o3tl::doAccess<Reference<XTextTable>>(aAny);
1686 Reference< XNumberingRulesSupplier > xNumberingRulesSupp(
GetExport().GetModel(), UNO_QUERY );
1687 if ( xNumberingRulesSupp.is() )
1689 Reference< XIndexAccess > xNumberingRules = xNumberingRulesSupp->getNumberingRules();
1690 nCount = xNumberingRules->getCount();
1694 Reference< XIndexReplace > xNumRule( xNumberingRules->getByIndex(
i ), UNO_QUERY );
1695 if( xNumRule.is() && xNumRule->getCount() )
1697 Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
1700 sName = xNamed->getName();
1701 bool bAdd =
sName.isEmpty();
1704 Reference < XPropertySet > xNumPropSet( xNumRule,
1706 if( xNumPropSet.is() &&
1707 xNumPropSet->getPropertySetInfo()
1708 ->hasPropertyByName(
"IsAutomatic" ) )
1710 bAdd = *o3tl::doAccess<bool>(xNumPropSet->getPropertyValue(
"IsAutomatic" ));
1713 xNumPropSet->getPropertySetInfo()
1714 ->hasPropertyByName(
"NumberingIsOutline" ) )
1716 bAdd = !(*o3tl::doAccess<bool>(xNumPropSet->getPropertyValue(
"NumberingIsOutline" )));
1733 const Reference < XText > & rText,
1736 bool bExportParagraph,
1742 Reference < XEnumerationAccess > xEA( rText, UNO_QUERY );
1746 Reference < XEnumeration > xParaEnum(xEA->createEnumeration());
1747 Reference < XPropertySet > xPropertySet( rText, UNO_QUERY );
1748 Reference < XTextSection > xBaseSection;
1752 SAL_WARN_IF( !xParaEnum.is(),
"xmloff",
"We need a paragraph enumeration" );
1753 if( ! xParaEnum.is() )
1756 if (xPropertySet.is())
1758 Reference < XPropertySetInfo > xInfo ( xPropertySet->getPropertySetInfo() );
1764 xPropertySet->getPropertyValue(
gsTextSection) >>= xBaseSection ;
1774 bIsProgress, bExportParagraph,
nullptr, eExtensionNS );
1780 const Reference < XText > & rText,
1781 const Reference < XTextSection > & rBaseSection,
1784 bool bExportParagraph)
1789 Reference < XEnumerationAccess > xEA( rText, UNO_QUERY );
1790 Reference < XEnumeration > xParaEnum(xEA->createEnumeration());
1793 if( ! xParaEnum.is() )
1798 Reference<XPropertySet> xPropertySet;
1801 xPropertySet.set(rText, uno::UNO_QUERY );
1805 bIsProgress, bExportParagraph );
1811 const Reference < XEnumeration > & rContEnum,
1813 const Reference < XTextSection > & rBaseSection,
1815 bool bExportParagraph,
1816 const Reference < XPropertySet > *pRangePropSet,
1819 SAL_WARN_IF( !rContEnum.is(),
"xmloff",
"No enumeration to export!" );
1820 bool bHasMoreElements = rContEnum->hasMoreElements();
1821 if( !bHasMoreElements )
1827 bool bHasContent =
false;
1828 Reference<XTextSection> xCurrentTextSection(rBaseSection);
1834 bool bHoldElement =
false;
1835 Reference < XTextContent > xTxtCntnt;
1836 while( bHoldElement || bHasMoreElements )
1840 bHoldElement =
false;
1844 xTxtCntnt.set(rContEnum->nextElement(), uno::UNO_QUERY);
1850 Reference<XServiceInfo> xServiceInfo( xTxtCntnt, UNO_QUERY );
1856 aPrevNumInfo, aNextNumInfo,
1865 aNextNumInfo.
Set( xTxtCntnt,
1866 GetExport().writeOutlineStyleAsNormalListStyle(),
1868 GetExport().exportTextNumberElement() );
1872 aPrevNumInfo, aNextNumInfo,
1883 while (rContEnum->hasMoreElements() &&
1887 xTxtCntnt.set(rContEnum->nextElement(), uno::UNO_QUERY);
1889 aNextNumInfo.
Reset();
1898 bExportParagraph, aPropSetHelper, eExtensionNS );
1905 aNextNumInfo.
Reset();
1909 aPrevNumInfo, aNextNumInfo,
1918 exportTable( xTxtCntnt, bAutoStyles, bIsProgress );
1923 else if( !bAutoStyles )
1933 exportTextFrame( xTxtCntnt, bAutoStyles, bIsProgress,
true, pRangePropSet );
1945 exportShape( xTxtCntnt, bAutoStyles, pRangePropSet );
1949 SAL_WARN_IF( xTxtCntnt.is(),
"xmloff",
"unknown text content" );
1954 aPrevNumInfo = aNextNumInfo;
1957 bHasMoreElements = rContEnum->hasMoreElements();
1960 if( bHasContent && !bAutoStyles )
1962 aNextNumInfo.
Reset();
1966 aPrevNumInfo, aNextNumInfo,
1972 const Reference < XTextContent > & rTextContent,
1973 bool bAutoStyles,
bool bIsProgress,
bool bExportParagraph,
1976 sal_Int16 nOutlineLevel = -1;
1985 Reference<XMultiPropertySet> xMultiPropSet( rTextContent, UNO_QUERY );
1986 Reference<XPropertySet> xPropSet( rTextContent, UNO_QUERY );
1990 rPropSetHelper.
hasProperties( xPropSet->getPropertySetInfo() );
1997 if( bExportParagraph )
2010 if( rPropSetHelper.
hasProperty( PARA_STYLE_NAME ) )
2012 if( xMultiPropSet.is() )
2013 rPropSetHelper.
getValue( PARA_STYLE_NAME,
2014 xMultiPropSet ) >>= sStyle;
2016 rPropSetHelper.
getValue( PARA_STYLE_NAME,
2017 xPropSet ) >>= sStyle;
2020 if( rTextContent.is() )
2023 if( !rIdentifier.isEmpty() )
2029 uno::Reference<rdf::XMetadatable>
const xMeta(rTextContent,
2031 OSL_ENSURE(!xMeta.is(),
"paragraph that implements "
2032 "XMetadatable used in interfaceToIdentifierMapper?");
2039 if ( sAutoStyle.isEmpty() )
2040 sAutoStyle = sStyle;
2041 if( !sAutoStyle.isEmpty() )
2043 GetExport().EncodeStyleName( sAutoStyle ) );
2045 if( rPropSetHelper.
hasProperty( PARA_CONDITIONAL_STYLE_NAME ) )
2047 OUString sCondStyle;
2048 if( xMultiPropSet.is() )
2049 rPropSetHelper.
getValue( PARA_CONDITIONAL_STYLE_NAME,
2050 xMultiPropSet ) >>= sCondStyle;
2052 rPropSetHelper.
getValue( PARA_CONDITIONAL_STYLE_NAME,
2053 xPropSet ) >>= sCondStyle;
2054 if( sCondStyle != sStyle )
2058 if( !sCondStyle.isEmpty() )
2061 GetExport().EncodeStyleName( sCondStyle ) );
2065 if( rPropSetHelper.
hasProperty( PARA_OUTLINE_LEVEL ) )
2067 if( xMultiPropSet.is() )
2068 rPropSetHelper.
getValue( PARA_OUTLINE_LEVEL,
2069 xMultiPropSet ) >>= nOutlineLevel;
2071 rPropSetHelper.
getValue( PARA_OUTLINE_LEVEL,
2072 xPropSet ) >>= nOutlineLevel;
2074 if( 0 < nOutlineLevel )
2078 OUString::number( sal_Int32( nOutlineLevel) ) );
2080 if ( rPropSetHelper.
hasProperty( PARA_OUTLINE_CONTENT_VISIBLE ) )
2082 uno::Sequence<beans::PropertyValue> propList;
2083 bool bIsOutlineContentVisible =
true;
2084 if( xMultiPropSet.is() )
2086 PARA_OUTLINE_CONTENT_VISIBLE, xMultiPropSet ) >>= propList;
2089 PARA_OUTLINE_CONTENT_VISIBLE, xPropSet ) >>= propList;
2090 for (
const auto& rProp : std::as_const(propList))
2092 OUString propName = rProp.Name;
2093 if (propName ==
"OutlineContentVisibleAttr")
2095 rProp.Value >>= bIsOutlineContentVisible;
2099 if (!bIsOutlineContentVisible)
2107 if( rPropSetHelper.
hasProperty( NUMBERING_IS_NUMBER ) )
2109 bool bIsNumber =
false;
2110 if( xMultiPropSet.is() )
2112 NUMBERING_IS_NUMBER, xMultiPropSet ) >>= bIsNumber;
2115 NUMBERING_IS_NUMBER, xPropSet ) >>= bIsNumber;
2117 OUString sListStyleName;
2118 if( xMultiPropSet.is() )
2120 PARA_NUMBERING_STYLENAME, xMultiPropSet ) >>= sListStyleName;
2123 PARA_NUMBERING_STYLENAME, xPropSet ) >>= sListStyleName;
2125 bool bAssignedtoOutlineStyle =
false;
2127 Reference< XChapterNumberingSupplier > xCNSupplier(
GetExport().GetModel(), UNO_QUERY );
2129 if (xCNSupplier.is())
2131 Reference< XIndexReplace > xNumRule ( xCNSupplier->getChapterNumberingRules() );
2132 SAL_WARN_IF( !xNumRule.is(),
"xmloff",
"no chapter numbering rules" );
2136 Reference< XPropertySet > xNumRulePropSet( xNumRule, UNO_QUERY );
2137 OUString sOutlineName;
2138 xNumRulePropSet->getPropertyValue(
2139 "Name" ) >>= sOutlineName;
2140 bAssignedtoOutlineStyle = ( sListStyleName == sOutlineName );
2145 if( ! bIsNumber && bAssignedtoOutlineStyle )
2152 bool bIsRestartNumbering =
false;
2154 Reference< XPropertySetInfo >
2155 xPropSetInfo(xMultiPropSet.is() ?
2156 xMultiPropSet->getPropertySetInfo():
2157 xPropSet->getPropertySetInfo());
2160 hasPropertyByName(
"ParaIsNumberingRestart"))
2162 xPropSet->getPropertyValue(
"ParaIsNumberingRestart")
2163 >>= bIsRestartNumbering;
2166 if (bIsRestartNumbering)
2173 hasPropertyByName(
"NumberingStartValue"))
2175 sal_Int32 nStartValue = 0;
2177 xPropSet->getPropertyValue(
"NumberingStartValue")
2183 OUString::number(nStartValue));
2192 Reference < XEnumerationAccess > xEA( rTextContent, UNO_QUERY );
2193 Reference < XEnumeration > xTextEnum = xEA->createEnumeration();
2194 const bool bHasPortions = xTextEnum.is();
2196 Reference < XEnumeration> xContentEnum;
2197 Reference < XContentEnumerationAccess > xCEA( rTextContent, UNO_QUERY );
2200 const bool bHasContentEnum = xContentEnum.is() &&
2201 xContentEnum->hasMoreElements();
2203 Reference < XTextSection > xSection;
2204 if( bHasContentEnum )
2212 if( xPropSet->getPropertySetInfo()->hasPropertyByName(
gsTextSection ) )
2214 xSection.set(xPropSet->getPropertyValue(
gsTextSection ), uno::UNO_QUERY);
2226 bool bPrevCharIsSpace(
true);
2230 if( bHasContentEnum )
2232 xContentEnum, bAutoStyles, xSection,
2245 if( bHasContentEnum )
2248 xContentEnum, bAutoStyles, xSection,
2256 const Reference < XEnumeration > & rTextEnum,
2257 bool bAutoStyles,
bool bIsProgress,
2258 bool & rPrevCharIsSpace)
2260 static const char sFieldMarkName[] =
"__FieldMark_";
2266 std::optional<SvXMLElementExport> oTextA;
2267 HyperlinkData aHyperlinkData;
2269 while( rTextEnum->hasMoreElements() )
2271 Reference<XPropertySet> xPropSet(rTextEnum->nextElement(), UNO_QUERY);
2272 Reference < XTextRange > xTxtRange(xPropSet, uno::UNO_QUERY);
2273 Reference<XPropertySetInfo> xPropInfo(xPropSet->getPropertySetInfo());
2277 if (HyperlinkData aNewHyperlinkData(xPropSet); aNewHyperlinkData != aHyperlinkData)
2279 aHyperlinkData = aNewHyperlinkData;
2281 if (aHyperlinkData.addHyperlinkAttributes(
GetExport()))
2284 aHyperlinkData.exportEvents(
GetExport());
2297 rPrevCharIsSpace, openFieldMark);
2301 exportTextField(xTxtRange, bAutoStyles, bIsProgress, &rPrevCharIsSpace);
2303 else if (
sType ==
"Annotation" )
2305 exportTextField(xTxtRange, bAutoStyles, bIsProgress, &rPrevCharIsSpace);
2307 else if (
sType ==
"AnnotationEnd" )
2311 Reference<XNamed> xBookmark(xPropSet->getPropertyValue(
gsBookmark), UNO_QUERY);
2312 const OUString& rName = xBookmark->getName();
2313 if (!rName.isEmpty())
2322 Reference < XEnumeration> xContentEnum;
2323 Reference < XContentEnumerationAccess > xCEA( xTxtRange,
2326 xContentEnum.set(xCEA->createContentEnumeration(
2329 Reference<XTextSection> xSection;
2330 if( xContentEnum.is() )
2333 xSection, bIsProgress,
true,
2340 xTxtRange->getString(),
2341 bAutoStyles, bIsProgress );
2370 else if (
sType ==
"InContentMetadata")
2372 exportMeta(xPropSet, bAutoStyles, bIsProgress, rPrevCharIsSpace);
2374 else if (
sType ==
"ContentControl")
2380 Reference< css::text::XFormField > xFormField(xPropSet->getPropertyValue(
gsBookmark), UNO_QUERY);
2387 Reference<XNamed> xBookmark(xPropSet->getPropertyValue(
gsBookmark), UNO_QUERY);
2393 if (xFormField.is())
2399 if (xFormField.is())
2401 FieldParamExporter(&
GetExport(), xFormField->getParameters()).Export();
2408 if (xFormField.is())
2411 Reference< css::container::XNameAccess > xParameters = xFormField->getParameters();
2412 if (xParameters.is() && xParameters->hasByName(
"Name"))
2414 const Any aValue = xParameters->getByName(
"Name");
2417 if (
sName.isEmpty())
2420 sName = sFieldMarkName + OUString::number(
2421 m_xImpl->AddFieldMarkStart(xFormField));
2428 const OUString sFieldType = xFormField->getFieldType();
2431 openFieldMark =
TEXT;
2435 openFieldMark =
CHECK;
2439 openFieldMark =
NONE;
2447 Reference<text::XFormField>
const xFormField(xPropSet->getPropertyValue(
gsBookmark), UNO_QUERY);
2462 Reference< css::text::XFormField > xFormField(xPropSet->getPropertyValue(
gsBookmark), UNO_QUERY);
2472 if (xFormField.is())
2475 Reference< css::container::XNameAccess > xParameters = xFormField->getParameters();
2476 if (xParameters.is() && xParameters->hasByName(
"Name"))
2478 const Any aValue = xParameters->getByName(
"Name");
2481 if (
sName.isEmpty())
2484 sName = sFieldMarkName + OUString::number(
2485 m_xImpl->GetFieldMarkIndex(xFormField));
2502 Reference<XNamed> xBookmark(xPropSet->getPropertyValue(
gsBookmark), UNO_QUERY);
2507 Reference< css::text::XFormField > xFormField(xPropSet->getPropertyValue(
gsBookmark), UNO_QUERY);
2508 if (xFormField.is())
2513 if (xFormField.is())
2515 FieldParamExporter(&
GetExport(), xFormField->getParameters()).Export();
2521 Reference<XNamed> xBookmark(xPropSet->getPropertyValue(
gsBookmark), UNO_QUERY);
2537 else if (
sType ==
"LineBreak")
2543 OSL_FAIL(
"unknown text portion type");
2548 Reference<XServiceInfo> xServiceInfo( xTxtRange, UNO_QUERY );
2551 exportTextField(xTxtRange, bAutoStyles, bIsProgress, &rPrevCharIsSpace);
2556 exportTextRange(xTxtRange, bAutoStyles, rPrevCharIsSpace, openFieldMark);
2566 const Reference < XTextContent > &,
2572 const Reference < XTextRange > & rTextRange,
2573 bool bAutoStyles,
bool bIsProgress,
bool *
const pPrevCharIsSpace)
2575 Reference < XPropertySet > xPropSet( rTextRange, UNO_QUERY );
2577 if (!xPropSet->getPropertySetInfo()->hasPropertyByName(
gsTextField ))
2580 Reference < XTextField > xTxtFld(xPropSet->getPropertyValue(
gsTextField ), uno::UNO_QUERY);
2581 SAL_WARN_IF( !xTxtFld.is(),
"xmloff",
"text field missing" );
2584 exportTextField(xTxtFld, bAutoStyles, bIsProgress,
true, pPrevCharIsSpace);
2594 const Reference < XTextField > & xTextField,
2595 const bool bAutoStyles,
const bool bIsProgress,
2596 const bool bRecursive,
bool *
const pPrevCharIsSpace)
2600 pFieldExport->ExportFieldAutoStyle( xTextField, bIsProgress,
2605 assert(pPrevCharIsSpace);
2606 pFieldExport->ExportField(xTextField, bIsProgress, *pPrevCharIsSpace);
2618 const uno::Reference<beans::XPropertySet>& xPropSet)
2627 uno::Reference<text::XTextContent> xLineBreak;
2628 xPropSet->getPropertyValue(
"LineBreak") >>= xLineBreak;
2629 if (!xLineBreak.is())
2634 uno::Reference<beans::XPropertySet> xLineBreakProps(xLineBreak, uno::UNO_QUERY);
2635 if (!xLineBreakProps.is())
2641 xLineBreakProps->getPropertyValue(
"Clear") >>= eClear;
2652 const Reference<XPropertySet> & rPropSet,
2653 const OUString& rProperty,
2669 Reference<XNamed> xName(rPropSet->getPropertyValue(rProperty), UNO_QUERY);
2675 if( *o3tl::doAccess<bool>(rPropSet->getPropertyValue(
gsIsCollapsed)) )
2681 nElement = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(
gsIsStart)) ? 1 : 2;
2685 if( nElement < 2 ) {
2687 const uno::Reference<text::XTextContent> xTextContent(
2688 xName, uno::UNO_QUERY_THROW);
2695 Reference<XPropertySet> bkmkProps(rPropSet->getPropertyValue(rProperty), UNO_QUERY);
2696 Reference<XPropertySetInfo> bkmkPropInfo = bkmkProps->getPropertySetInfo();
2697 OUString
sHidden(
"BookmarkHidden");
2698 if (bkmkPropInfo->hasPropertyByName(
sHidden))
2700 bool bHidden =
false;
2701 bkmkProps->getPropertyValue(
sHidden) >>= bHidden;
2705 OUString sCondition(
"BookmarkCondition");
2706 if (bkmkPropInfo->hasPropertyByName(sCondition))
2708 OUString sBookmarkCondition;
2709 bkmkProps->getPropertyValue(sCondition) >>= sBookmarkCondition;
2717 assert(pElements !=
nullptr);
2718 assert(0 <= nElement && nElement <= 2);
2726 const Reference < XPropertySet > & rPropSet,
2727 const Reference < XPropertySetInfo > & rPropSetInfo )
2729 bool bIsBoundAsChar =
false;
2730 OUString sAnchorType(
"AnchorType" );
2731 if( rPropSetInfo->hasPropertyByName( sAnchorType ) )
2733 TextContentAnchorType eAnchor;
2734 rPropSet->getPropertyValue( sAnchorType ) >>= eAnchor;
2735 bIsBoundAsChar = TextContentAnchorType_AS_CHARACTER == eAnchor;
2738 return bIsBoundAsChar;
2742 const Reference < XPropertySet >& rPropSet,
2745 OUString* pMinHeightValue,
2746 OUString* pMinWidthValue)
2754 Reference < XNamed > xNamed( rPropSet, UNO_QUERY );
2757 OUString
sName( xNamed->getName() );
2758 if( !
sName.isEmpty() )
2760 xNamed->getName() );
2764 OUStringBuffer sValue;
2767 TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH;
2768 rPropSet->getPropertyValue(
gsAnchorType ) >>= eAnchor;
2778 if( TextContentAnchorType_AT_PAGE == eAnchor )
2780 sal_Int16 nPage = 0;
2783 "ERROR: writing invalid anchor-page-number 0");
2785 OUString::number( nPage ) );
2795 eAnchor != TextContentAnchorType_AS_CHARACTER )
2798 sal_Int16 nHoriOrient = HoriOrientation::NONE;
2799 rPropSet->getPropertyValue(
gsHoriOrient ) >>= nHoriOrient;
2800 if( HoriOrientation::NONE == nHoriOrient )
2807 sValue.makeStringAndClear() );
2808 if(
nullptr != pCenter)
2815 else if( TextContentAnchorType_AS_CHARACTER == eAnchor )
2818 if( !bShape || TextContentAnchorType_AS_CHARACTER == eAnchor )
2821 sal_Int16 nVertOrient = VertOrientation::NONE;
2822 rPropSet->getPropertyValue(
gsVertOrient ) >>= nVertOrient;
2823 if( VertOrientation::NONE == nVertOrient )
2830 sValue.makeStringAndClear() );
2831 if(
nullptr != pCenter)
2841 Reference< XPropertySetInfo > xPropSetInfo(rPropSet->getPropertySetInfo());
2843 bool bSyncWidth =
false;
2848 sal_Int16 nRelWidth = 0;
2853 bool bSyncHeight =
false;
2858 sal_Int16 nRelHeight = 0;
2863 awt::Size aLayoutSize;
2864 if ((nRelWidth > 0 || nRelHeight > 0) && xPropSetInfo->hasPropertyByName(
"LayoutSize"))
2866 rPropSet->getPropertyValue(
"LayoutSize") >>= aLayoutSize;
2869 bool bUseLayoutSize =
true;
2870 if (bSyncWidth && bSyncHeight)
2874 bUseLayoutSize =
false;
2876 if (aLayoutSize.Width <= 0 || aLayoutSize.Height <= 0)
2879 bUseLayoutSize =
false;
2883 sal_Int16 nWidthType = SizeType::FIX;
2884 if( xPropSetInfo->hasPropertyByName(
gsWidthType ) )
2886 rPropSet->getPropertyValue(
gsWidthType ) >>= nWidthType;
2888 if( xPropSetInfo->hasPropertyByName(
gsWidth ) )
2890 sal_Int32 nWidth = 0;
2892 if( SizeType::VARIABLE != nWidthType )
2894 rPropSet->getPropertyValue(
gsWidth ) >>= nWidth;
2897 if( SizeType::FIX != nWidthType )
2899 assert(pMinWidthValue);
2902 *pMinWidthValue = sValue.makeStringAndClear();
2907 if ((nRelWidth > 0 || bSyncWidth) && bUseLayoutSize)
2910 sValue.setLength(0);
2915 sValue.makeStringAndClear() );
2916 if(
nullptr != pCenter)
2919 pCenter->
setX(pCenter->
getX() + (0.5 * nWidth));
2929 if( !bSyncWidth && xPropSetInfo->hasPropertyByName(
gsRelativeWidth ) )
2931 SAL_WARN_IF( nRelWidth < 0 || nRelWidth > 254,
"xmloff",
2932 "Got illegal relative width from API" );
2937 sValue.makeStringAndClear() );
2942 sal_Int16 nSizeType = SizeType::FIX;
2943 if( xPropSetInfo->hasPropertyByName(
gsSizeType ) )
2945 rPropSet->getPropertyValue(
gsSizeType ) >>= nSizeType;
2947 if( xPropSetInfo->hasPropertyByName(
gsHeight ) )
2949 sal_Int32 nHeight = 0;
2950 if( SizeType::VARIABLE != nSizeType )
2952 rPropSet->getPropertyValue(
gsHeight ) >>= nHeight;
2956 if( SizeType::FIX != nSizeType && 0==nRelHeight && !bSyncHeight &&
2959 *pMinHeightValue = sValue.makeStringAndClear();
2963 if ((nRelHeight > 0 || bSyncHeight) && bUseLayoutSize)
2966 sValue.setLength(0);
2971 sValue.makeStringAndClear() );
2972 if(
nullptr != pCenter)
2975 pCenter->
setY(pCenter->
getY() + (0.5 * nHeight));
2985 else if( nRelHeight > 0 )
2988 if( SizeType::MIN == nSizeType )
2990 assert(pMinHeightValue);
2991 if (pMinHeightValue)
2993 *pMinHeightValue = sValue.makeStringAndClear();
2998 sValue.makeStringAndClear() );
3001 OUString sZOrder(
"ZOrder" );
3002 if( xPropSetInfo->hasPropertyByName( sZOrder ) )
3004 sal_Int32 nZIndex = 0;
3005 rPropSet->getPropertyValue( sZOrder ) >>= nZIndex;
3009 OUString::number( nZIndex ) );
3013 if (xPropSetInfo->hasPropertyByName(
"Decorative")
3014 && rPropSet->getPropertyValue(
"Decorative").get<
bool>())
3019 return nShapeFeatures;
3023 const Reference < XTextContent > & rTxtCntnt,
3027 bool bExportContent,
3028 const Reference < XPropertySet > *pRangePropSet)
3030 Reference < XPropertySet > xPropSet( rTxtCntnt, UNO_QUERY );
3041 xPropSet->getPropertySetInfo() ) )
3049 if ( bExportContent )
3051 Reference < XTextFrame > xTxtFrame( rTxtCntnt, UNO_QUERY );
3052 Reference < XText > xTxt(xTxtFrame->getText());
3054 exportText( xTxt, bAutoStyles, bIsProgress,
true );
3060 Reference < XShape > xShape( rTxtCntnt, UNO_QUERY );
3071 Reference< XPropertySetInfo > xPropSetInfo(xPropSet->getPropertySetInfo());
3073 bool bAddCharStyles = pRangePropSet &&
3076 bool bIsUICharStyle;
3077 bool bHasAutoStyle =
false;
3081 if( bAddCharStyles )
3082 sStyle =
FindTextStyle( *pRangePropSet, bIsUICharStyle, bHasAutoStyle );
3084 bIsUICharStyle =
false;
3086 bool bDoSomething = bIsUICharStyle
3089 GetExport(), bDoSomething, bHasAutoStyle,
3090 bDoSomething ? *pRangePropSet : Reference<XPropertySet>(),
3093 if( !sStyle.isEmpty() )
3095 GetExport().EncodeStyleName( sStyle ) );
3102 HyperlinkData(xPropSet).addHyperlinkAttributes(
GetExport()),
3117 Reference < XShape > xShape( rTxtCntnt, UNO_QUERY );
3121 ->exportShape( xShape, nFeatures );
3132 const Reference < XPropertySet > & rPropSet,
3133 const Reference < XPropertySetInfo > & rPropSetInfo,
3136 Reference < XTextFrame > xTxtFrame( rPropSet, UNO_QUERY );
3137 Reference < XText > xTxt(xTxtFrame->getText());
3145 OUString aMinHeightValue;
3146 OUString sMinWidthValue;
3148 if ( sAutoStyle.isEmpty() )
3149 sAutoStyle = sStyle;
3150 if( !sAutoStyle.isEmpty() )
3152 GetExport().EncodeStyleName( sAutoStyle ) );
3158 if( !aMinHeightValue.isEmpty() )
3162 if (!sMinWidthValue.isEmpty())
3172 if( (rPropSet->getPropertyValue(
gsChainNextName ) >>= sNext) && !sNext.isEmpty() )
3185 exportText( xTxt,
false, bIsProgress,
true );
3189 Reference<XEventsSupplier> xEventsSupp( xTxtFrame, UNO_QUERY );
3200 const Reference < XPropertySet > & rPropSet,
3201 const Reference < XPropertySetInfo > & rPropSetInfo )
3208 PointSequenceSequence aSourcePolyPolygon;
3212 aSourcePolyPolygon));
3213 const sal_uInt32 nPolygonCount(aPolyPolygon.
count());
3225 bPixel = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(
gsIsPixelContour ));
3229 OUStringBuffer aStringBuffer( 10 );
3259 if(1 == nPolygonCount )
3262 const OUString aPointString(
3273 const OUString aPolygonString(
3287 bool bTmp = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(
3299 const Reference < XPropertySet > & rPropSet,
3300 const Reference < XPropertySetInfo > & rPropSetInfo )
3309 if ( sAutoStyle.isEmpty() )
3310 sAutoStyle = sStyle;
3311 if( !sAutoStyle.isEmpty() )
3313 GetExport().EncodeStyleName( sAutoStyle ) );
3316 sal_Int16 nRotation(0);
3318 const bool bUseRotation(0 != nRotation);
3341 const double fRotate(basegfx::deg2rad<10>(nRotation));
3368 uno::Reference<graphic::XGraphic> xGraphic;
3369 rPropSet->getPropertyValue(
"Graphic") >>= xGraphic;
3371 OUString sInternalURL;
3372 OUString sOutMimeType;
3380 if (!sInternalURL.isEmpty())
3389 OUString sGrfFilter;
3391 if( !sGrfFilter.isEmpty() )
3397 if (sOutMimeType.isEmpty())
3401 if (!sOutMimeType.isEmpty())
3407 "mime-type", sOutMimeType);
3420 const bool bAddReplacementImages = officecfg::Office::Common::Save::Graphic::AddReplacementImages::get();
3421 if (bAddReplacementImages)
3425 uno::Reference<graphic::XGraphic> xReplacementGraphic;
3426 rPropSet->getPropertyValue(
"ReplacementGraphic") >>= xReplacementGraphic;
3428 OUString sInternalURL;
3429 OUString sOutMimeType;
3433 if (xReplacementGraphic.is())
3439 if (!sInternalURL.isEmpty())
3449 if (sOutMimeType.isEmpty())
3453 if (!sOutMimeType.isEmpty())
3459 "mime-type", sOutMimeType);
3465 if (xReplacementGraphic.is())
3473 Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY );
3488 SAL_WARN(
"xmloff",
"no API implementation available" );
3492 const Reference < XPropertySet > &,
3493 const Reference < XPropertySetInfo > & )
3495 SAL_WARN(
"xmloff",
"no API implementation available" );
3501 Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY );
3505 if (rPropSet->getPropertySetInfo()->hasPropertyByName(
"ImageMap"))
3511 const Reference < XPropertySet > & rPropSet,
3512 const Reference < XPropertySetInfo > & rPropSetInfo )
3515 if( rPropSetInfo->hasPropertyByName(
gsTitle ) )
3518 rPropSet->getPropertyValue(
gsTitle ) >>= sObjTitle;
3519 if( !sObjTitle.isEmpty() )
3532 if( !sObjDesc.isEmpty() )
3542 const css::uno::Reference< css::text::XTextRange > & rTextRange,
3543 Reference< XPropertySet >
const & xPropSet,
3544 Reference < XPropertySetInfo > & xPropSetInfo,
3545 const bool bIsUICharStyle,
3546 const bool bHasAutoStyle,
3547 const OUString& sStyle,
3548 bool& rPrevCharIsSpace,
3558 if ( !sStyle.isEmpty() )
3564 const OUString aText( rTextRange->getString() );
3569 openFieldMark =
NONE;
3574 const Reference< XTextRange > & rTextRange,
3576 bool& rPrevCharIsSpace,
3579 Reference< XPropertySet > xPropSet( rTextRange, UNO_QUERY );
3586 bool bIsUICharStyle =
false;
3587 bool bHasAutoStyle =
false;
3588 const OUString sStyle(
3591 Reference < XPropertySetInfo > xPropSetInfo;
3592 exportTextRangeSpan( rTextRange, xPropSet, xPropSetInfo, bIsUICharStyle, bHasAutoStyle, sStyle, rPrevCharIsSpace, openFieldMark );
3597 bool& rPrevCharIsSpace )
3599 sal_Int32 nExpStartPos = 0;
3600 sal_Int32 nEndPos = rText.getLength();
3601 sal_Int32 nSpaceChars = 0;
3605 bool bExpCharAsText =
true;
3606 bool bExpCharAsElement =
false;
3607 bool bCurrCharIsSpace =
false;
3613 bExpCharAsElement =
true;
3614 bExpCharAsText =
false;
3619 if( rPrevCharIsSpace )
3623 bExpCharAsText =
false;
3625 bCurrCharIsSpace =
true;
3628 if( cChar < 0x0020 )
3633 "illegal character in text content" );
3636 bExpCharAsText =
false;
3643 if(
nPos > nExpStartPos && !bExpCharAsText )
3645 SAL_WARN_IF( 0 != nSpaceChars,
"xmloff",
"pending spaces" );
3646 OUString sExp( rText.copy( nExpStartPos,
nPos - nExpStartPos ) );
3648 nExpStartPos =
nPos;
3654 if( nSpaceChars > 0 && !bCurrCharIsSpace )
3658 if( nSpaceChars > 1 )
3661 OUString::number(nSpaceChars) );
3665 XML_S,
false,
false );
3672 if( bExpCharAsElement )
3696 if( bCurrCharIsSpace && rPrevCharIsSpace )
3698 rPrevCharIsSpace = bCurrCharIsSpace;
3702 if( !bExpCharAsText )
3704 SAL_WARN_IF( nExpStartPos !=
nPos,
"xmloff",
"wrong export start pos" );
3705 nExpStartPos =
nPos+1;
3709 if( nExpStartPos < nEndPos )
3711 SAL_WARN_IF( 0 != nSpaceChars,
"xmloff",
" pending spaces " );
3712 OUString sExp( rText.copy( nExpStartPos, nEndPos - nExpStartPos ) );
3717 if( nSpaceChars > 0 )
3719 if( nSpaceChars > 1 )
3722 OUString::number(nSpaceChars) );
3736 Reference<XPropertySet> xPropertySet(
GetExport().GetModel(), UNO_QUERY );
3737 if (!xPropertySet.is())
3741 OUString sIndexAutoMarkFileURL(
3742 "IndexAutoMarkFileURL");
3743 if (!xPropertySet->getPropertySetInfo()->hasPropertyByName(
3744 sIndexAutoMarkFileURL))
3747 xPropertySet->getPropertyValue(sIndexAutoMarkFileURL) >>= sUrl;
3748 if (!sUrl.isEmpty())
3751 GetExport().GetRelativeReference(sUrl) );
3760 const Reference<XText> & rText )
3767 pFieldExport->SetExportOnlyUsedFieldDeclarations(
false );
3777 const Reference<XText> & rText,
3785 const Reference<XText> & rText )
3819 const Reference<XPropertySet> & rPropSet,
3823 if (*o3tl::doAccess<bool>(rPropSet->getPropertyValue(
gsIsCollapsed)))
3827 bool bStart = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(
gsIsStart));
3842 assert(!
bOpenRuby &&
"Can't open a ruby inside of ruby!");
3853 SAL_WARN_IF(sStyleName.isEmpty(),
"xmloff",
"Can't find ruby style!");
3869 assert(
bOpenRuby &&
"Can't close a ruby if none is open!");
3899 const Reference<XPropertySet> & i_xPortion,
3900 bool i_bAutoStyles,
bool i_isProgress,
bool & rPrevCharIsSpace)
3902 bool doExport(!i_bAutoStyles);
3904 switch (
GetExport().getSaneDefaultVersion()) {
3910 const Reference< XTextContent > xTextContent(
3911 i_xPortion->getPropertyValue(
"InContentMetadata"), UNO_QUERY_THROW);
3912 const Reference< XEnumerationAccess > xEA( xTextContent, UNO_QUERY_THROW );
3913 const Reference< XEnumeration > xTextEnum( xEA->createEnumeration() );
3917 const Reference<rdf::XMetadatable> xMeta(xTextContent, UNO_QUERY_THROW);
3920 xMeta->ensureMetadataReference();
3935 const uno::Reference<beans::XPropertySet>& xPortion,
bool bAutoStyles,
bool isProgress,
3936 bool& rPrevCharIsSpace)
3939 bool bExport = !bAutoStyles;
3945 uno::Reference<text::XTextContent> xTextContent(xPortion->getPropertyValue(
"ContentControl"),
3946 uno::UNO_QUERY_THROW);
3947 uno::Reference<container::XEnumerationAccess> xEA(xTextContent, uno::UNO_QUERY_THROW);
3948 uno::Reference<container::XEnumeration> xTextEnum = xEA->createEnumeration();
3950 uno::Reference<beans::XPropertySet> xPropertySet(xTextContent, uno::UNO_QUERY_THROW);
3953 bool bShowingPlaceHolder =
false;
3954 xPropertySet->getPropertyValue(
"ShowingPlaceHolder") >>= bShowingPlaceHolder;
3955 if (bShowingPlaceHolder)
3960 aBuffer.makeStringAndClear());
3963 bool bCheckbox =
false;
3964 xPropertySet->getPropertyValue(
"Checkbox") >>= bCheckbox;
3972 bool bChecked =
false;
3973 xPropertySet->getPropertyValue(
"Checked") >>= bChecked;
3981 OUString aCheckedState;
3982 xPropertySet->getPropertyValue(
"CheckedState") >>= aCheckedState;
3983 if (!aCheckedState.isEmpty())
3988 OUString aUncheckedState;
3989 xPropertySet->getPropertyValue(
"UncheckedState") >>= aUncheckedState;
3990 if (!aUncheckedState.isEmpty())
3995 bool bPicture =
false;
3996 xPropertySet->getPropertyValue(
"Picture") >>= bPicture;
4002 aBuffer.makeStringAndClear());
4006 xPropertySet->getPropertyValue(
"Date") >>= bDate;
4014 OUString aDateFormat;
4015 xPropertySet->getPropertyValue(
"DateFormat") >>= aDateFormat;
4016 if (!aDateFormat.isEmpty())
4021 OUString aDateLanguage;
4022 xPropertySet->getPropertyValue(
"DateLanguage") >>= aDateLanguage;
4023 if (!aDateLanguage.isEmpty())
4027 OUString aCurrentDate;
4028 xPropertySet->getPropertyValue(
"CurrentDate") >>= aCurrentDate;
4029 if (!aCurrentDate.isEmpty())
4034 bool bPlainText =
false;
4035 xPropertySet->getPropertyValue(
"PlainText") >>= bPlainText;
4043 bool bComboBox =
false;
4044 xPropertySet->getPropertyValue(
"ComboBox") >>= bComboBox;
4052 bool bDropDown =
false;
4053 xPropertySet->getPropertyValue(
"DropDown") >>= bDropDown;
4062 xPropertySet->getPropertyValue(
"Alias") >>= aAlias;
4063 if (!aAlias.isEmpty())
4069 xPropertySet->getPropertyValue(
"Tag") >>= aTag;
4070 if (!aTag.isEmpty())
4076 xPropertySet->getPropertyValue(
"Id") >>=
nId;
4082 sal_uInt32 nTabIndex;
4083 if ((xPropertySet->getPropertyValue(
"TabIndex") >>= nTabIndex) && nTabIndex)
4086 OUString::number(nTabIndex));
4090 xPropertySet->getPropertyValue(
"Lock") >>= aLock;
4091 if (!aLock.isEmpty())
4103 uno::Sequence<beans::PropertyValues> aListItems;
4104 xPropertySet->getPropertyValue(
"ListItems") >>= aListItems;
4105 for (
const auto& rListItem : aListItems)
4108 auto it =
aMap.find(
"DisplayText");
4110 if (it !=
aMap.end() && (it->second >>= aValue) && !aValue.isEmpty())
4115 it =
aMap.find(
"Value");
4116 if (it !=
aMap.end() && (it->second >>= aValue))
4131 const Reference<XIndexAccess> & rShapes,
4135 if( ( ! rShapes.is() ) || ( ! xFormExport.is() ) )
4142 Reference<XEnumeration> xShapesEnum =
pBoundFrameSets->GetShapes()->createEnumeration();
4143 if(!xShapesEnum.is())
4145 while( xShapesEnum->hasMoreElements() )
4153 Reference<XControlShape> xControlShape(xShapesEnum->nextElement(), UNO_QUERY);
4154 if( xControlShape.is() )
4160 Reference<XTextContent> xTextContent( xControlShape, UNO_QUERY );
4161 if( xTextContent.is() )
4169 xFormExport->excludeFromExport(
4170 xControlShape->getControl() );
constexpr OUStringLiteral sHidden
The MultiPropertySetHelper performs the following functions:
void hasProperties(const css::uno::Reference< css::beans::XPropertySetInfo > &)
Call hasPropertiesByName for the provided XPropertySetInfo and build list of allowed properties.
const css::uno::Any & getValue(sal_Int16 nIndex)
Get a value from the values array.
bool hasProperty(sal_Int16 nIndex)
Find out if this property is supported.
bool checkedProperties()
Return whether hasProperties was called (i.e.
void SetValue(sal_Int32 nValue)
sal_Int32 GetValue() const
const OUString & GetExportString()
bool hasProperty(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, css::uno::Reference< css::beans::XPropertySetInfo > &rPropSetInfo)
void AddFamily(XmlStyleFamily nFamily, const OUString &rStrName, SvXMLExportPropertyMapper *pMapper, const OUString &aStrPrefix)
register a new family with its appropriate instance of a derivation of XMLPropertySetMapper for famil...
void exportXML(XmlStyleFamily nFamily) const
Export all item sets ofs a certain class in the order in that they have been added.
css::uno::Sequence< OUString > GetPropertyNames()
retrieve the names of the properties used in the styles
ProgressBarHelper * GetProgressBarHelper()
::comphelper::UnoInterfaceToUniqueIdentifierMapper & getInterfaceToIdentifierMapper()
OUString GetRelativeReference(const OUString &rValue)
void AddAttributeXmlId(css::uno::Reference< css::uno::XInterface > const &i_xIfc)
add xml:id attribute (for RDF metadata)
XMLEventExport & GetEventExport()
get Event export, with handlers for script types "None" and "StarBasic" already registered; other han...
void StartElement(sal_uInt16 nPrefix, enum ::xmloff::token::XMLTokenEnum eName, bool bIgnWSOutside)
rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport()
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
void Characters(const OUString &rChars)
bool GetGraphicMimeTypeFromStream(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, OUString &rOutMimeType)
void SAL_DLLPRIVATE AddAttributeIdLegacy(sal_uInt16 const nLegacyPrefix, OUString const &rValue)
add xml:id and legacy namespace id
rtl::Reference< XMLShapeExport > const & GetShapeExport()
OUString EncodeStyleName(const OUString &rName, bool *pEncoded=nullptr) const
bool AddEmbeddedXGraphicAsBase64(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic)
XMLImageMapExport & GetImageMapExport()
get the export for image maps
const SvXMLUnitConverter & GetMM100UnitConverter() const
void AddAttributesRDFa(css::uno::Reference< css::text::XTextContent > const &i_xTextContent)
add RDFa attributes for a metadatable text content
void EndElement(sal_uInt16 nPrefix, enum ::xmloff::token::XMLTokenEnum eName, bool bIgnWSInside)
OUString AddEmbeddedXGraphic(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, OUString &rOutMimeType, OUString const &rRequestedName=OUString())
void convertMeasureToXML(OUStringBuffer &rBuffer, sal_Int32 nMeasure) const
convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit
virtual bool exportXML(OUString &rStrExpValue, const css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const override
Exports the given value according to the XML-data-type corresponding to the derived class.
void Export(css::uno::Reference< css::document::XEventsSupplier > const &xAccess, bool bUseWhitespace=true)
export the events (calls EventExport::Export(Reference<XNameAccess>) )
void Export(const css::uno::Reference< css::beans::XPropertySet > &rPropertySet)
Get the ImageMap object from the "ImageMap" property and subsequently export the map (if present).
This class handles the export of index marks for table of content, alphabetical and user index.
This class handles the export of redline portions.
This class handles the export of sections and indices (which are, internally, just sections).
static bool IsInSection(const css::uno::Reference< css::text::XTextSection > &rEnclosingSection, const css::uno::Reference< css::text::XTextContent > &rContent, bool bDefault)
Determine whether rContent is contained in rEnclosingSection.
SvXMLExport & GetExport()
OUString Add(const css::uno::Reference< css::container::XIndexReplace > &rNumRules)
information about list and list style for a certain paragraph
const OUString & GetNumRulesName() const
void Set(const css::uno::Reference< css::text::XTextContent > &rTextContent, const bool bOutlineStyleAsNormalListStyle, const XMLTextListAutoStylePool &rListAutoPool, const bool bExportTextNumberElement)
const OUString & ListLabelString() const
const OUString & GetListId() const
sal_Int16 GetListLevelStartValue() const
sal_Int16 GetLevel() const
bool IsListIdDefault() const
bool BelongsToSameList(const XMLTextNumRuleInfo &rCmp) const
bool HasStartValue() const
sal_uInt32 GetStartValue() const
bool IsContinueingPreviousSubTree() const
void recordTrackedChangesForXText(const css::uno::Reference< css::text::XText > &rText)
Record tracked changes for this particular XText (empty reference stop recording) This should be used...
std::unique_ptr< XMLRedlineExport > pRedlineExport
may be NULL (if no redlines should be exported; e.g. in block mode)
SvXMLAutoStylePoolP & GetAutoStylePool()
void exportTextFrame(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, bool bProgress, bool bExportContent, const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet=nullptr)
virtual void _exportTextEmbedded(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const css::uno::Reference< css::beans::XPropertySetInfo > &rPropSetInfo)
void exportShape(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet=nullptr)
virtual void _collectTextEmbeddedAutoStyles(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
void exportTextField(const css::uno::Reference< css::text::XTextRange > &rTextRange, bool bAutoStyles, bool bProgress, bool *pPrevCharIsSpace)
rtl::Reference< SvXMLExportPropertyMapper > xSectionPropMapper
virtual void exportTableAutoStyles()
void PreventExportOfControlsInMuteSections(const css::uno::Reference< css::container::XIndexAccess > &rShapes, const rtl::Reference< xmloff::OFormLayerXMLExport > &xFormExport)
exclude form controls which are in mute sections.
SinglePropertySetInfoCache aCharStyleNamesPropInfoCache
const ::std::unique_ptr< ::xmloff::BoundFrameSets > pBoundFrameSets
void exportTextDeclarations()
This method exports (text field) declarations etc.
void exportTitleAndDescription(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const css::uno::Reference< css::beans::XPropertySetInfo > &rPropSetInfo)
static constexpr OUStringLiteral gsCharStyleNames
rtl::Reference< SvXMLExportPropertyMapper > xRubyPropMapper
std::unique_ptr< XMLIndexMarkExport > pIndexMarkExport
virtual ~XMLTextParagraphExport() override
XMLTextListsHelper * mpTextListsHelper
::std::vector< std::unique_ptr< XMLTextListsHelper > > maTextListsHelperStack
void exportTextGraphic(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet=nullptr)
std::unique_ptr< XMLTextFieldExport > pFieldExport
rtl::Reference< SvXMLExportPropertyMapper > xParaPropMapper
void exportContour(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const css::uno::Reference< css::beans::XPropertySetInfo > &rPropSetInfo)
virtual void exportTable(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, bool bProgress)
SvXMLAutoStylePoolP & rAutoStylePool
void PushNewTextListsHelper()
rtl::Reference< SvXMLExportPropertyMapper > xTextPropMapper
void collectTextAutoStylesOptimized(bool bIsProgress)
void exportTextRangeEnumeration(const css::uno::Reference< css::container::XEnumeration > &rRangeEnum, bool bAutoStyles, bool bProgress, bool &rPrevCharIsSpace)
static constexpr OUStringLiteral gsFootnote
void _exportTextFrame(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const css::uno::Reference< css::beans::XPropertySetInfo > &rPropSetInfo, bool bProgress)
void exportMeta(const css::uno::Reference< css::beans::XPropertySet > &i_xPortion, bool i_bAutoStyles, bool i_isProgress, bool &rPrevCharIsSpace)
export a text:meta
void exportListAndSectionChange(css::uno::Reference< css::text::XTextSection > &rOldSection, const css::uno::Reference< css::text::XTextSection > &rNewSection, const XMLTextNumRuleInfo &rOldList, const XMLTextNumRuleInfo &rNewList, bool bAutoStyles)
check if current section or current list has changed; calls exportListChange as appropriate
void exportTextRange(const css::uno::Reference< css::text::XTextRange > &rTextRange, bool bAutoStyles, bool &rPrevCharWasSpace, FieldmarkType &openFieldmarkType)
void exportTextContentEnumeration(const css::uno::Reference< css::container::XEnumeration > &rContentEnum, bool bAutoStyles, const css::uno::Reference< css::text::XTextSection > &rBaseSection, bool bProgress, bool bExportParagraph=true, const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet=nullptr, TextPNS eExtensionNS=TextPNS::ODF)
void exportTextLineBreak(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
void exportTextEmbedded(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet=nullptr)
OUString FindTextStyle(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, bool &rbHasCharStyle, bool &rbHasAutoStyle, const XMLPropertyState **pAddState=nullptr) const
static SvXMLExportPropertyMapper * CreateShapeExtPropMapper(SvXMLExport &rExport)
void exportRuby(const css::uno::Reference< css::beans::XPropertySet > &rPortionPropSet, bool bAutoStyles)
export a ruby
void exportTextFootnote(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const OUString &sString, bool bAutoStyles, bool bProgress)
export a footnote and styles
XMLTextListAutoStylePool maListAutoPool
static SvXMLExportPropertyMapper * CreateParaDefaultExtPropMapper(SvXMLExport &rExport)
void exportPageFrames(bool bProgress)
const XMLTextListAutoStylePool & GetListAutoStylePool() const
rtl::Reference< SvXMLExportPropertyMapper > xAutoFramePropMapper
static constexpr OUStringLiteral gsFrameStyleName
static constexpr OUStringLiteral gsTextSection
void ExportContentControl(const css::uno::Reference< css::beans::XPropertySet > &xPortion, bool bAutoStyles, bool isProgress, bool &rPrevCharIsSpace)
Exports a <loext:content-control> element.
void exportTextAutoStyles()
void exportCharacterData(const OUString &rText, bool &rPrevCharWasSpace)
void recordTrackedChangesNoXText()
Stop recording tracked changes.
OUString sOpenRubyCharStyle
std::unique_ptr< Impl > m_xImpl
void Add(XmlStyleFamily nFamily, MultiPropertySetHelper &rPropSetHelper, const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
add autostyle for specified family
void exportSoftPageBreak()
XMLShapeExportFlags addTextFrameAttributes(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, bool bShape, basegfx::B2DPoint *pCenter=nullptr, OUString *pMinHeightValue=nullptr, OUString *pMinWidthValue=nullptr)
void exportTextMark(const css::uno::Reference< css::beans::XPropertySet > &xPropSet, const OUString &rProperty, const enum ::xmloff::token::XMLTokenEnum pElements[], bool bAutoStyles)
static SvXMLExportPropertyMapper * CreateCharExtPropMapper(SvXMLExport &rExport)
void exportListChange(const XMLTextNumRuleInfo &rPrvInfo, const XMLTextNumRuleInfo &rNextInfo)
OUString Find(XmlStyleFamily nFamily, const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const OUString &rParent, const o3tl::span< const XMLPropertyState > aAddStates={}) const
find style name for specified family and parent
void exportUsedDeclarations()
export all declarations
std::unique_ptr< XMLSectionExport > pSectionExport
void exportTextRangeSpan(const css::uno::Reference< css::text::XTextRange > &rTextRange, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, css::uno::Reference< css::beans::XPropertySetInfo > &xPropSetInfo, const bool bIsUICharStyle, const bool bHasAutoStyle, const OUString &sStyle, bool &rPrevCharIsSpace, FieldmarkType &openFieldMark)
void exportEvents(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
void _exportTextGraphic(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const css::uno::Reference< css::beans::XPropertySetInfo > &rPropSetInfo)
void exportTrackedChanges(bool bAutoStyle)
Export the list of change information (enclosed by <tracked-changes>) (or the necessary automatic sty...
rtl::Reference< SvXMLExportPropertyMapper > xFramePropMapper
XMLTextParagraphExport(SvXMLExport &rExp, SvXMLAutoStylePoolP &rASP)
void exportAnyTextFrame(const css::uno::Reference< css::text::XTextContent > &rTextContent, FrameType eTxpe, bool bAutoStyles, bool bProgress, bool bExportContent, const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet)
void exportParagraph(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, bool bProgress, bool bExportParagraph, MultiPropertySetHelper &rPropSetHelper, TextPNS eExtensionNS)
void exportText(const css::uno::Reference< css::text::XText > &rText, bool bAutoStyles, bool bProgress, bool bExportParagraph, TextPNS eExtensionNS=TextPNS::ODF)
void PopTextListsHelper()
void exportFrameFrames(bool bAutoStyles, bool bProgress, const css::uno::Reference< css::text::XTextFrame > *pParentTxtFrame)
static SvXMLExportPropertyMapper * CreateParaExtPropMapper(SvXMLExport &rExport)
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
B2DRange getB2DRange() const
const OUString & getIdentifier(const css::uno::Reference< css::uno::XInterface > &rInterface) const
css::uno::Type const & get()
constexpr iterator begin() const noexcept
constexpr iterator end() const noexcept
static bool convertMeasurePx(sal_Int32 &rValue, std::u16string_view rString)
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
static bool convertBool(bool &rBool, std::u16string_view rString)
unique_ptr< BoundFrames > m_pTexts
const BoundFrames * GetShapes() const
const BoundFrames * GetGraphics() const
const BoundFrames * GetEmbeddeds() const
BoundFrameSets(const Reference< XInterface > &rModel)
unique_ptr< BoundFrames > m_pGraphics
const BoundFrames * GetTexts() const
unique_ptr< BoundFrames > m_pShapes
unique_ptr< BoundFrames > m_pEmbeddeds
constexpr OUStringLiteral XML_STYLE_FAMILY_SD_GRAPHICS_NAME
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
OUString exportToSvgD(const B2DPolyPolygon &rPolyPoly, bool bUseRelativeCoordinates, bool bDetectQuadraticBeziers, bool bHandleRelativeNextPointCompatible, bool bOOXMLMotionPath=false)
OUString exportToSvgPoints(const B2DPolygon &rPoly)
B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon(const css::drawing::PointSequenceSequence &rPointSequenceSequenceSource)
double normalizeToRange(double v, const double fRange)
B2IRange fround(const B2DRange &rRange)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
Handling of tokens in XML:
XMLTokenEnum
The enumeration of all XML tokens.
@ XML_SHOWING_PLACE_HOLDER
@ XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE
@ XML_OUTLINE_CONTENT_VISIBLE
@ XML_FIELDMARK_SEPARATOR
@ XML_REFERENCE_MARK_START
@ XML_DATE_RFC_LANGUAGE_TAG
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
bool operator==(const AttributeDescription &i_lhs, const AttributeDescription &i_rhs)
HashMap_OWString_Interface aMap
constexpr OUStringLiteral ODF_FORMTEXT
constexpr OUStringLiteral ODF_FORMCHECKBOX
constexpr OUStringLiteral ODF_OLE_PARAM
static void ExportParameter(OUStringBuffer &rStrBuffer, const css::drawing::EnhancedCustomShapeParameter &rParameter)
Smart struct to transport an Any with an index to the appropriate property-name.
sal_Int32 GetFieldMarkIndex(Reference< XFormField > const &i_xFieldMark)
sal_Int32 AddFieldMarkStart(Reference< XFormField > const &i_xFieldMark)
::std::map< Reference< XFormField >, sal_Int32 > FieldMarkMap_t
FieldMarkMap_t m_FieldMarkMap
constexpr OUStringLiteral gsTextFieldStartEnd(u"TextFieldStartEnd")
constexpr OUStringLiteral gsParagraphService(u"com.sun.star.text.Paragraph")
constexpr OUStringLiteral gsChainNextName(u"ChainNextName")
constexpr OUStringLiteral gsRelativeWidth(u"RelativeWidth")
constexpr OUStringLiteral gsVisitedCharStyleName(u"VisitedCharStyleName")
constexpr OUStringLiteral gsAnchorType(u"AnchorType")
constexpr OUStringLiteral gsVertOrientPosition(u"VertOrientPosition")
constexpr OUStringLiteral gsSizeType(u"SizeType")
static const char * aParagraphPropertyNamesAuto[]
constexpr OUStringLiteral gsReferenceMark(u"ReferenceMark")
constexpr OUStringLiteral gsContourPolyPolygon(u"ContourPolyPolygon")
constexpr OUStringLiteral gsTextContentService(u"com.sun.star.text.TextContent")
enum XMLTokenEnum lcl_XmlBookmarkElements[]
constexpr OUStringLiteral gsTableService(u"com.sun.star.text.TextTable")
constexpr OUStringLiteral gsBookmark(u"Bookmark")
constexpr OUStringLiteral gsTextFieldSep(u"TextFieldSeparator")
constexpr OUStringLiteral gsHoriOrientPosition(u"HoriOrientPosition")
constexpr OUStringLiteral gsFrame(u"Frame")
constexpr OUStringLiteral gsHyperLinkURL(u"HyperLinkURL")
constexpr OUStringLiteral gsDescription(u"Description")
constexpr OUStringLiteral gsHoriOrient(u"HoriOrient")
constexpr OUStringLiteral gsNumberingRules(u"NumberingRules")
constexpr OUStringLiteral gsServerMap(u"ServerMap")
static bool lcl_txtpara_isBoundAsChar(const Reference< XPropertySet > &rPropSet, const Reference< XPropertySetInfo > &rPropSetInfo)
constexpr OUStringLiteral gsParaConditionalStyleName(u"ParaConditionalStyleName")
static const char * aParagraphPropertyNames[]
constexpr OUStringLiteral gsDocumentIndexMark(u"DocumentIndexMark")
constexpr OUStringLiteral gsText(u"Text")
constexpr OUStringLiteral gsHyperLinkName(u"HyperLinkName")
constexpr OUStringLiteral gsRubyCharStyleName(u"RubyCharStyleName")
constexpr OUStringLiteral gsIsPixelContour(u"IsPixelContour")
constexpr OUStringLiteral gsWidthType(u"WidthType")
constexpr OUStringLiteral gsHeight(u"Height")
constexpr OUStringLiteral gsTextFieldStart(u"TextFieldStart")
constexpr OUStringLiteral gsTextField(u"TextField")
constexpr OUStringLiteral gsRuby(u"Ruby")
constexpr OUStringLiteral gsIsStart(u"IsStart")
constexpr OUStringLiteral gsGraphicRotation(u"GraphicRotation")
constexpr OUStringLiteral gsTextFieldEnd(u"TextFieldEnd")
constexpr OUStringLiteral gsIsSyncHeightToWidth(u"IsSyncHeightToWidth")
constexpr OUStringLiteral gsUnvisitedCharStyleName(u"UnvisitedCharStyleName")
static bool lcl_validPropState(const XMLPropertyState &rState)
constexpr OUStringLiteral gsTextFrameService(u"com.sun.star.text.TextFrame")
constexpr OUStringLiteral gsTitle(u"Title")
constexpr OUStringLiteral gsTextGraphicService(u"com.sun.star.text.TextGraphicObject")
constexpr OUStringLiteral gsTextEmbeddedService(u"com.sun.star.text.TextEmbeddedObject")
constexpr OUStringLiteral gsIsAutomaticContour(u"IsAutomaticContour")
constexpr OUStringLiteral gsWidth(u"Width")
constexpr OUStringLiteral gsShapeService(u"com.sun.star.drawing.Shape")
constexpr OUStringLiteral gsTextFieldService(u"com.sun.star.text.TextField")
constexpr OUStringLiteral gsVertOrient(u"VertOrient")
static bool txtparae_bContainsIllegalCharacters
constexpr OUStringLiteral gsHyperLinkTarget(u"HyperLinkTarget")
constexpr OUStringLiteral gsIsSyncWidthToHeight(u"IsSyncWidthToHeight")
constexpr OUStringLiteral gsRedline(u"Redline")
constexpr OUStringLiteral gsIsCollapsed(u"IsCollapsed")
constexpr OUStringLiteral gsGraphicFilter(u"GraphicFilter")
constexpr OUStringLiteral gsTextPortionType(u"TextPortionType")
constexpr OUStringLiteral gsRelativeHeight(u"RelativeHeight")
constexpr OUStringLiteral gsSoftPageBreak(u"SoftPageBreak")
constexpr OUStringLiteral gsAnchorPageNo(u"AnchorPageNo")
enum XMLTokenEnum lcl_XmlReferenceElements[]
constexpr OUStringLiteral gsRubyText(u"RubyText")
#define CTF_HYPERLINK_URL
@ TEXT_ADDITIONAL_DEFAULTS
#define CTF_CHAR_STYLE_NAME
std::unique_ptr< char[]> aBuffer
bool operator!=(const XclExpString &rLeft, const XclExpString &rRight)
constexpr sal_uInt16 XML_NAMESPACE_DRAW
constexpr sal_uInt16 XML_NAMESPACE_FIELD
constexpr sal_uInt16 XML_NAMESPACE_XLINK
constexpr sal_uInt16 XML_NAMESPACE_SVG
constexpr sal_uInt16 XML_NAMESPACE_TEXT
constexpr sal_uInt16 XML_NAMESPACE_XML
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
constexpr sal_uInt16 XML_NAMESPACE_STYLE
constexpr sal_uInt16 XML_NAMESPACE_FO