1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoflatpara.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _UNOFLATPARA_HXX
32 #define _UNOFLATPARA_HXX
34 #include <cppuhelper/implbase1.hxx>
35 #include <com/sun/star/text/XFlatParagraph.hpp>
36 #include <com/sun/star/text/XFlatParagraphIterator.hpp>
38 #include <modeltoviewhelper.hxx>
39 #include <unotextmarkup.hxx>
43 namespace css
= com::sun::star
;
45 namespace com
{ namespace sun
{ namespace star
{ namespace container
{
52 /******************************************************************************
54 ******************************************************************************/
56 class SwXFlatParagraph
:
57 public ::cppu::WeakImplHelper1
59 css::text::XFlatParagraph
64 SwXFlatParagraph( SwTxtNode
& rTxtNode
, rtl::OUString aExpandText
, const ModelToViewHelper::ConversionMap
* pConversionMap
);
65 virtual ~SwXFlatParagraph();
67 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& aType
) throw(::com::sun::star::uno::RuntimeException
);
68 virtual void SAL_CALL
acquire( ) throw();
69 virtual void SAL_CALL
release( ) throw();
71 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
);
72 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId( ) throw(::com::sun::star::uno::RuntimeException
);
75 virtual css::uno::Reference
< css::container::XStringKeyMap
> SAL_CALL
getMarkupInfoContainer() throw (css::uno::RuntimeException
);
76 virtual void SAL_CALL
commitTextMarkup(::sal_Int32 nType
, const ::rtl::OUString
& aIdentifier
, ::sal_Int32 nStart
, ::sal_Int32 nLength
, const css::uno::Reference
< css::container::XStringKeyMap
> & xMarkupInfoContainer
) throw (css::uno::RuntimeException
);
78 // text::XFlatParagraph:
79 virtual ::rtl::OUString SAL_CALL
getText() throw (css::uno::RuntimeException
);
80 virtual ::sal_Bool SAL_CALL
isModified() throw (css::uno::RuntimeException
);
81 virtual void SAL_CALL
setChecked(::sal_Int32 nType
, ::sal_Bool bVal
) throw (css::uno::RuntimeException
);
82 virtual ::sal_Bool SAL_CALL
isChecked(::sal_Int32 nType
) throw (css::uno::RuntimeException
);
83 virtual css::lang::Locale SAL_CALL
getLanguageOfText(::sal_Int32 nPos
, ::sal_Int32 nLen
) throw (css::uno::RuntimeException
, css::lang::IllegalArgumentException
);
84 virtual css::lang::Locale SAL_CALL
getPrimaryLanguageOfText(::sal_Int32 nPos
, ::sal_Int32 nLen
) throw (css::uno::RuntimeException
, css::lang::IllegalArgumentException
);
85 virtual void SAL_CALL
changeText(::sal_Int32 nPos
, ::sal_Int32 nLen
, const ::rtl::OUString
& aNewText
, const css::uno::Sequence
< css::beans::PropertyValue
> & aAttributes
) throw (css::uno::RuntimeException
, css::lang::IllegalArgumentException
);
86 virtual void SAL_CALL
changeAttributes(::sal_Int32 nPos
, ::sal_Int32 nLen
, const css::uno::Sequence
< css::beans::PropertyValue
> & aAttributes
) throw (css::uno::RuntimeException
, css::lang::IllegalArgumentException
);
87 virtual css::uno::Sequence
< ::sal_Int32
> SAL_CALL
getLanguagePortions() throw (css::uno::RuntimeException
);
89 const SwTxtNode
* getTxtNode() const;
92 SwXFlatParagraph( const SwXFlatParagraph
& ); // not defined
93 SwXFlatParagraph
& operator = ( const SwXFlatParagraph
& ); // not defined
95 rtl::OUString maExpandText
;
98 /******************************************************************************
99 * SwXFlatParagraphIterator
100 ******************************************************************************/
102 class SwXFlatParagraphIterator
:
103 public ::cppu::WeakImplHelper1
105 css::text::XFlatParagraphIterator
107 public SwClient
// to get notified when doc is closed...
110 SwXFlatParagraphIterator( SwDoc
& rDoc
, sal_Int32 nType
, sal_Bool bAutomatic
);
111 virtual ~SwXFlatParagraphIterator();
113 // text::XFlatParagraphIterator:
114 virtual css::uno::Reference
< css::text::XFlatParagraph
> SAL_CALL
getFirstPara() throw (css::uno::RuntimeException
);
115 virtual css::uno::Reference
< css::text::XFlatParagraph
> SAL_CALL
getNextPara() throw (css::uno::RuntimeException
);
116 virtual css::uno::Reference
< css::text::XFlatParagraph
> SAL_CALL
getLastPara() throw (css::uno::RuntimeException
);
117 virtual css::uno::Reference
< css::text::XFlatParagraph
> SAL_CALL
getParaBefore(const css::uno::Reference
< css::text::XFlatParagraph
> & xPara
) throw (css::uno::RuntimeException
, css::lang::IllegalArgumentException
);
118 virtual css::uno::Reference
< css::text::XFlatParagraph
> SAL_CALL
getParaAfter(const css::uno::Reference
< css::text::XFlatParagraph
> & xPara
) throw (css::uno::RuntimeException
, css::lang::IllegalArgumentException
);
121 virtual void Modify( SfxPoolItem
*pOld
, SfxPoolItem
*pNew
);
124 SwXFlatParagraphIterator( const SwXFlatParagraphIterator
& ); // not defined
125 SwXFlatParagraphIterator
& operator =(const SwXFlatParagraphIterator
& ); // not defined
127 // container to hold the 'hard' references as long as necessary and valid
128 std::set
< css::uno::Reference
< css::text::XFlatParagraph
> > m_aFlatParaList
;
131 const sal_Int32 mnType
;
132 const sal_Bool mbAutomatic
;
134 ULONG mnCurrentNode
; // used for non-automatic mode
135 ULONG mnStartNode
; // used for non-automatic mode
136 ULONG mnEndNode
; // used for non-automatic mode
137 sal_Bool mbWrapped
; // used for non-automatic mode