xref: /AOO41X/main/sw/inc/unoflatpara.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _UNOFLATPARA_HXX
29*cdf0e10cSrcweir #define _UNOFLATPARA_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
32*cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/text/XFlatParagraph.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/text/XFlatParagraphIterator.hpp>
35*cdf0e10cSrcweir #include <calbck.hxx>
36*cdf0e10cSrcweir #include <modeltoviewhelper.hxx>
37*cdf0e10cSrcweir #include <unotextmarkup.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <set>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir namespace css = com::sun::star;
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace container {
44*cdf0e10cSrcweir     class XStringKeyMap;
45*cdf0e10cSrcweir } } } }
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir class SwTxtNode;
48*cdf0e10cSrcweir class SwDoc;
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir /******************************************************************************
51*cdf0e10cSrcweir  * SwXFlatParagraph
52*cdf0e10cSrcweir  ******************************************************************************/
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir class SwXFlatParagraph:
55*cdf0e10cSrcweir     public ::cppu::WeakImplHelper2
56*cdf0e10cSrcweir     <
57*cdf0e10cSrcweir         css::text::XFlatParagraph,
58*cdf0e10cSrcweir         css::lang::XUnoTunnel
59*cdf0e10cSrcweir     >,
60*cdf0e10cSrcweir     public SwXTextMarkup
61*cdf0e10cSrcweir {
62*cdf0e10cSrcweir public:
63*cdf0e10cSrcweir     SwXFlatParagraph( SwTxtNode& rTxtNode, rtl::OUString aExpandText, const ModelToViewHelper::ConversionMap* pConversionMap );
64*cdf0e10cSrcweir     virtual ~SwXFlatParagraph();
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir     virtual 	::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
67*cdf0e10cSrcweir     virtual void SAL_CALL acquire(  ) throw();
68*cdf0e10cSrcweir     virtual void SAL_CALL release(  ) throw();
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
71*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir     // text::XTextMarkup:
74*cdf0e10cSrcweir     virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() throw (css::uno::RuntimeException);
75*cdf0e10cSrcweir     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);
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir     // text::XFlatParagraph:
78*cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
79*cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL isModified() throw (css::uno::RuntimeException);
80*cdf0e10cSrcweir     virtual void SAL_CALL setChecked(::sal_Int32 nType, ::sal_Bool bVal) throw (css::uno::RuntimeException);
81*cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL isChecked(::sal_Int32 nType) throw (css::uno::RuntimeException);
82*cdf0e10cSrcweir     virtual css::lang::Locale SAL_CALL getLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
83*cdf0e10cSrcweir     virtual css::lang::Locale SAL_CALL getPrimaryLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
84*cdf0e10cSrcweir     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);
85*cdf0e10cSrcweir     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);
86*cdf0e10cSrcweir     virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getLanguagePortions() throw (css::uno::RuntimeException);
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir     const SwTxtNode* getTxtNode() const;
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir     static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir     // XUnoTunnel
93*cdf0e10cSrcweir     virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& rId)
94*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir private:
97*cdf0e10cSrcweir     SwXFlatParagraph( const SwXFlatParagraph & ); // not defined
98*cdf0e10cSrcweir     SwXFlatParagraph & operator = ( const SwXFlatParagraph & ); // not defined
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir     rtl::OUString maExpandText;
101*cdf0e10cSrcweir };
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir /******************************************************************************
104*cdf0e10cSrcweir  * SwXFlatParagraphIterator
105*cdf0e10cSrcweir  ******************************************************************************/
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir class SwXFlatParagraphIterator:
108*cdf0e10cSrcweir     public ::cppu::WeakImplHelper1
109*cdf0e10cSrcweir     <
110*cdf0e10cSrcweir         css::text::XFlatParagraphIterator
111*cdf0e10cSrcweir     >,
112*cdf0e10cSrcweir     public SwClient     // to get notified when doc is closed...
113*cdf0e10cSrcweir {
114*cdf0e10cSrcweir public:
115*cdf0e10cSrcweir     SwXFlatParagraphIterator( SwDoc& rDoc, sal_Int32 nType, sal_Bool bAutomatic );
116*cdf0e10cSrcweir     virtual ~SwXFlatParagraphIterator();
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir     // text::XFlatParagraphIterator:
119*cdf0e10cSrcweir     virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getFirstPara() throw (css::uno::RuntimeException);
120*cdf0e10cSrcweir     virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getNextPara() throw (css::uno::RuntimeException);
121*cdf0e10cSrcweir     virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getLastPara() throw (css::uno::RuntimeException);
122*cdf0e10cSrcweir     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);
123*cdf0e10cSrcweir     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);
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir protected:
126*cdf0e10cSrcweir     // SwClient
127*cdf0e10cSrcweir     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir private:
130*cdf0e10cSrcweir     SwXFlatParagraphIterator( const SwXFlatParagraphIterator & ); // not defined
131*cdf0e10cSrcweir     SwXFlatParagraphIterator & operator =(const SwXFlatParagraphIterator & ); // not defined
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir     // container to hold the 'hard' references as long as necessary and valid
134*cdf0e10cSrcweir     std::set< css::uno::Reference< css::text::XFlatParagraph > >    m_aFlatParaList;
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir     SwDoc* mpDoc;
137*cdf0e10cSrcweir     const sal_Int32 mnType;
138*cdf0e10cSrcweir     const sal_Bool mbAutomatic;
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir     sal_uLong mnCurrentNode;    // used for non-automatic mode
141*cdf0e10cSrcweir     sal_uLong mnStartNode;      // used for non-automatic mode
142*cdf0e10cSrcweir     sal_uLong mnEndNode;        // used for non-automatic mode
143*cdf0e10cSrcweir     sal_Bool mbWrapped;     // used for non-automatic mode
144*cdf0e10cSrcweir };
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir #endif
147