22 #include <com/sun/star/document/XFilter.hpp>
23 #include <com/sun/star/document/XImporter.hpp>
24 #include <com/sun/star/frame/XModel.hpp>
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
50 if (!m_pMedium->GetInStream())
59 uno::Reference<uno::XInterface> xInterface(xMultiServiceFactory->createInstance(
"com.sun.star.comp.Writer.WriterFilter"), uno::UNO_SET_THROW);
62 uno::Reference<lang::XComponent> xDstDoc(pDocShell->GetModel(), uno::UNO_QUERY_THROW);
63 uno::Reference<document::XImporter> xImporter(xInterface, uno::UNO_QUERY_THROW);
64 xImporter->setTargetDocument(xDstDoc);
73 pDocShell->SetLoading(SfxLoadedFlags::NONE);
77 {
"InputStream",
uno::Any(xStream) },
79 {
"TextInsertModeRange",
uno::Any(xInsertTextRange) }
83 uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW);
86 xFilter->filter(aDescriptor);
88 catch (uno::Exception
const&)
93 pDocShell->SetLoading(SfxLoadedFlags::ALL);
111 uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(
114 uno::Reference<uno::XInterface> xInterface(
115 xMultiServiceFactory->createInstance(
"com.sun.star.comp.Writer.WriterFilter" ),
116 uno::UNO_SET_THROW );
118 uno::Reference<document::XFilter> xFilter( xInterface, uno::UNO_QUERY_THROW );
119 uno::Reference<document::XImporter> xImporter( xFilter, uno::UNO_QUERY_THROW );
124 uno::Reference<lang::XComponent> xDstDoc( xDocSh->
GetModel(), uno::UNO_QUERY_THROW );
125 xImporter->setTargetDocument( xDstDoc );
130 {
"InputStream",
uno::Any(xStream) },
131 {
"ReadGlossaries",
uno::Any(
true) }
134 if( xFilter->filter( aDescriptor ) )
138 bool bRet = MakeEntries(static_cast<SwDocShell*>(&xDocSh)->GetDoc(), rBlocks);
150 const OUString aOldURL( rBlocks.
GetBaseURL() );
156 SwNodeIndex aStart( *aDocEnd.GetNode().StartOfSectionNode(), 1 );
157 bool bIsAutoText =
false;
159 if( aStart < aDocEnd && ( aDocEnd.GetIndex() - aStart.GetIndex() >
SwNodeOffset(2) ) )
169 SwPaM aPam( aStart );
183 SwPaM aPam( aStart );
188 if(
nullptr == pCNd )
205 if(
nullptr == pCNd )
219 OUString sShortcut = aLNm;
222 sal_Int32 nStart = 0;
223 sal_uInt16 nCurPos = rBlocks.
GetIndex( sShortcut );
225 while( sal_uInt16(-1) != nCurPos )
228 sShortcut = aLNm + OUString::number( ++nStart );
229 nCurPos = rBlocks.
GetIndex( sShortcut );
247 aStart = aStart.GetNode().EndOfSectionIndex() + 1;
248 }
while( aStart < aDocEnd && aStart.GetNode().IsStartNode() );
virtual sal_Int32 Len() const
virtual ErrCode Read(SwDoc &, const OUString &, SwPaM &, const OUString &) override
SwNode & GetNode(bool bPoint=true) const
SwNodeOffset EndOfSectionIndex() const
Represents the style of a paragraph.
Marks a position in the document model.
const OUString & GetText() const
SwDocShell * GetDocShell()
constexpr OUStringLiteral AUTOTEXT_GALLERY
virtual bool HasGlossaries() const override
css::uno::Reference< css::frame::XModel3 > GetModel() const
IDocumentContentOperations const & getIDocumentContentOperations() const
bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat, const bool bReset=true, const bool bResetListAttrs=false, SwRootFrame const *pLayout=nullptr)
Add 4th optional parameter .
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
check if target position is in fly anchored at source range
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
PaM is Point and Mark: a selection of the document model.
#define TOOLS_WARN_EXCEPTION(area, stream)
void SetBaseURL(const OUString &rURL)
const SwPosition * GetPoint() const
virtual bool CopyRange(SwPaM &rPam, SwPosition &rPos, SwCopyFlags flags) const =0
Copy a selected content range to a position.
SwIndex & Assign(SwIndexReg *, sal_Int32)
SwContentNode * GetContentNode()
Marks a character position inside a document model node.
void EndPutMuchBlockEntries()
Marks a node in the document model.
virtual bool ReadGlossaries(SwTextBlocks &rBlocks, bool bSaveRelFiles) const override
static bool MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks)
bool BeginPutDoc(const OUString &, const OUString &)
OUString GetBaseURL() const
Reference< XMultiServiceFactory > getProcessServiceFactory()
sal_uInt16 GetIndex(const OUString &) const
virtual SwReaderType GetReaderType() override
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
Wrapper for the UNO DOCX import filter (in writerfilter) for autotext purposes.
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart)=0
Split a node at rPos (implemented only for TextNode).
#define ERR_SWG_READ_ERROR
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
SAL_DLLPUBLIC_EXPORT Reader * ImportDOCX()
bool StartPutMuchBlockEntries()
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwTextNode * MakeTextNode(const SwNodeIndex &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.