36#include <com/sun/star/document/XFilter.hpp>
37#include <com/sun/star/document/XImporter.hpp>
38#include <com/sun/star/frame/XModel.hpp>
39#include <com/sun/star/lang/XMultiServiceFactory.hpp>
46class SwRTFReader :
public Reader
49 const OUString& rFileName)
override;
64 auto pSttNdIdx = std::make_shared<SwNodeIndex>(rDoc.
GetNodes());
73 auto pSttNdIdx2 = std::make_shared<SwNodeIndex>(rDoc.
GetNodes());
82 uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(
84 uno::Reference<uno::XInterface> xInterface(
85 xMultiServiceFactory->createInstance(
"com.sun.star.comp.Writer.RtfFilter"),
88 uno::Reference<document::XImporter> xImporter(xInterface, uno::UNO_QUERY_THROW);
89 uno::Reference<lang::XComponent> xDstDoc(pDocShell->GetModel(), uno::UNO_QUERY_THROW);
90 xImporter->setTargetDocument(xDstDoc);
95 uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW);
100 {
"TextInsertModeRange",
101 uno::Any(uno::Reference<text::XTextRange>(xInsertTextRange)) } }));
105 xFilter->filter(aDescriptor);
107 catch (uno::Exception
const&)
116 if (pSttNdIdx->GetIndex())
124 && pSttNdIdx->GetIndex() + 1 == aNxtIdx.GetIndex())
128 if (aPam.GetPoint()->GetNode() == aNxtIdx.GetNode())
130 aPam.GetPoint()->Assign(*pTextNode, pTextNode->
GetText().getLength());
136 if (pTextNode->
GetText().getLength())
152 if (pSttNdIdx2->GetIndex())
160 && pSttNdIdx2->GetIndex() - 1 == aPrevIdx.GetIndex())
166 if (pTextNode->
GetText().getLength())
186 uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(
188 uno::Reference<uno::XInterface> xInterface(
189 xMultiServiceFactory->createInstance(
"com.sun.star.comp.Writer.RtfFilter"),
192 uno::Reference<document::XImporter> xImporter(xInterface, uno::UNO_QUERY_THROW);
193 uno::Reference<lang::XComponent> xDstDoc(xDocSh->
GetModel(), uno::UNO_QUERY_THROW);
194 xImporter->setTargetDocument(xDstDoc);
196 uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW);
203 xFilter->filter(aDescriptor);
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart)=0
Split a node at rPos (implemented only for TextNode).
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
virtual ErrCode Read(SwDoc &, const OUString &rBaseURL, SwPaM &, const OUString &)=0
css::uno::Reference< css::frame::XModel3 > GetModel() const
bool CanJoinNext(SwNodeIndex *pIdx=nullptr) const
Is it possible to join two nodes? In pIdx the second position can be returned.
bool CanJoinPrev(SwNodeIndex *pIdx=nullptr) const
Can we join two Nodes? We can return the 2nd position in pIdx.
const SfxPoolItem * GetNoCondAttr(sal_uInt16 nWhich, bool bInParents) const
Obtains attribute that is not delivered via conditional style!
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat, const bool bReset=true, const bool bResetListAttrs=false, SwRootFrame const *pLayout=nullptr)
Add 4th optional parameter <bResetListAttrs>.
SwDocShell * GetDocShell()
Marks a node in the document model.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
PaM is Point and Mark: a selection of the document model.
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
const SwPosition * GetPoint() const
SwTextNode is a paragraph in the document model.
virtual SwContentNode * JoinNext() override
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
virtual SwFormatColl * ChgFormatColl(SwFormatColl *) override
void CopyCollFormat(SwTextNode &rDestNd, bool bUndoForChgFormatColl=true)
Copy collection with all auto formats to dest-node.
const OUString & GetText() const
SwTextFormatColl * GetTextColl() const
#define TOOLS_WARN_EXCEPTION(area, stream)
constexpr TypedWhichId< SfxStringItem > RES_PARATR_LIST_ID(RES_PARATR_LIST_BEGIN)
static OUString Read(SvStream &rStream)
Reference< XMultiServiceFactory > getProcessServiceFactory()
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange, ::sw::TextRangeMode const eMode)
SwMoveFnCollection const & fnMoveBackward
@ RES_POOLCOLL_STANDARD
Standard.
Marks a position in the document model.
SwNodeOffset GetNodeIndex() const
#define ERR_SWG_READ_ERROR
SAL_DLLPUBLIC_EXPORT bool TestImportRTF(SvStream &rStream)
SAL_DLLPUBLIC_EXPORT Reader * ImportRTF()