1*1d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1d2dbeb0SAndrew Rist * distributed with this work for additional information 6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10*1d2dbeb0SAndrew Rist * 11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*1d2dbeb0SAndrew Rist * 13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations 18*1d2dbeb0SAndrew Rist * under the License. 19*1d2dbeb0SAndrew Rist * 20*1d2dbeb0SAndrew Rist *************************************************************/ 21*1d2dbeb0SAndrew Rist 22*1d2dbeb0SAndrew 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 43cdf0e10cSrcweir class SwTxtNode; 44cdf0e10cSrcweir class SwDoc; 45cdf0e10cSrcweir 46cdf0e10cSrcweir /****************************************************************************** 47cdf0e10cSrcweir * SwXFlatParagraph 48cdf0e10cSrcweir ******************************************************************************/ 49cdf0e10cSrcweir 50cdf0e10cSrcweir class SwXFlatParagraph: 51cdf0e10cSrcweir public ::cppu::WeakImplHelper2 52cdf0e10cSrcweir < 53cdf0e10cSrcweir css::text::XFlatParagraph, 54cdf0e10cSrcweir css::lang::XUnoTunnel 55cdf0e10cSrcweir >, 56cdf0e10cSrcweir public SwXTextMarkup 57cdf0e10cSrcweir { 58cdf0e10cSrcweir public: 59cdf0e10cSrcweir SwXFlatParagraph( SwTxtNode& rTxtNode, rtl::OUString aExpandText, const ModelToViewHelper::ConversionMap* pConversionMap ); 60cdf0e10cSrcweir virtual ~SwXFlatParagraph(); 61cdf0e10cSrcweir 62cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException); 63cdf0e10cSrcweir virtual void SAL_CALL acquire( ) throw(); 64cdf0e10cSrcweir virtual void SAL_CALL release( ) throw(); 65cdf0e10cSrcweir 66cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); 67cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); 68cdf0e10cSrcweir 69cdf0e10cSrcweir // text::XTextMarkup: 70cdf0e10cSrcweir virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() throw (css::uno::RuntimeException); 71cdf0e10cSrcweir 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); 72cdf0e10cSrcweir 73cdf0e10cSrcweir // text::XFlatParagraph: 74cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); 75cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isModified() throw (css::uno::RuntimeException); 76cdf0e10cSrcweir virtual void SAL_CALL setChecked(::sal_Int32 nType, ::sal_Bool bVal) throw (css::uno::RuntimeException); 77cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isChecked(::sal_Int32 nType) throw (css::uno::RuntimeException); 78cdf0e10cSrcweir virtual css::lang::Locale SAL_CALL getLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException); 79cdf0e10cSrcweir virtual css::lang::Locale SAL_CALL getPrimaryLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException); 80cdf0e10cSrcweir 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); 81cdf0e10cSrcweir 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); 82cdf0e10cSrcweir virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getLanguagePortions() throw (css::uno::RuntimeException); 83cdf0e10cSrcweir 84cdf0e10cSrcweir const SwTxtNode* getTxtNode() const; 85cdf0e10cSrcweir 86cdf0e10cSrcweir static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); 87cdf0e10cSrcweir 88cdf0e10cSrcweir // XUnoTunnel 89cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& rId) 90cdf0e10cSrcweir throw (css::uno::RuntimeException); 91cdf0e10cSrcweir 92cdf0e10cSrcweir private: 93cdf0e10cSrcweir SwXFlatParagraph( const SwXFlatParagraph & ); // not defined 94cdf0e10cSrcweir SwXFlatParagraph & operator = ( const SwXFlatParagraph & ); // not defined 95cdf0e10cSrcweir 96cdf0e10cSrcweir rtl::OUString maExpandText; 97cdf0e10cSrcweir }; 98cdf0e10cSrcweir 99cdf0e10cSrcweir /****************************************************************************** 100cdf0e10cSrcweir * SwXFlatParagraphIterator 101cdf0e10cSrcweir ******************************************************************************/ 102cdf0e10cSrcweir 103cdf0e10cSrcweir class SwXFlatParagraphIterator: 104cdf0e10cSrcweir public ::cppu::WeakImplHelper1 105cdf0e10cSrcweir < 106cdf0e10cSrcweir css::text::XFlatParagraphIterator 107cdf0e10cSrcweir >, 108cdf0e10cSrcweir public SwClient // to get notified when doc is closed... 109cdf0e10cSrcweir { 110cdf0e10cSrcweir public: 111cdf0e10cSrcweir SwXFlatParagraphIterator( SwDoc& rDoc, sal_Int32 nType, sal_Bool bAutomatic ); 112cdf0e10cSrcweir virtual ~SwXFlatParagraphIterator(); 113cdf0e10cSrcweir 114cdf0e10cSrcweir // text::XFlatParagraphIterator: 115cdf0e10cSrcweir virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getFirstPara() throw (css::uno::RuntimeException); 116cdf0e10cSrcweir virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getNextPara() throw (css::uno::RuntimeException); 117cdf0e10cSrcweir virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getLastPara() throw (css::uno::RuntimeException); 118cdf0e10cSrcweir 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); 119cdf0e10cSrcweir 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); 120cdf0e10cSrcweir 121cdf0e10cSrcweir protected: 122cdf0e10cSrcweir // SwClient 123cdf0e10cSrcweir virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ); 124cdf0e10cSrcweir 125cdf0e10cSrcweir private: 126cdf0e10cSrcweir SwXFlatParagraphIterator( const SwXFlatParagraphIterator & ); // not defined 127cdf0e10cSrcweir SwXFlatParagraphIterator & operator =(const SwXFlatParagraphIterator & ); // not defined 128cdf0e10cSrcweir 129cdf0e10cSrcweir // container to hold the 'hard' references as long as necessary and valid 130cdf0e10cSrcweir std::set< css::uno::Reference< css::text::XFlatParagraph > > m_aFlatParaList; 131cdf0e10cSrcweir 132cdf0e10cSrcweir SwDoc* mpDoc; 133cdf0e10cSrcweir const sal_Int32 mnType; 134cdf0e10cSrcweir const sal_Bool mbAutomatic; 135cdf0e10cSrcweir 136cdf0e10cSrcweir sal_uLong mnCurrentNode; // used for non-automatic mode 137cdf0e10cSrcweir sal_uLong mnStartNode; // used for non-automatic mode 138cdf0e10cSrcweir sal_uLong mnEndNode; // used for non-automatic mode 139cdf0e10cSrcweir sal_Bool mbWrapped; // used for non-automatic mode 140cdf0e10cSrcweir }; 141cdf0e10cSrcweir 142cdf0e10cSrcweir #endif 143