forked from balisujohn/localwriter
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathbase.py
More file actions
109 lines (77 loc) · 4.83 KB
/
Copy pathbase.py
File metadata and controls
109 lines (77 loc) · 4.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# WriterAgent - AI Writing Assistant for LibreOffice
# Copyright (c) 2024 John Balis
# Copyright (c) 2026 KeithCu (modifications and relicensing)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Base classes for specialized Draw toolsets."""
from typing import ClassVar
from plugin.framework.prompts import DELEGATION_PUBLIC_WEB_HINT, DELEGATION_USER_FILE_DATA_HINT
from plugin.framework.tool import ToolBase
class ToolDrawSpecialBase(ToolBase):
"""Base class for all specialized Draw tools.
Tools deriving from this base are NOT exposed directly to the main
agent's general toolset. Instead, they are exposed only to the
specialized sub-agent when the user delegates a task to that specific
domain.
"""
tier = "specialized"
specialized_domain: ClassVar[str | None] = None
specialized_domain_description: ClassVar[str | None] = None
required_core_tools: ClassVar[frozenset[str] | None] = None
# --- Domain-Specific Base Classes ---
class ToolDrawWebResearchBase(ToolDrawSpecialBase):
specialized_domain: ClassVar[str | None] = "web_research"
specialized_domain_description: ClassVar[str | None] = DELEGATION_PUBLIC_WEB_HINT
class ToolDrawDocumentResearchBase(ToolDrawSpecialBase):
specialized_domain: ClassVar[str | None] = "document_research"
specialized_domain_description: ClassVar[str | None] = f"{DELEGATION_USER_FILE_DATA_HINT}; one delegation for file(s), sub-agent matches descriptions"
class ToolDrawChartBase(ToolDrawSpecialBase):
specialized_domain: ClassVar[str | None] = "charts"
specialized_domain_description: ClassVar[str | None] = "Create and edit data charts within the drawing or presentation."
uno_services = ["com.sun.star.drawing.DrawingDocument", "com.sun.star.presentation.PresentationDocument"]
class ToolDrawShapeBase(ToolDrawSpecialBase):
specialized_domain: ClassVar[str | None] = "shapes"
specialized_domain_description: ClassVar[str | None] = "Create and edit drawing shapes, connectors, and groups."
uno_services = ["com.sun.star.drawing.DrawingDocument", "com.sun.star.presentation.PresentationDocument"]
class ToolDrawFormBase(ToolDrawSpecialBase):
specialized_domain: ClassVar[str | None] = "forms"
specialized_domain_description: ClassVar[str | None] = "Create and manage form templates and UI controls."
intent = "edit"
uno_services = ["com.sun.star.drawing.DrawingDocument", "com.sun.star.presentation.PresentationDocument"]
class ToolDrawHeaderFooterBase(ToolDrawSpecialBase):
specialized_domain: ClassVar[str | None] = "headers_footers"
specialized_domain_description: ClassVar[str | None] = "Manage presentation-wide headers, footers, and page numbers."
uno_services = ["com.sun.star.presentation.PresentationDocument"]
class ToolDrawSpeakerNotesBase(ToolDrawSpecialBase):
specialized_domain: ClassVar[str | None] = "speaker_notes"
specialized_domain_description: ClassVar[str | None] = "Read and edit Impress speaker notes per slide."
class ToolDrawSlideTransitionsBase(ToolDrawSpecialBase):
specialized_domain: ClassVar[str | None] = "slide_transitions"
specialized_domain_description: ClassVar[str | None] = "Slide transition effects, timing, and Impress slide layouts."
class ToolDrawSlideMastersBase(ToolDrawSpecialBase):
specialized_domain: ClassVar[str | None] = "slide_masters"
specialized_domain_description: ClassVar[str | None] = "List master slides and assign masters to slides."
class ToolDrawPythonBase(ToolDrawSpecialBase):
"""Marker for Draw/Impress delegation prompt listing (domain=python); see plugin/calc/python/venv.py."""
specialized_domain: ClassVar[str | None] = "python"
specialized_domain_description: ClassVar[str | None] = (
"Run Python in the user-configured venv (subprocess); isolated from LibreOffice."
)
class ToolDrawPptMasterBase(ToolDrawSpecialBase):
"""PPT-Master sidebar mode — not exposed via delegate_to_specialized_draw_toolset."""
specialized_domain: ClassVar[str | None] = "ppt-master"
specialized_domain_description: ClassVar[str | None] = (
"PPT-Master workflow: export SVG projects to native Impress shapes, validate, template-fill, enhance."
)
uno_services = ["com.sun.star.drawing.DrawingDocument", "com.sun.star.presentation.PresentationDocument"]