1. mst
  2. ooo340

Commits

Thomas Lange [tl]  committed f84bd48

cws tl77: #i111876# introduce new clipboard format

  • Participants
  • Parent commits 8b80d73
  • Branches default

Comments (0)

Files changed (12)

File editeng/inc/editeng/editeng.hxx

View file
   namespace frame {
     class XModel;
   }  
+  namespace text {
+    class XText;
+  }  
 }}}
+
 namespace svx{
 struct SpellPortion;
 typedef std::vector<SpellPortion> SpellPortions;
     /// get/set the Uno model of the docucumt (so far only needed to write new clipboard format EE_FORMAT_ODF)
     void            SetUnoModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &xModel );
     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetUnoModel() const;
+
+    virtual com::sun::star::uno::Reference< com::sun::star::text::XText >   GetUnoText( const ESelection& rSel );
 };
 
 #endif // _MyEDITENG_HXX

File editeng/inc/editsource.hxx

View file
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_EDITSOURCE_HXX
+#define _SVX_EDITSOURCE_HXX
+
+#include <editeng/unoedsrc.hxx>
+
+//////////////////////////////////////////////////////////////////////
+
+class EditEngine;
+class SvxEditEngineSourceImpl;
+
+class SvxEditEngineSource : public SvxEditSource
+{
+public:
+	SvxEditEngineSource( EditEngine* pEditEngine );
+	virtual ~SvxEditEngineSource();
+
+	virtual SvxEditSource*		Clone() const;
+	virtual SvxTextForwarder*	GetTextForwarder();
+	virtual void				UpdateData();
+
+private:
+	SvxEditEngineSource( SvxEditEngineSourceImpl* pImpl );
+
+	SvxEditEngineSourceImpl*	mpImpl;
+};
+
+//////////////////////////////////////////////////////////////////////
+
+class Outliner;
+class SvxOutlinerSourceImpl;
+
+class SvxOutlinerSource : public SvxEditSource
+{
+public:
+    SvxOutlinerSource( Outliner* pOutliner );
+    virtual ~SvxOutlinerSource();
+
+    virtual SvxEditSource*      Clone() const;
+    virtual SvxTextForwarder*   GetTextForwarder();
+    virtual void                UpdateData();
+
+private:
+    SvxOutlinerSource( SvxOutlinerSourceImpl* pImpl );
+
+    SvxOutlinerSourceImpl*    mpImpl;
+};
+
+//////////////////////////////////////////////////////////////////////
+
+#endif

File editeng/source/editeng/editeng.cxx

View file
     return pImpEditEngine->GetUnoModel();
 }
     
+uno::Reference< text::XText > EditEngine::GetUnoText( const ESelection& rSel )
+{
+    return pImpEditEngine->GetUnoText( rSel );
+}
+    
 // ---------------------------------------------------
 
 

File editeng/source/editeng/eeobj.cxx

View file
 
     SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aDataFlavors.getArray()[1] );
     SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_EDITENGINE, aDataFlavors.getArray()[2] );
-//    SotExchange::GetFormatDataFlavor( SOT_FORMAT_RTF, aDataFlavors.getArray()[3] );
+//TL_TEST    SotExchange::GetFormatDataFlavor( SOT_FORMAT_RTF, aDataFlavors.getArray()[3] );
 
 	return aDataFlavors;
 }

File editeng/source/editeng/impedit.hxx

View file
 #include <com/sun/star/i18n/WordType.hpp>
 #include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp>
 #include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/text/XText.hpp>
 
 #include <i18npool/lang.h>
 #include <vos/ref.hxx>
     /// get/set the Uno model of the docucumt (so far only needed to write new clipboard format EE_FORMAT_ODF)
     inline void            SetUnoModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &xModel );
     inline ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetUnoModel() const;
+
+    com::sun::star::uno::Reference< com::sun::star::text::XText >   GetUnoText( const ESelection& rSel );
 };
 
 inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM )

File editeng/source/editeng/impedit4.cxx

View file
 #include <vcl/svapp.hxx>
 
 #include <svl/srchitem.hxx>
+#include <svl/itemprop.hxx>
 #include <editeng/lspcitem.hxx>
 #include <editeng/adjitem.hxx>
 #include <editeng/tstpitem.hxx>
 
 #include <eertfpar.hxx>
 #include <editeng/editeng.hxx>
+#include <editeng/unotext.hxx>
+#include <editeng/unoprnms.hxx>
+#include <editeng/unoipset.hxx>
 #include <impedit.hxx>
 #include <editeng/editview.hxx>
 #include <eehtml.hxx>
 #include <editeng/charreliefitem.hxx>
 #include <editeng/frmdiritem.hxx>
 #include <editeng/emphitem.hxx>
+#include <editsource.hxx>
 #include <textconv.hxx>
 #include <rtl/tencinfo.h>
 #include <svtools/rtfout.hxx>
 	rY = n;
 }
 
+
+uno::Reference< text::XText > ImpEditEngine::GetUnoText( const ESelection& rSel )
+{
+    // compare also with OutlinerEditEng::GetUnoText ...
+
+    SvxEditEngineSource aEditSource( pEditEngine );
+
+    static const SfxItemPropertyMapEntry SvxXMLTextImportComponentPropertyMap[] =
+    {
+        SVX_UNOEDIT_CHAR_PROPERTIES,
+        SVX_UNOEDIT_FONT_PROPERTIES,
+//		SVX_UNOEDIT_OUTLINER_PROPERTIES,    when you need Outliner properties you should have called OulinerEditEng::GetUnoText instead
+        SVX_UNOEDIT_PARA_PROPERTIES,
+        {0,0,0,0,0,0}
+    };
+    static SvxItemPropertySet aSvxXMLTextImportComponentPropertySet( 
+            SvxXMLTextImportComponentPropertyMap, EditEngine::GetGlobalItemPool() );
+
+    uno::Reference< text::XText > xParent;
+    SvxUnoText* pUnoText = new SvxUnoText( &aEditSource, &aSvxXMLTextImportComponentPropertySet, xParent );
+    pUnoText->SetSelection( rSel );
+    
+    return uno::Reference< text::XText >( pUnoText );
+}
+
+
 EditPaM ImpEditEngine::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, EditSelection aSel, SvKeyValueIterator* pHTTPHeaderAttrs )
 {
 	sal_Bool _bUpdate = GetUpdateMode();

File editeng/source/outliner/outleeng.cxx

View file
 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_editeng.hxx"
+
 #include <svl/intitem.hxx>
+#include <svl/itemprop.hxx>
 #include <editeng/editeng.hxx>
 #include <editeng/editview.hxx>
 #include <editeng/editdata.hxx>
 #include <editeng/fhgtitem.hxx>
 
 #define _OUTLINER_CXX
+
 #include <editeng/outliner.hxx>
 #include <outleeng.hxx>
 #include <paralist.hxx>
+#include <editsource.hxx>
 #include <editeng/editrids.hrc>
 #include <svl/itemset.hxx>
 #include <editeng/eeitem.hxx>
 #include <editeng/editstat.hxx>
+#include <editeng/unotext.hxx>
+#include <editeng/unoprnms.hxx>
+#include <editeng/unoipset.hxx>
 #include "outlundo.hxx"
 
+using namespace ::com::sun::star;
+
+
 OutlinerEditEng::OutlinerEditEng( Outliner* pEngOwner, SfxItemPool* pPool )
  : EditEngine( pPool )
 {
 	}
 }
 
+
+uno::Reference< text::XText > OutlinerEditEng::GetUnoText( const ESelection& rSel )
+{
+    // see also ImpEditEngine::GetUnoText for reference
+    
+    SvxOutlinerSource aEditSource( pOwner /* Outliner * */ );
+
+    static const SfxItemPropertyMapEntry SvxXMLTextImportComponentPropertyMap[] =
+    {
+        SVX_UNOEDIT_CHAR_PROPERTIES,
+        SVX_UNOEDIT_FONT_PROPERTIES,
+        SVX_UNOEDIT_OUTLINER_PROPERTIES,
+        SVX_UNOEDIT_PARA_PROPERTIES,
+        {0,0,0,0,0,0}
+    };
+    static SvxItemPropertySet aSvxXMLTextImportComponentPropertySet( 
+            SvxXMLTextImportComponentPropertyMap, EditEngine::GetGlobalItemPool() );
+
+    uno::Reference< text::XText > xParent;
+    SvxUnoText* pUnoText = new SvxUnoText( &aEditSource, &aSvxXMLTextImportComponentPropertySet, xParent );
+    pUnoText->SetSelection( rSel );
+
+    return uno::Reference< text::XText >( pUnoText );
+}
+
+
+

File editeng/source/outliner/outleeng.hxx

View file
 
    	virtual void        SetParaAttribs( USHORT nPara, const SfxItemSet& rSet );
 
+    // from EditEngine
+    virtual com::sun::star::uno::Reference< com::sun::star::text::XText >   GetUnoText( const ESelection& rSel );
+
     // belongs into class Outliner, move there before incompatible update!
     Link                aOutlinerNotifyHdl;
     NotifyList          aNotifyCache;

File editeng/source/uno/unofored.cxx

View file
     return -1;
 }
 
-sal_Bool SvxEditEngineForwarder::SetDepth( USHORT, sal_Int16 nNewDepth )
+sal_Bool SvxEditEngineForwarder::SetDepth( USHORT nPara, sal_Int16 nNewDepth )
 {
+    (void) nPara;
     // EditEngine does not support outline depth
     return nNewDepth == -1 ? sal_True : sal_False;
 }

File editeng/source/xml/editsource.hxx

-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_EDITSOURCE_HXX
-#define _SVX_EDITSOURCE_HXX
-
-#include <editeng/unoedsrc.hxx>
-
-class EditEngine;
-class SvxEditEngineSourceImpl;
-
-class SvxEditEngineSource : public SvxEditSource
-{
-public:
-	SvxEditEngineSource( EditEngine* pEditEngine );
-	virtual ~SvxEditEngineSource();
-
-	virtual SvxEditSource*		Clone() const;
-	virtual SvxTextForwarder*	GetTextForwarder();
-	virtual void				UpdateData();
-
-private:
-	SvxEditEngineSource( SvxEditEngineSourceImpl* pImpl );
-
-	SvxEditEngineSourceImpl*	mpImpl;
-};
-
-#endif

File editeng/source/xml/xmltxtexp.cxx

View file
 #include <xmloff/xmlexp.hxx>
 #include <editeng/unoedsrc.hxx>
 #include <editeng/unofored.hxx>
+#include <editeng/unoforou.hxx>
 #include <editeng/unotext.hxx>
 #include <editeng/unoprnms.hxx>
 #include <editeng/unofield.hxx>
 {
 }
 
+///////////////////////////////////////////////////////////////////////
+
+class SvxOutlinerSourceImpl
+{
+private:
+    oslInterlockedCount     maRefCount;
+
+    Outliner*               mpOutliner;
+    SvxTextForwarder*       mpTextForwarder;
+
+    ~SvxOutlinerSourceImpl();
+
+public:
+    SvxOutlinerSourceImpl( Outliner* pOutliner );
+
+    void SAL_CALL acquire();
+    void SAL_CALL release();
+
+    SvxTextForwarder*       GetTextForwarder();
+};
+
+///////////////////////////////////////////////////////////////////////
+
+
+//------------------------------------------------------------------------
+
+SvxOutlinerSourceImpl::SvxOutlinerSourceImpl( Outliner* pOutliner )
+: maRefCount( 0 ),
+  mpOutliner( pOutliner ),
+  mpTextForwarder( NULL )
+{
+}
+
+//------------------------------------------------------------------------
+
+SvxOutlinerSourceImpl::~SvxOutlinerSourceImpl()
+{
+    delete mpTextForwarder;
+}
+
+//------------------------------------------------------------------------
+
+void SAL_CALL SvxOutlinerSourceImpl::acquire() 
+{
+    osl_incrementInterlockedCount( &maRefCount );
+}   
+
+//------------------------------------------------------------------------
+
+void SAL_CALL SvxOutlinerSourceImpl::release()
+{
+    if( ! osl_decrementInterlockedCount( &maRefCount ) )
+        delete this;
+}   
+
+//------------------------------------------------------------------------
+
+SvxTextForwarder* SvxOutlinerSourceImpl::GetTextForwarder()
+{
+    if (!mpTextForwarder)
+        mpTextForwarder = new SvxOutlinerForwarder( *mpOutliner );
+
+    return mpTextForwarder;
+}
+
+// --------------------------------------------------------------------
+// SvxOutlinerSource
+// --------------------------------------------------------------------
+
+SvxOutlinerSource::SvxOutlinerSource( Outliner* pOutliner )
+{
+    mpImpl = new SvxOutlinerSourceImpl( pOutliner );
+    mpImpl->acquire();
+}
+
+// --------------------------------------------------------------------
+
+SvxOutlinerSource::SvxOutlinerSource( SvxOutlinerSourceImpl* pImpl )
+{
+    mpImpl = pImpl;
+    mpImpl->acquire();
+}
+
+//------------------------------------------------------------------------
+
+SvxOutlinerSource::~SvxOutlinerSource()
+{
+    mpImpl->release();
+}
+
+//------------------------------------------------------------------------
+
+SvxEditSource* SvxOutlinerSource::Clone() const
+{
+    return new SvxOutlinerSource( mpImpl );
+}
+
+//------------------------------------------------------------------------
+
+SvxTextForwarder* SvxOutlinerSource::GetTextForwarder()
+{
+    return mpImpl->GetTextForwarder();
+}
+
+//------------------------------------------------------------------------
+
+void SvxOutlinerSource::UpdateData()
+{
+}
+
+///////////////////////////////////////////////////////////////////////
+
 class SvxSimpleUnoModel : public cppu::WeakAggImplHelper4<
 									::com::sun::star::frame::XModel,
 									::com::sun::star::ucb::XAnyCompareFactory,

File editeng/source/xml/xmltxtimp.cxx

View file
 #include <xmloff/xmltoken.hxx>
 #include <xmloff/xmlnmspe.hxx>
 #include <xmloff/xmlstyle.hxx>
-#include "editsource.hxx"
 #include <editeng/editeng.hxx>
 #include <editeng/unotext.hxx>
 #include <editeng/unoprnms.hxx>
 #endif
 
 
-static uno::Reference< text::XText > lcl_GetUnoText( EditEngine& rEditEngine, const ESelection& rSel )
-{
-    SvxEditEngineSource aEditSource( &rEditEngine );
-
-    static const SfxItemPropertyMapEntry SvxXMLTextImportComponentPropertyMap[] =
-    {
-        SVX_UNOEDIT_CHAR_PROPERTIES,
-        SVX_UNOEDIT_FONT_PROPERTIES,
-		SVX_UNOEDIT_OUTLINER_PROPERTIES,
-        SVX_UNOEDIT_PARA_PROPERTIES,
-        {0,0,0,0,0,0}
-    };
-    static SvxItemPropertySet aSvxXMLTextImportComponentPropertySet( SvxXMLTextImportComponentPropertyMap, EditEngine::GetGlobalItemPool() );
-
-    uno::Reference<text::XText > xParent;
-    SvxUnoText* pUnoText = new SvxUnoText( &aEditSource, &aSvxXMLTextImportComponentPropertySet, xParent );
-    pUnoText->SetSelection( rSel );
-    uno::Reference<text::XText > xText( pUnoText );
-
-    return xText;
-}
-    
-
 static void SvxReadXML_Impl( 
     SvStream& rStream, 
     SvxXMLXTextImportComponent *pImporter )
     
     if (xServiceFactory.is())
     {
-        uno::Reference< text::XText > xText( lcl_GetUnoText( rEditEngine, rSel ) );
+        uno::Reference< text::XText > xText( rEditEngine.GetUnoText( rSel ) );
 
         // #110680#
         SvxXMLXTextImportComponent *pImporter = new SvxXMLXTextImportComponent( xServiceFactory, xText );
     DBG_ASSERT( xModel.is(), "document model is missing" );
     if (xModel.is() && xServiceFactory.is())
     {
-        uno::Reference< text::XText > xText( lcl_GetUnoText( rEditEngine, rSel ) );
+        uno::Reference< text::XText > xText( rEditEngine.GetUnoText( rSel ) );
 
         const sal_uInt16 nImportFlags = IMPORT_ALL;
         SvxXMLXTextImportComponent *pImporter = new SvxXMLXTextImportComponent(