Avoid potential negative array index access to cached text.
[LibreOffice.git] / xmloff / source / text / XMLTextFrameContext.hxx
blob4f7e01118b2c8ef6a85adf0cd2bc9a225512e0e2
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 .
20 #pragma once
22 #include <memory>
24 #include <com/sun/star/text/TextContentAnchorType.hpp>
25 #include <xmloff/xmlictxt.hxx>
26 #include <xmlmultiimagehelper.hxx>
28 namespace com::sun::star {
29 namespace text { class XTextCursor; class XTextContent; }
32 class XMLTextFrameContextHyperlink_Impl;
34 class XMLTextFrameContext : public SvXMLImportContext, public MultiImageImportHelper
36 rtl::Reference< sax_fastparser::FastAttributeList > m_xAttrList;
38 SvXMLImportContextRef m_xImplContext;
39 SvXMLImportContextRef m_xReplImplContext;
41 std::unique_ptr<XMLTextFrameContextHyperlink_Impl> m_pHyperlink;
42 // Implement Title/Description Elements UI (#i73249#)
43 OUString m_sTitle;
44 OUString m_sDesc;
46 css::text::TextContentAnchorType m_eDefaultAnchorType;
48 /* The <draw:name> can longer be used to distinguish Writer graphic/text box
49 objects and Draw graphic/text box objects.
50 The new distinguish attribute is the parent style of the automatic style
51 of the object. All Draw objects have an automatic style without a parent style.
52 (#i51726#)
54 bool m_HasAutomaticStyleWithoutParentStyle;
55 bool m_bSupportsReplacement;
57 bool CreateIfNotThere( css::uno::Reference < css::beans::XPropertySet >& rPropSet );
59 protected:
60 /// helper to get the created xShape instance, needs to be overridden
61 void removeGraphicFromImportContext(const SvXMLImportContext& rContext) override;
62 OUString getGraphicPackageURLFromImportContext(const SvXMLImportContext& rContext) const override;
63 OUString getMimeTypeFromImportContext(const SvXMLImportContext& rContext) const override;
64 css::uno::Reference<css::graphic::XGraphic> getGraphicFromImportContext(const SvXMLImportContext& rContext) const override;
66 public:
69 XMLTextFrameContext( SvXMLImport& rImport,
70 const css::uno::Reference<
71 css::xml::sax::XFastAttributeList > & xAttrList,
72 css::text::TextContentAnchorType eDfltAnchorType );
74 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
76 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
77 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
79 void SetHyperlink( const OUString& rHRef,
80 const OUString& rName,
81 const OUString& rTargetFrameName,
82 bool bMap );
84 css::text::TextContentAnchorType GetAnchorType() const;
86 css::uno::Reference < css::text::XTextContent > GetTextContent() const;
88 // Frame "to character": anchor moves from first to last char after saving (#i33242#)
89 css::uno::Reference < css::drawing::XShape > GetShape() const;
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */