xref: /aoo41x/main/sw/inc/unoflatpara.hxx (revision 1ced0919)
11d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
101d2dbeb0SAndrew Rist  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
121d2dbeb0SAndrew Rist  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
191d2dbeb0SAndrew Rist  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _UNOFLATPARA_HXX
25cdf0e10cSrcweir #define _UNOFLATPARA_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
28cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
29cdf0e10cSrcweir #include <com/sun/star/text/XFlatParagraph.hpp>
30cdf0e10cSrcweir #include <com/sun/star/text/XFlatParagraphIterator.hpp>
31cdf0e10cSrcweir #include <calbck.hxx>
32cdf0e10cSrcweir #include <modeltoviewhelper.hxx>
33cdf0e10cSrcweir #include <unotextmarkup.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <set>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace css = com::sun::star;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace container {
40cdf0e10cSrcweir     class XStringKeyMap;
41cdf0e10cSrcweir } } } }
42cdf0e10cSrcweir 
43*1ced0919SJürgen Schmidt namespace com { namespace sun { namespace star { namespace text {
44*1ced0919SJürgen Schmidt     class XTextRange;
45*1ced0919SJürgen Schmidt } } } }
46*1ced0919SJürgen Schmidt 
47cdf0e10cSrcweir class SwTxtNode;
48cdf0e10cSrcweir class SwDoc;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir /******************************************************************************
51cdf0e10cSrcweir  * SwXFlatParagraph
52cdf0e10cSrcweir  ******************************************************************************/
53cdf0e10cSrcweir 
54cdf0e10cSrcweir class SwXFlatParagraph:
55cdf0e10cSrcweir     public ::cppu::WeakImplHelper2
56cdf0e10cSrcweir     <
57cdf0e10cSrcweir         css::text::XFlatParagraph,
58cdf0e10cSrcweir         css::lang::XUnoTunnel
59cdf0e10cSrcweir     >,
60cdf0e10cSrcweir     public SwXTextMarkup
61cdf0e10cSrcweir {
62cdf0e10cSrcweir public:
63cdf0e10cSrcweir     SwXFlatParagraph( SwTxtNode& rTxtNode, rtl::OUString aExpandText, const ModelToViewHelper::ConversionMap* pConversionMap );
64cdf0e10cSrcweir     virtual ~SwXFlatParagraph();
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     virtual 	::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
67cdf0e10cSrcweir     virtual void SAL_CALL acquire(  ) throw();
68cdf0e10cSrcweir     virtual void SAL_CALL release(  ) throw();
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
71cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     // text::XTextMarkup:
74cdf0e10cSrcweir     virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() throw (css::uno::RuntimeException);
75*1ced0919SJürgen Schmidt 
76*1ced0919SJürgen Schmidt     virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength,
77*1ced0919SJürgen Schmidt 		                           const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) throw (css::uno::RuntimeException);
78*1ced0919SJürgen Schmidt 
79*1ced0919SJürgen Schmidt     virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange> & xRange,
80*1ced0919SJürgen Schmidt                                                 const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) throw (css::uno::RuntimeException);
81*1ced0919SJürgen Schmidt 
82*1ced0919SJürgen Schmidt 
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     // text::XFlatParagraph:
85cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
86cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL isModified() throw (css::uno::RuntimeException);
87cdf0e10cSrcweir     virtual void SAL_CALL setChecked(::sal_Int32 nType, ::sal_Bool bVal) throw (css::uno::RuntimeException);
88cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL isChecked(::sal_Int32 nType) throw (css::uno::RuntimeException);
89cdf0e10cSrcweir     virtual css::lang::Locale SAL_CALL getLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
90cdf0e10cSrcweir     virtual css::lang::Locale SAL_CALL getPrimaryLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
91cdf0e10cSrcweir     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);
92cdf0e10cSrcweir     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);
93cdf0e10cSrcweir     virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getLanguagePortions() throw (css::uno::RuntimeException);
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     const SwTxtNode* getTxtNode() const;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     // XUnoTunnel
100cdf0e10cSrcweir     virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& rId)
101cdf0e10cSrcweir         throw (css::uno::RuntimeException);
102cdf0e10cSrcweir 
103cdf0e10cSrcweir private:
104cdf0e10cSrcweir     SwXFlatParagraph( const SwXFlatParagraph & ); // not defined
105cdf0e10cSrcweir     SwXFlatParagraph & operator = ( const SwXFlatParagraph & ); // not defined
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     rtl::OUString maExpandText;
108cdf0e10cSrcweir };
109cdf0e10cSrcweir 
110cdf0e10cSrcweir /******************************************************************************
111cdf0e10cSrcweir  * SwXFlatParagraphIterator
112cdf0e10cSrcweir  ******************************************************************************/
113cdf0e10cSrcweir 
114cdf0e10cSrcweir class SwXFlatParagraphIterator:
115cdf0e10cSrcweir     public ::cppu::WeakImplHelper1
116cdf0e10cSrcweir     <
117cdf0e10cSrcweir         css::text::XFlatParagraphIterator
118cdf0e10cSrcweir     >,
119cdf0e10cSrcweir     public SwClient     // to get notified when doc is closed...
120cdf0e10cSrcweir {
121cdf0e10cSrcweir public:
122cdf0e10cSrcweir     SwXFlatParagraphIterator( SwDoc& rDoc, sal_Int32 nType, sal_Bool bAutomatic );
123cdf0e10cSrcweir     virtual ~SwXFlatParagraphIterator();
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     // text::XFlatParagraphIterator:
126cdf0e10cSrcweir     virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getFirstPara() throw (css::uno::RuntimeException);
127cdf0e10cSrcweir     virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getNextPara() throw (css::uno::RuntimeException);
128cdf0e10cSrcweir     virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getLastPara() throw (css::uno::RuntimeException);
129cdf0e10cSrcweir     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);
130cdf0e10cSrcweir     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);
131cdf0e10cSrcweir 
132cdf0e10cSrcweir protected:
133cdf0e10cSrcweir     // SwClient
134cdf0e10cSrcweir     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
135cdf0e10cSrcweir 
136cdf0e10cSrcweir private:
137cdf0e10cSrcweir     SwXFlatParagraphIterator( const SwXFlatParagraphIterator & ); // not defined
138cdf0e10cSrcweir     SwXFlatParagraphIterator & operator =(const SwXFlatParagraphIterator & ); // not defined
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     // container to hold the 'hard' references as long as necessary and valid
141cdf0e10cSrcweir     std::set< css::uno::Reference< css::text::XFlatParagraph > >    m_aFlatParaList;
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     SwDoc* mpDoc;
144cdf0e10cSrcweir     const sal_Int32 mnType;
145cdf0e10cSrcweir     const sal_Bool mbAutomatic;
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     sal_uLong mnCurrentNode;    // used for non-automatic mode
148cdf0e10cSrcweir     sal_uLong mnStartNode;      // used for non-automatic mode
149cdf0e10cSrcweir     sal_uLong mnEndNode;        // used for non-automatic mode
150cdf0e10cSrcweir     sal_Bool mbWrapped;     // used for non-automatic mode
151cdf0e10cSrcweir };
152cdf0e10cSrcweir 
153cdf0e10cSrcweir #endif
154