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 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_GLOSHDL_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_GLOSHDL_HXX
23 #include <rtl/ustring.hxx>
24 #include <vcl/weld.hxx>
34 class SW_DLLPUBLIC SwGlossaryHdl
37 SwGlossaries
& m_rStatGlossaries
;
39 SfxViewFrame
& m_rViewFrame
;
40 SwWrtShell
* m_pWrtShell
;
41 std::unique_ptr
<SwTextBlocks
>
44 SAL_DLLPRIVATE
bool Expand(weld::Window
* pParent
, const OUString
& rShortName
,
45 SwGlossaries
* pGlossaries
,
46 std::unique_ptr
<SwTextBlocks
> pGlossary
);
51 size_t GetGroupCnt() const;
52 OUString
GetGroupName( size_t, OUString
* pTitle
);
53 void NewGroup(OUString
& rGroupName
, const OUString
& rTitle
);
54 bool DelGroup(const OUString
&);
55 void RenameGroup(const OUString
& rOld
, OUString
& rNew
, const OUString
& rNewTitle
);
56 void SetCurGroup(const OUString
&aGrp
, bool bApi
= false, bool bAlwaysCreateNew
= false);
58 sal_uInt16
GetGlossaryCnt() const;
59 OUString
GetGlossaryName(sal_uInt16
);
60 OUString
GetGlossaryShortName(std::u16string_view aName
);
61 OUString
GetGlossaryShortName(sal_uInt16
);
63 bool Rename( const OUString
& rOldShortName
, const OUString
& rNewShortName
,
64 const OUString
& rNewName
);
65 bool CopyOrMove( const OUString
& rSourceGroupName
, OUString
& rSourceShortName
,
66 const OUString
& rDestGroupName
, const OUString
& rLongName
, bool bMove
);
67 bool HasShortName(const OUString
&rShortName
) const;
68 // when NewGlossary is called from Basic then the previously set group should
69 // be newly created if applicable.
70 bool NewGlossary(const OUString
&rName
, const OUString
&rShortName
,
71 bool bApiCall
= false, bool bNoAttr
= false );
72 bool DelGlossary(const OUString
&);
73 bool CopyToClipboard(SwWrtShell
& rSh
, const OUString
& rShortName
);
75 bool ExpandGlossary(weld::Window
* pParent
);
76 bool InsertGlossary(const OUString
&rName
);
78 void SetMacros(const OUString
& rName
,
79 const SvxMacro
* pStart
,
81 SwTextBlocks
*pGlossary
= nullptr );
82 void GetMacros(const OUString
& rShortName
,
85 SwTextBlocks
* pGlossary
= nullptr );
87 bool IsReadOnly( const OUString
* = nullptr ) const;
90 bool FindGroupName(OUString
& rGroup
); // find group without path index
92 bool ImportGlossaries( const OUString
& rName
);
94 SwGlossaryHdl(SfxViewFrame
& rViewFrame
, SwWrtShell
*);
98 #endif // INCLUDED_SW_SOURCE_UIBASE_INC_GLOSHDL_HXX
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */