1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_SWXMLTEXTBLOCKS_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_SWXMLTEXTBLOCKS_HXX
23 #include <sfx2/objsh.hxx>
24 #include "swblocks.hxx"
25 #include <o3tl/typed_flags_set.hxx>
28 class SvxMacroTableDtor
;
30 enum class SwXmlFlags
{
32 NoRootCommit
= 0x0002,
35 template<> struct typed_flags
<SwXmlFlags
> : is_typed_flags
<SwXmlFlags
, 0x0002> {};
38 class SwXMLTextBlocks final
: public SwImpBlocks
40 SfxObjectShellRef xDocShellRef
;
42 OUString aPackageName
;
43 tools::SvRef
<SfxMedium
> xMedium
;
47 void InitBlockMode ( const css::uno::Reference
< css::embed::XStorage
>& rStorage
);
48 void ResetBlockMode();
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
& ) 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
;
68 virtual ErrCode
OpenFile( bool bReadOnly
= true ) override
;
69 virtual void CloseFile() override
;
71 static bool IsFileUCBStorage( const OUString
& rFileName
);
73 // Methods for the new Autocorrecter
74 ErrCode
GetText( const OUString
& rShort
, OUString
& );
76 virtual bool IsOnlyTextBlock( const OUString
& rShort
) const override
;
77 bool IsOnlyTextBlock( sal_uInt16 nIdx
) const;
78 void SetIsTextOnly( const OUString
& rShort
, bool bNewValue
);
80 virtual ErrCode
GetMacroTable( sal_uInt16
, SvxMacroTableDtor
& rMacroTable
) override
;
81 virtual ErrCode
SetMacroTable( sal_uInt16 nIdx
,
82 const SvxMacroTableDtor
& rMacroTable
) override
;
83 virtual bool PutMuchEntries( bool bOn
) override
;
85 SwDoc
* GetDoc() const { return m_xDoc
.get(); }
86 //void SetDoc( SwDoc * pNewDoc);
87 ErrCode
StartPutBlock( const OUString
& rShort
, const OUString
& rPackageName
);
89 ErrCode
GetBlockText( const OUString
& rShort
, OUString
& rText
);
90 ErrCode
PutBlockText( const OUString
& rShort
, const OUString
& rText
, const OUString
& rPackageName
);
91 void MakeBlockText( const OUString
& rText
);
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */