a11y: Simplify OCommonAccessibleComponent::getAccessibleIndexInParent
[LibreOffice.git] / sw / inc / unotxdoc.hxx
blob68ce93ff4875de445f8dd903319b05834f6f3a81
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_INC_UNOTXDOC_HXX
20 #define INCLUDED_SW_INC_UNOTXDOC_HXX
22 #include "swdllapi.h"
23 #include <sfx2/sfxbasemodel.hxx>
25 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
26 #include <com/sun/star/style/XAutoStylesSupplier.hpp>
27 #include <com/sun/star/document/XLinkTargetSupplier.hpp>
28 #include <com/sun/star/document/XRedlinesSupplier.hpp>
29 #include <com/sun/star/text/XNumberingRulesSupplier.hpp>
30 #include <com/sun/star/text/XFootnotesSupplier.hpp>
31 #include <com/sun/star/text/XEndnotesSupplier.hpp>
32 #include <com/sun/star/text/XContentControlsSupplier.hpp>
33 #include <com/sun/star/text/XTextSectionsSupplier.hpp>
34 #include <com/sun/star/text/XLineNumberingProperties.hpp>
35 #include <com/sun/star/text/XChapterNumberingSupplier.hpp>
36 #include <com/sun/star/text/XPagePrintable.hpp>
37 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
38 #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
39 #include <com/sun/star/text/XTextTablesSupplier.hpp>
40 #include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
41 #include <com/sun/star/text/XBookmarksSupplier.hpp>
42 #include <com/sun/star/text/XTextDocument.hpp>
43 #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
44 #include <com/sun/star/text/XReferenceMarksSupplier.hpp>
45 #include <com/sun/star/text/XTextFramesSupplier.hpp>
46 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
47 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
48 #include <com/sun/star/util/XReplaceable.hpp>
49 #include <com/sun/star/util/XRefreshable.hpp>
50 #include <com/sun/star/util/XLinkUpdate.hpp>
51 #include <com/sun/star/view/XRenderable.hpp>
52 #include <com/sun/star/lang/XServiceInfo.hpp>
53 #include <com/sun/star/beans/XPropertySet.hpp>
54 #include <com/sun/star/beans/XPropertyState.hpp>
55 #include <com/sun/star/xforms/XFormsSupplier.hpp>
56 #include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp>
57 #include <com/sun/star/document/XDocumentLanguages.hpp>
58 #include <com/sun/star/util/XCloneable.hpp>
59 #include <o3tl/deleter.hxx>
60 #include <rtl/ref.hxx>
61 #include <svx/fmdmod.hxx>
62 #include <editeng/UnoForbiddenCharsTable.hxx>
63 #include <cppuhelper/implbase.hxx>
64 #include <vcl/ITiledRenderable.hxx>
65 #include <com/sun/star/tiledrendering/XTiledRenderable.hpp>
66 #include <com/sun/star/text/XPasteBroadcaster.hpp>
68 #include "unobaseclass.hxx"
69 #include "viewopt.hxx"
71 #include <deque>
73 class SwDoc;
74 class SwDocShell;
75 class UnoActionContext;
76 class SwXBodyText;
77 class SwFmDrawPage;
78 class SwUnoCursor;
79 class SwXDocumentPropertyHelper;
80 class SfxViewFrame;
81 class SfxViewShell;
82 class SwPrintUIOptions;
83 class SwPrintData;
84 class SwRenderData;
85 class SwViewShell;
86 class SfxItemPropertySet;
87 class SwXTextTables;
88 class SwXTextFrames;
89 class SwXTextGraphicObjects;
90 class SwXTextEmbeddedObjects;
91 class SwXTextFieldTypes;
92 class SwXTextFieldMasters;
93 class SwXTextSections;
94 class SwXNumberingRulesCollection;
95 class SwXFootnote;
96 class SwXFootnotes;
97 class SwXContentControls;
98 class SwXDocumentIndexes;
99 class SwXStyleFamilies;
100 class SwXStyle;
101 class SwXAutoStyles;
102 class SwXBookmarks;
103 class SwXChapterNumbering;
104 class SwXFootnoteProperties;
105 class SwXEndnoteProperties;
106 class SwXLineNumberingProperties;
107 class SwXReferenceMarks;
108 class SwXLinkTargetSupplier;
109 class SwXRedlines;
110 class SwXDocumentSettings;
111 class SwXTextDefaults;
112 class SwXBookmark;
113 class SwXTextSection;
114 class SwXTextField;
115 class SwXLineBreak;
116 class SwXTextFrame;
117 class SwXTextGraphicObject;
118 class SwXPageStyle;
119 class SwXContentControl;
120 class SwXTextEmbeddedObject;
121 class SvXMLEmbeddedObjectHelper;
122 class SwXFieldmark;
123 class SwXSection;
124 class SwXFieldMaster;
125 class SvNumberFormatsSupplierObj;
126 namespace com::sun::star::container { class XNameContainer; }
127 namespace com::sun::star::frame { class XController; }
128 namespace com::sun::star::lang { struct Locale; }
129 namespace com::sun::star::uno { class XAggregation; }
131 namespace com::sun::star::util { class XReplaceDescriptor; }
133 typedef cppu::ImplInheritanceHelper
135 SfxBaseModel,
136 css::text::XTextDocument,
137 css::text::XLineNumberingProperties,
138 css::text::XChapterNumberingSupplier,
139 css::text::XNumberingRulesSupplier,
140 css::text::XFootnotesSupplier,
141 css::text::XEndnotesSupplier,
142 css::text::XContentControlsSupplier,
143 css::util::XReplaceable,
144 css::text::XPagePrintable,
145 css::text::XReferenceMarksSupplier,
146 css::text::XTextTablesSupplier,
147 css::text::XTextFramesSupplier,
148 css::text::XBookmarksSupplier,
149 css::text::XTextSectionsSupplier,
150 css::text::XTextGraphicObjectsSupplier,
151 css::text::XTextEmbeddedObjectsSupplier,
152 css::text::XTextFieldsSupplier,
153 css::style::XStyleFamiliesSupplier,
154 css::style::XAutoStylesSupplier,
155 css::lang::XServiceInfo,
156 css::drawing::XDrawPageSupplier,
157 css::drawing::XDrawPagesSupplier,
158 css::text::XDocumentIndexesSupplier,
159 css::beans::XPropertySet,
160 css::beans::XPropertyState,
161 css::document::XLinkTargetSupplier,
162 css::document::XRedlinesSupplier,
163 css::util::XRefreshable,
164 css::util::XLinkUpdate,
165 css::view::XRenderable,
166 css::xforms::XFormsSupplier,
167 css::text::XFlatParagraphIteratorProvider,
168 css::document::XDocumentLanguages,
169 css::util::XCloneable,
170 css::text::XPasteBroadcaster
172 SwXTextDocumentBaseClass;
174 class SW_DLLPUBLIC SwXTextDocument final : public SwXTextDocumentBaseClass,
175 public SvxFmMSFactory,
176 public vcl::ITiledRenderable,
177 public css::tiledrendering::XTiledRenderable
179 private:
180 class Impl;
181 ::sw::UnoImplPtr<Impl> m_pImpl;
183 std::deque<std::unique_ptr<UnoActionContext, o3tl::default_delete<UnoActionContext>>> maActionArr;
185 const SfxItemPropertySet* m_pPropSet;
187 SwDocShell* m_pDocShell;
189 rtl::Reference<SwFmDrawPage> m_xDrawPage;
191 rtl::Reference<SwXBodyText> m_xBodyText;
192 rtl::Reference< SvNumberFormatsSupplierObj > m_xNumFormatAgg;
194 rtl::Reference<SwXNumberingRulesCollection> mxXNumberingRules;
195 rtl::Reference<SwXFootnotes> mxXFootnotes;
196 rtl::Reference<SwXFootnoteProperties> mxXFootnoteSettings;
197 rtl::Reference<SwXFootnotes> mxXEndnotes;
198 rtl::Reference<SwXEndnoteProperties> mxXEndnoteSettings;
199 rtl::Reference<SwXContentControls> mxXContentControls;
200 rtl::Reference<SwXReferenceMarks> mxXReferenceMarks;
201 rtl::Reference<SwXTextFieldTypes> mxXTextFieldTypes;
202 rtl::Reference<SwXTextFieldMasters> mxXTextFieldMasters;
203 rtl::Reference<SwXTextSections> mxXTextSections;
204 rtl::Reference<SwXBookmarks> mxXBookmarks;
205 rtl::Reference<SwXTextTables> mxXTextTables;
206 rtl::Reference<SwXTextFrames> mxXTextFrames;
207 rtl::Reference<SwXTextGraphicObjects> mxXGraphicObjects;
208 rtl::Reference<SwXTextEmbeddedObjects> mxXEmbeddedObjects;
209 rtl::Reference<SwXStyleFamilies> mxXStyleFamilies;
210 mutable rtl::Reference<SwXAutoStyles> mxXAutoStyles;
211 rtl::Reference<SwXChapterNumbering> mxXChapterNumbering;
212 rtl::Reference<SwXDocumentIndexes> mxXDocumentIndexes;
214 rtl::Reference<SwXLineNumberingProperties> mxXLineNumberingProperties;
215 rtl::Reference<SwXLinkTargetSupplier> mxLinkTargetSupplier;
216 rtl::Reference<SwXRedlines> mxXRedlines;
218 //temporary frame to enable PDF export if no valid view is available
219 SfxViewFrame* m_pHiddenViewFrame;
220 rtl::Reference<SwXDocumentPropertyHelper> mxPropertyHelper;
222 std::unique_ptr<SwPrintUIOptions> m_pPrintUIOptions;
223 std::unique_ptr<SwRenderData> m_pRenderData;
225 void GetNumberFormatter();
227 css::uno::Reference<css::uno::XInterface> create(
228 OUString const & rServiceName,
229 css::uno::Sequence<css::uno::Any> const * arguments);
231 // used for XRenderable implementation
232 SfxViewShell * GuessViewShell( /* out */ bool &rbIsSwSrcView, const css::uno::Reference< css::frame::XController >& rController = css::uno::Reference< css::frame::XController >() );
233 SwDoc * GetRenderDoc( SfxViewShell *&rpView, const css::uno::Any& rSelection, bool bIsPDFExport );
234 SfxViewShell * GetRenderView( bool &rbIsSwSrcView, const css::uno::Sequence< css::beans::PropertyValue >& rxOptions, bool bIsPDFExport );
236 OUString maBuildId;
238 // boolean for XPagePrintable
239 // set in XPagePrintable::printPages(..) to indicate that the PagePrintSettings
240 // has to be applied in XRenderable::getRenderer(..) through which the printing
241 // is implemented.
242 bool m_bApplyPagePrintSettingsFromXPagePrintable;
244 /** abstract SdrModel provider */
245 virtual SdrModel& getSdrModelFromUnoModel() const override;
247 virtual ~SwXTextDocument() override;
249 void ThrowIfInvalid() const;
250 SwDoc& GetDocOrThrow() const;
252 public:
253 SwXTextDocument(SwDocShell* pShell);
255 void NotifyRefreshListeners();
256 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
257 virtual void SAL_CALL acquire( ) noexcept override;
258 virtual void SAL_CALL release( ) noexcept override;
260 //XWeak
261 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
263 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
265 //XUnoTunnel
266 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
268 //XTextDocument
269 virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override;
270 rtl::Reference< SwXBodyText > getBodyText();
271 virtual void SAL_CALL reformat() override;
273 using SfxBaseModel::addEventListener;
274 using SfxBaseModel::removeEventListener;
276 //XModel
277 virtual sal_Bool SAL_CALL attachResource( const OUString& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs ) override;
278 virtual OUString SAL_CALL getURL( ) override;
279 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs( ) override;
280 virtual void SAL_CALL connectController( const css::uno::Reference< css::frame::XController >& xController ) override;
281 virtual void SAL_CALL disconnectController( const css::uno::Reference< css::frame::XController >& xController ) override;
282 virtual void SAL_CALL lockControllers( ) override;
283 virtual void SAL_CALL unlockControllers( ) override;
284 virtual sal_Bool SAL_CALL hasControllersLocked( ) override;
285 virtual css::uno::Reference< css::frame::XController > SAL_CALL getCurrentController( ) override;
286 virtual void SAL_CALL setCurrentController( const css::uno::Reference< css::frame::XController >& xController ) override;
287 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getCurrentSelection( ) override;
289 //XComponent
290 virtual void SAL_CALL dispose() override;
291 virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override;
292 virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override;
294 //XCloseable
295 virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) override;
297 //XLineNumberingProperties
298 virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getLineNumberingProperties() override;
300 //XChapterNumberingSupplier
301 virtual css::uno::Reference< css::container::XIndexReplace > SAL_CALL getChapterNumberingRules() override;
303 //XNumberingRulesSupplier
304 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getNumberingRules() override;
306 //XFootnotesSupplier
307 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getFootnotes() override;
308 virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getFootnoteSettings() override;
310 //XEndnotesSupplier
311 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getEndnotes() override;
312 virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getEndnoteSettings() override;
314 // XContentControlsSupplier
315 css::uno::Reference<css::container::XIndexAccess> SAL_CALL getContentControls() override;
317 //XReplaceable
318 virtual css::uno::Reference< css::util::XReplaceDescriptor > SAL_CALL createReplaceDescriptor() override;
319 virtual sal_Int32 SAL_CALL replaceAll(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) override;
321 //XSearchable
322 virtual css::uno::Reference< css::util::XSearchDescriptor > SAL_CALL createSearchDescriptor() override;
323 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL findAll(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) override;
324 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL findFirst(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) override;
325 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL findNext(const css::uno::Reference< css::uno::XInterface > & xStartAt, const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) override;
327 //XPagePrintable
328 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPagePrintSettings() override;
329 virtual void SAL_CALL setPagePrintSettings(const css::uno::Sequence< css::beans::PropertyValue >& aSettings) override;
330 virtual void SAL_CALL printPages(const css::uno::Sequence< css::beans::PropertyValue >& xOptions) override;
332 //XReferenceMarksSupplier
333 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getReferenceMarks() override;
335 // css::text::XTextFieldsSupplier
336 virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTextFields() override;
337 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextFieldMasters() override;
339 // css::text::XTextEmbeddedObjectsSupplier
340 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getEmbeddedObjects() override;
342 // css::text::XBookmarksSupplier
343 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getBookmarks() override;
345 // css::text::XTextSectionsSupplier
346 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextSections() override;
348 // css::text::XTextTablesSupplier
349 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextTables() override;
351 // css::text::XTextGraphicObjectsSupplier
352 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGraphicObjects() override;
354 // css::text::XTextFramesSupplier
355 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextFrames() override;
357 //XStyleFamiliesSupplier
358 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getStyleFamilies() override;
360 //XAutoStylesSupplier
361 virtual css::uno::Reference< css::style::XAutoStyles > SAL_CALL getAutoStyles( ) override;
363 //XMultiServiceFactory
364 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const OUString& ServiceSpecifier) override;
365 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const OUString& ServiceSpecifier,
366 const css::uno::Sequence< css::uno::Any >& Arguments) override;
367 virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override;
369 //XServiceInfo
370 virtual OUString SAL_CALL getImplementationName() override;
371 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
372 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
374 // css::drawing::XDrawPageSupplier
375 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage() override;
377 // css::drawing::XDrawPagesSupplier
378 virtual css::uno::Reference< css::drawing::XDrawPages > SAL_CALL getDrawPages() override;
380 // css::text::XDocumentIndexesSupplier
381 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getDocumentIndexes() override;
383 //XPropertySet
384 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
385 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
386 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
387 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
388 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
389 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
390 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
392 //XPropertyState
393 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& rPropertyName ) override;
394 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& rPropertyNames ) override;
395 virtual void SAL_CALL setPropertyToDefault( const OUString& rPropertyName ) override;
396 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& rPropertyName ) override;
398 //XLinkTargetSupplier
399 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override;
401 //XRedlinesSupplier
402 virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getRedlines( ) override;
404 // css::util::XRefreshable
405 virtual void SAL_CALL refresh() override;
406 virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > & l) override;
407 virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > & l) override;
409 // css::util::XLinkUpdate,
410 virtual void SAL_CALL updateLinks( ) override;
412 // css::view::XRenderable
413 virtual sal_Int32 SAL_CALL getRendererCount( const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) override;
414 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRenderer( sal_Int32 nRenderer, const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) override;
415 virtual void SAL_CALL render( sal_Int32 nRenderer, const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) override;
417 // css::xforms::XFormsSupplier
418 virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getXForms( ) override;
420 // css::document::XDocumentLanguages
421 virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getDocumentLanguages( ::sal_Int16 nScriptTypes, ::sal_Int16 nCount ) override;
423 // css::text::XFlatParagraphIteratorProvider:
424 virtual css::uno::Reference< css::text::XFlatParagraphIterator > SAL_CALL getFlatParagraphIterator(::sal_Int32 nTextMarkupType, sal_Bool bAutomatic ) override;
426 // css::util::XCloneable
427 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
429 // css::text::XPasteBroadcaster
430 void SAL_CALL addPasteEventListener(
431 const ::css::uno::Reference<::css::text::XPasteListener>& xListener) override;
432 void SAL_CALL removePasteEventListener(
433 const ::css::uno::Reference<::css::text::XPasteListener>& xListener) override;
435 /// @see vcl::ITiledRenderable::paintTile().
436 virtual void paintTile( VirtualDevice &rDevice,
437 int nOutputWidth,
438 int nOutputHeight,
439 int nTilePosX,
440 int nTilePosY,
441 tools::Long nTileWidth,
442 tools::Long nTileHeight ) override;
443 /// @see vcl::ITiledRenderable::getDocumentSize().
444 virtual Size getDocumentSize() override;
445 /// @see vcl::ITiledRenderable::setPart().
446 virtual void setPart(int nPart, bool bAllowChangeFocus = true) override;
447 /// @see vcl::ITiledRenderable::getParts().
448 virtual int getParts() override;
449 /// @see vcl::ITiledRenderable::getPart().
450 virtual int getPart() override;
451 /// @see vcl::ITiledRenderable::getPartName().
452 virtual OUString getPartName(int nPart) override;
453 /// @see vcl::ITiledRenderable::getPartHash().
454 virtual OUString getPartHash(int nPart) override;
455 /// @see vcl::ITiledRenderable::getDocWindow().
456 virtual VclPtr<vcl::Window> getDocWindow() override;
457 /// @see vcl::ITiledRenderable::initializeForTiledRendering().
458 virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) override;
459 /// @see vcl::ITiledRenderable::postKeyEvent().
460 virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) override;
461 /// @see vcl::ITiledRenderable::postMouseEvent().
462 virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) override;
463 /// @see vcl::ITiledRenderable::setTextSelection().
464 virtual void setTextSelection(int nType, int nX, int nY) override;
465 /// @see vcl::ITiledRenderable::getSelection().
466 virtual css::uno::Reference<css::datatransfer::XTransferable> getSelection() override;
467 /// @see vcl::ITiledRenderable::setGraphicSelection().
468 virtual void setGraphicSelection(int nType, int nX, int nY) override;
469 /// @see vcl::ITiledRenderable::resetSelection().
470 virtual void resetSelection() override;
471 /// @see vcl::ITiledRenderable::getPartPageRectangles().
472 virtual OUString getPartPageRectangles() override;
473 /// @see vcl::ITiledRenderable::setClipboard().
474 virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) override;
475 /// @see vcl::ITiledRenderable::isMimeTypeSupported().
476 virtual bool isMimeTypeSupported() override;
477 /// @see vcl::ITiledRenderable::setClientVisibleArea().
478 virtual void setClientVisibleArea(const tools::Rectangle& rRectangle) override;
479 /// @see vcl::ITiledRenderable::setClientZoom.
480 virtual void setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int nTileTwipWidth_, int nTileTwipHeight_) override;
481 /// @see vcl::ITiledRenderable::getPointer().
482 virtual PointerStyle getPointer() override;
483 /// @see vcl::ITiledRenderable::getTrackedChanges().
484 void getTrackedChanges(tools::JsonWriter&) override;
485 /// @see vcl::ITiledRenderable::getTrackedChangeAuthors().
486 void getTrackedChangeAuthors(tools::JsonWriter& rJsonWriter) override;
488 void getRulerState(tools::JsonWriter& rJsonWriter) override;
489 /// @see vcl::ITiledRenderable::getPostIts().
490 void getPostIts(tools::JsonWriter& rJsonWriter) override;
492 /// @see vcl::ITiledRenderable::executeFromFieldEvent().
493 virtual void executeFromFieldEvent(const StringMap& aArguments) override;
495 /// @see vcl::ITiledRenderable::getSearchResultRectangles().
496 std::vector<basegfx::B2DRange> getSearchResultRectangles(const char* pPayload) override;
498 // css::tiledrendering::XTiledRenderable
499 virtual void SAL_CALL paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) override;
501 /// @see vcl::ITiledRenderable::executeContentControlEvent().
502 void executeContentControlEvent(const StringMap& aArguments) override;
504 /// @see vcl::ITiledRenderable::getCommandValues().
505 void getCommandValues(tools::JsonWriter& rJsonWriter, std::string_view rCommand) override;
507 /// @see vcl::ITiledRenderable::getViewRenderState().
508 OString getViewRenderState(SfxViewShell* pViewShell = nullptr) override;
510 /// @see vcl::ITiledRenderable::supportsCommand().
511 bool supportsCommand(std::u16string_view rCommand) override;
513 void Invalidate();
514 void Reactivate(SwDocShell* pNewDocShell);
515 SwXDocumentPropertyHelper * GetPropertyHelper ();
517 void InitNewDoc();
519 SwUnoCursor* CreateCursorForSearch(css::uno::Reference< css::text::XTextCursor > & xCursor);
520 SwUnoCursor* FindAny(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc,
521 css::uno::Reference< css::text::XTextCursor > & xCursor, bool bAll,
522 sal_Int32& nResult,
523 css::uno::Reference< css::uno::XInterface > const & xLastResult);
525 SwDocShell* GetDocShell() {return m_pDocShell;}
527 rtl::Reference<SwXTextTables> getSwTextTables();
528 rtl::Reference<SwFmDrawPage> getSwDrawPage();
529 rtl::Reference<SwXFootnotes> getSwXFootnotes();
530 rtl::Reference<SwXFootnotes> getSwXEndnotes();
531 rtl::Reference<SwXTextFieldMasters> getSwXTextFieldMasters();
532 rtl::Reference<SwXFieldMaster> createFieldMaster(std::u16string_view sServiceName);
533 rtl::Reference<SwXTextField> createTextField(std::u16string_view sServiceName);
534 rtl::Reference<SwXFieldmark> createFieldmark(std::u16string_view sServiceName);
535 /// returns either SwXDocumentIndex or SwXTextSection
536 rtl::Reference<SwXSection> createSection(std::u16string_view rObjectType);
537 rtl::Reference<SwXDocumentSettings> createDocumentSettings();
538 rtl::Reference<SwXTextDefaults> createTextDefaults();
539 rtl::Reference<SwXBookmark> createBookmark();
540 rtl::Reference<SwXFieldmark> createFieldmark();
541 rtl::Reference<SwXTextSection> createTextSection();
542 rtl::Reference<SwXTextField> createFieldAnnotation();
543 rtl::Reference<SwXLineBreak> createLineBreak();
544 rtl::Reference<SwXTextFrame> createTextFrame();
545 rtl::Reference<SwXTextGraphicObject> createTextGraphicObject();
546 rtl::Reference<SwXStyle> createNumberingStyle();
547 rtl::Reference<SwXStyle> createCharacterStyle();
548 rtl::Reference<SwXStyle> createParagraphStyle();
549 rtl::Reference<SwXPageStyle> createPageStyle();
550 rtl::Reference<SwXContentControl> createContentControl();
551 rtl::Reference<SwXFootnote> createFootnote();
552 rtl::Reference<SwXFootnote> createEndnote();
553 rtl::Reference<SwXTextEmbeddedObject> createTextEmbeddedObject();
554 rtl::Reference<SvXMLEmbeddedObjectHelper> createEmbeddedObjectResolver();
555 rtl::Reference< SwXStyleFamilies > getSwStyleFamilies();
558 class SwXLinkTargetSupplier final : public cppu::WeakImplHelper
560 css::container::XNameAccess,
561 css::lang::XServiceInfo
564 SwXTextDocument* m_pxDoc;
565 OUString m_sTables;
566 OUString m_sFrames;
567 OUString m_sGraphics;
568 OUString m_sOLEs;
569 OUString m_sSections;
570 OUString m_sOutlines;
571 OUString m_sBookmarks;
572 OUString m_sDrawingObjects;
574 public:
575 SwXLinkTargetSupplier(SwXTextDocument& rxDoc);
576 virtual ~SwXLinkTargetSupplier() override;
578 //XNameAccess
579 virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override;
580 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
581 virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override;
583 //XElementAccess
584 virtual css::uno::Type SAL_CALL getElementType( ) override;
585 virtual sal_Bool SAL_CALL hasElements( ) override;
587 //XServiceInfo
588 virtual OUString SAL_CALL getImplementationName() override;
589 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
590 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
592 void Invalidate() {m_pxDoc = nullptr;}
595 class SwXLinkNameAccessWrapper final : public cppu::WeakImplHelper
597 css::beans::XPropertySet,
598 css::container::XNameAccess,
599 css::lang::XServiceInfo,
600 css::document::XLinkTargetSupplier
603 css::uno::Reference< css::container::XNameAccess > m_xRealAccess;
604 const SfxItemPropertySet* m_pPropSet;
605 const OUString m_sLinkSuffix;
606 const OUString m_sLinkDisplayName;
607 SwXTextDocument* m_pxDoc;
609 public:
610 SwXLinkNameAccessWrapper(css::uno::Reference< css::container::XNameAccess > const & xAccess,
611 OUString aLinkDisplayName, OUString sSuffix);
612 SwXLinkNameAccessWrapper(SwXTextDocument& rxDoc,
613 OUString aLinkDisplayName, OUString sSuffix);
614 virtual ~SwXLinkNameAccessWrapper() override;
616 //XNameAccess
617 virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override;
618 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
619 virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override;
621 //XElementAccess
622 virtual css::uno::Type SAL_CALL getElementType( ) override;
623 virtual sal_Bool SAL_CALL hasElements( ) override;
625 //XPropertySet
626 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
627 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
628 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
629 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
630 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
631 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
632 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
634 //XLinkTargetSupplier
635 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override;
637 //XServiceInfo
638 virtual OUString SAL_CALL getImplementationName() override;
639 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
640 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
644 class SwXOutlineTarget final : public cppu::WeakImplHelper
646 css::beans::XPropertySet,
647 css::lang::XServiceInfo
650 const SfxItemPropertySet* m_pPropSet;
651 OUString m_sOutlineText;
652 OUString m_sActualText;
653 const sal_Int32 m_nOutlineLevel;
655 public:
656 SwXOutlineTarget(OUString aOutlineText, OUString aActualText,
657 const sal_Int32 nOutlineLevel);
658 virtual ~SwXOutlineTarget() override;
660 //XPropertySet
661 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
662 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
663 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
664 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
665 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
666 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
667 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
669 //XServiceInfo
670 virtual OUString SAL_CALL getImplementationName() override;
671 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
672 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
675 class SwXDrawingObjectTarget final : public cppu::WeakImplHelper
677 css::beans::XPropertySet,
678 css::lang::XServiceInfo
681 const SfxItemPropertySet* m_pPropSet;
682 OUString m_sDrawingObjectText;
684 public:
685 SwXDrawingObjectTarget(OUString aDrawingObjectText);
686 virtual ~SwXDrawingObjectTarget() override;
688 //XPropertySet
689 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
690 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
691 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
692 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
693 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
694 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
695 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
697 //XServiceInfo
698 virtual OUString SAL_CALL getImplementationName() override;
699 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
700 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
704 enum class SwCreateDrawTable {
705 Dash = 1, Gradient, Hatch, Bitmap, TransGradient, Marker, Defaults
708 class SwXDocumentPropertyHelper final : public SvxUnoForbiddenCharsTable
710 css::uno::Reference < css::uno::XInterface > m_xDashTable;
711 css::uno::Reference < css::uno::XInterface > m_xGradientTable;
712 css::uno::Reference < css::uno::XInterface > m_xHatchTable;
713 css::uno::Reference < css::uno::XInterface > m_xBitmapTable;
714 css::uno::Reference < css::uno::XInterface > m_xTransGradientTable;
715 css::uno::Reference < css::uno::XInterface > m_xMarkerTable;
716 css::uno::Reference < css::uno::XInterface > m_xDrawDefaults;
718 SwDoc* m_pDoc;
719 public:
720 SwXDocumentPropertyHelper(SwDoc& rDoc);
721 virtual ~SwXDocumentPropertyHelper() override;
722 css::uno::Reference<css::uno::XInterface> GetDrawTable(SwCreateDrawTable nWhich);
723 void Invalidate();
725 virtual void onChange() override;
728 // The class SwViewOptionAdjust_Impl is used to adjust the SwViewOption of
729 // the current SwViewShell so that fields are not printed as commands and
730 // hidden characters are always invisible. Hidden text and place holders
731 // should be printed according to the current print options.
732 // After printing the view options are restored
733 class SwViewOptionAdjust_Impl
735 SwViewShell * m_pShell;
736 SwViewOption m_aOldViewOptions;
737 public:
738 SwViewOptionAdjust_Impl( SwViewShell& rSh, const SwViewOption &rViewOptions );
739 ~SwViewOptionAdjust_Impl();
740 void AdjustViewOptions( SwPrintData const* const pPrtOptions, bool setShowPlaceHoldersInPDF );
741 bool checkShell( const SwViewShell& rCompare ) const
742 { return &rCompare == m_pShell; }
743 void DontTouchThatViewShellItSmellsFunny() { m_pShell = nullptr; }
746 #endif
748 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */