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 #ifndef INCLUDED_SW_SOURCE_CORE_INC_SWXMLTEXTBLOCKS_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_SWXMLTEXTBLOCKS_HXX
22 
23 #include <sfx2/objsh.hxx>
24 #include "swblocks.hxx"
25 #include <o3tl/typed_flags_set.hxx>
26 
27 class SwDoc;
28 class SvxMacroTableDtor;
29 
30 enum class SwXmlFlags {
31  NONE = 0x0000,
32  NoRootCommit = 0x0002,
33 };
34 namespace o3tl {
35  template<> struct typed_flags<SwXmlFlags> : is_typed_flags<SwXmlFlags, 0x0002> {};
36 }
37 
38 class SwXMLTextBlocks final : public SwImpBlocks
39 {
42  OUString aPackageName;
44 
45  void ReadInfo();
46  void WriteInfo();
47  void InitBlockMode ( const css::uno::Reference < css::embed::XStorage >& rStorage );
48  void ResetBlockMode();
49 
50 public:
51  css::uno::Reference < css::embed::XStorage > xBlkRoot;
52  css::uno::Reference < css::embed::XStorage > xRoot;
53  SwXMLTextBlocks( const OUString& rFile );
54  SwXMLTextBlocks( const css::uno::Reference < css::embed::XStorage >&, const OUString& rFile );
55  void AddName( const OUString&, const OUString&, const OUString&, bool bOnlyText );
56  virtual void AddName( const OUString&, const OUString&, bool bOnlyText = false ) override;
57  static OUString GeneratePackageName ( const OUString& rShort );
58  virtual ~SwXMLTextBlocks() override;
59  virtual ErrCode Delete( sal_uInt16 ) override;
60  virtual ErrCode Rename( sal_uInt16, const OUString&, const OUString& ) override;
61  virtual void ClearDoc() override;
62  virtual ErrCode GetDoc( sal_uInt16 ) override;
63  virtual ErrCode BeginPutDoc( const OUString&, const OUString& ) override;
64  virtual ErrCode PutDoc() override;
65  virtual ErrCode PutText( const OUString&, const OUString&, const OUString& ) override;
66  virtual ErrCode MakeBlockList() override;
67 
68  virtual FileType GetFileType() const override;
69  virtual ErrCode OpenFile( bool bReadOnly = true ) override;
70  virtual void CloseFile() override;
71 
72  static bool IsFileUCBStorage( const OUString & rFileName);
73 
74  // Methods for the new Autocorrecter
75  ErrCode GetText( const OUString& rShort, OUString& );
76 
77  virtual bool IsOnlyTextBlock( const OUString& rShort ) const override;
78  bool IsOnlyTextBlock( sal_uInt16 nIdx ) const;
79  void SetIsTextOnly( const OUString& rShort, bool bNewValue );
80 
81  virtual ErrCode GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTable ) override;
82  virtual ErrCode SetMacroTable( sal_uInt16 nIdx,
83  const SvxMacroTableDtor& rMacroTable ) override;
84  virtual bool PutMuchEntries( bool bOn ) override;
85 
86  SwDoc* GetDoc() const { return m_xDoc.get(); }
87  //void SetDoc( SwDoc * pNewDoc);
88  ErrCode StartPutBlock( const OUString& rShort, const OUString& rPackageName );
89  ErrCode PutBlock();
90  ErrCode GetBlockText( const OUString& rShort, OUString& rText );
91  ErrCode PutBlockText( const OUString& rShort, const OUString& rText, const OUString& rPackageName );
92  void MakeBlockText( const OUString& rText );
93 };
94 
95 #endif
96 
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void InitBlockMode(const css::uno::Reference< css::embed::XStorage > &rStorage)
rtl::Reference< SwDoc > m_xDoc
Definition: swblocks.hxx:66
virtual ErrCode SetMacroTable(sal_uInt16 nIdx, const SvxMacroTableDtor &rMacroTable) override
virtual ~SwXMLTextBlocks() override
Definition: doc.hxx:185
ErrCode PutBlockText(const OUString &rShort, const OUString &rText, const OUString &rPackageName)
virtual bool IsOnlyTextBlock(const OUString &rShort) const override
virtual ErrCode Delete(sal_uInt16) override
virtual ErrCode OpenFile(bool bReadOnly=true) override
virtual void CloseFile() override
virtual void ClearDoc() override
Delete the document's content.
SfxObjectShellRef xDocShellRef
virtual ErrCode PutText(const OUString &, const OUString &, const OUString &) override
SwXmlFlags
void SetIsTextOnly(const OUString &rShort, bool bNewValue)
virtual ErrCode MakeBlockList() override
css::uno::Reference< css::embed::XStorage > xBlkRoot
virtual bool PutMuchEntries(bool bOn) override
virtual ErrCode PutDoc() override
SwDoc * GetDoc() const
SwXMLTextBlocks(const OUString &rFile)
virtual FileType GetFileType() const override
virtual ErrCode GetMacroTable(sal_uInt16, SvxMacroTableDtor &rMacroTable) override
virtual ErrCode Rename(sal_uInt16, const OUString &, const OUString &) override
void AddName(const OUString &, const OUString &, const OUString &, bool bOnlyText)
ErrCode StartPutBlock(const OUString &rShort, const OUString &rPackageName)
void MakeBlockText(const OUString &rText)
css::uno::Reference< css::embed::XStorage > xRoot
virtual ErrCode BeginPutDoc(const OUString &, const OUString &) override
ErrCode GetBlockText(const OUString &rShort, OUString &rText)
static OUString GeneratePackageName(const OUString &rShort)
tools::SvRef< SfxMedium > xMedium
ErrCode GetText(const OUString &rShort, OUString &)
static bool IsFileUCBStorage(const OUString &rFileName)