LibreOffice Module sw (master) 1
SwXMLTextBlocks.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <sal/config.h>
23
24#include <string_view>
25
26#include <sfx2/objsh.hxx>
27#include "swblocks.hxx"
29
30class SwDoc;
32
33enum class SwXmlFlags {
34 NONE = 0x0000,
35 NoRootCommit = 0x0002,
36};
37namespace o3tl {
38 template<> struct typed_flags<SwXmlFlags> : is_typed_flags<SwXmlFlags, 0x0002> {};
39}
40
41class SwXMLTextBlocks final : public SwImpBlocks
42{
47 css::uno::Reference < css::embed::XStorage > m_xBlkRoot;
48 css::uno::Reference < css::embed::XStorage > m_xRoot;
49
50 void ReadInfo();
51 void WriteInfo();
52 void InitBlockMode ( const css::uno::Reference < css::embed::XStorage >& rStorage );
53 void ResetBlockMode();
54
55public:
56 SwXMLTextBlocks( const OUString& rFile );
57 SwXMLTextBlocks( const css::uno::Reference < css::embed::XStorage >&, const OUString& rFile );
58 void AddName( const OUString&, const OUString&, const OUString&, bool bOnlyText );
59 virtual void AddName( const OUString&, const OUString&, bool bOnlyText = false ) override;
60 static OUString GeneratePackageName ( std::u16string_view rShort );
61 virtual ~SwXMLTextBlocks() override;
62 virtual ErrCode Delete( sal_uInt16 ) override;
63 virtual ErrCode Rename( sal_uInt16, const OUString& ) override;
64 virtual ErrCode CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong) override;
65 virtual void ClearDoc() override;
66 virtual ErrCode GetDoc( sal_uInt16 ) override;
67 virtual ErrCode BeginPutDoc( const OUString&, const OUString& ) override;
68 virtual ErrCode PutDoc() override;
69 virtual ErrCode PutText( const OUString&, const OUString&, const OUString& ) override;
70 virtual ErrCode MakeBlockList() override;
71
72 virtual ErrCode OpenFile( bool bReadOnly = true ) override;
73 virtual void CloseFile() override;
74
75 static bool IsFileUCBStorage( const OUString & rFileName);
76
77 // Methods for the new Autocorrecter
78 ErrCode GetText( std::u16string_view rShort, OUString& );
79
80 virtual bool IsOnlyTextBlock( const OUString& rShort ) const override;
81 bool IsOnlyTextBlock( sal_uInt16 nIdx ) const;
82 void SetIsTextOnly( const OUString& rShort, bool bNewValue );
83
84 virtual ErrCode GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTable ) override;
85 virtual ErrCode SetMacroTable( sal_uInt16 nIdx,
86 const SvxMacroTableDtor& rMacroTable ) override;
87 virtual bool PutMuchEntries( bool bOn ) override;
88
89 SwDoc* GetDoc() const { return m_xDoc.get(); }
90 //void SetDoc( SwDoc * pNewDoc);
91 ErrCode StartPutBlock( const OUString& rShort, const OUString& rPackageName );
93 ErrCode GetBlockText( std::u16string_view rShort, OUString& rText );
94 ErrCode PutBlockText( const OUString& rShort, std::u16string_view rText, const OUString& rPackageName );
95 void MakeBlockText( std::u16string_view rText );
96};
97
98/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwXmlFlags
Definition: doc.hxx:197
rtl::Reference< SwDoc > m_xDoc
Definition: swblocks.hxx:66
virtual ErrCode CopyBlock(SwImpBlocks &rImp, OUString &rShort, const OUString &rLong) override
void SetIsTextOnly(const OUString &rShort, bool bNewValue)
SwDoc * GetDoc() const
virtual bool PutMuchEntries(bool bOn) override
virtual ErrCode MakeBlockList() override
void InitBlockMode(const css::uno::Reference< css::embed::XStorage > &rStorage)
virtual bool IsOnlyTextBlock(const OUString &rShort) const override
SwXMLTextBlocks(const OUString &rFile)
virtual ErrCode PutText(const OUString &, const OUString &, const OUString &) override
css::uno::Reference< css::embed::XStorage > m_xBlkRoot
void MakeBlockText(std::u16string_view rText)
SwXMLTextBlocks(const css::uno::Reference< css::embed::XStorage > &, const OUString &rFile)
static OUString GeneratePackageName(std::u16string_view rShort)
SfxObjectShellRef m_xDocShellRef
virtual void ClearDoc() override
Delete the document's content.
ErrCode GetBlockText(std::u16string_view rShort, OUString &rText)
tools::SvRef< SfxMedium > m_xMedium
virtual ErrCode Rename(sal_uInt16, const OUString &) override
static bool IsFileUCBStorage(const OUString &rFileName)
virtual ErrCode GetMacroTable(sal_uInt16, SvxMacroTableDtor &rMacroTable) override
virtual ErrCode PutDoc() override
virtual ErrCode Delete(sal_uInt16) override
virtual ErrCode SetMacroTable(sal_uInt16 nIdx, const SvxMacroTableDtor &rMacroTable) override
ErrCode GetText(std::u16string_view rShort, OUString &)
ErrCode StartPutBlock(const OUString &rShort, const OUString &rPackageName)
ErrCode PutBlockText(const OUString &rShort, std::u16string_view rText, const OUString &rPackageName)
virtual void CloseFile() override
void AddName(const OUString &, const OUString &, const OUString &, bool bOnlyText)
css::uno::Reference< css::embed::XStorage > m_xRoot
virtual ~SwXMLTextBlocks() override
virtual ErrCode OpenFile(bool bReadOnly=true) override
virtual ErrCode BeginPutDoc(const OUString &, const OUString &) override
NONE