summaryrefslogtreecommitdiff
path: root/binfilter/bf_svx/source/unoedit
diff options
context:
space:
mode:
Diffstat (limited to 'binfilter/bf_svx/source/unoedit')
-rw-r--r--binfilter/bf_svx/source/unoedit/makefile.mk64
-rw-r--r--binfilter/bf_svx/source/unoedit/svx_UnoForbiddenCharsTable.cxx150
-rw-r--r--binfilter/bf_svx/source/unoedit/svx_unoedacc.cxx29
-rw-r--r--binfilter/bf_svx/source/unoedit/svx_unoedhlp.cxx102
-rw-r--r--binfilter/bf_svx/source/unoedit/svx_unoedprx.cxx1199
-rw-r--r--binfilter/bf_svx/source/unoedit/svx_unoedsrc.cxx76
-rw-r--r--binfilter/bf_svx/source/unoedit/svx_unofield.cxx1075
-rw-r--r--binfilter/bf_svx/source/unoedit/svx_unofored.cxx503
-rw-r--r--binfilter/bf_svx/source/unoedit/svx_unoforou.cxx505
-rw-r--r--binfilter/bf_svx/source/unoedit/svx_unotext.cxx2154
-rw-r--r--binfilter/bf_svx/source/unoedit/svx_unotext2.cxx635
-rw-r--r--binfilter/bf_svx/source/unoedit/svx_unoviwed.cxx135
-rw-r--r--binfilter/bf_svx/source/unoedit/svx_unoviwou.cxx167
13 files changed, 0 insertions, 6794 deletions
diff --git a/binfilter/bf_svx/source/unoedit/makefile.mk b/binfilter/bf_svx/source/unoedit/makefile.mk
deleted file mode 100644
index f4272cf31be5..000000000000
--- a/binfilter/bf_svx/source/unoedit/makefile.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-#*************************************************************************
-#
-# 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.
-#
-#*************************************************************************
-
-EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-
-PRJ=..$/..$/..
-BFPRJ=..$/..
-
-PRJNAME=binfilter
-TARGET=svx_unoedit
-
-NO_HIDS=TRUE
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(BFPRJ)$/util$/makefile.pmk
-INC+= -I$(PRJ)$/inc$/bf_svx
-
-# --- Files --------------------------------------------------------
-
-SLOFILES = \
- $(SLO)$/svx_UnoForbiddenCharsTable.obj \
- $(SLO)$/svx_unoedsrc.obj \
- $(SLO)$/svx_unoedhlp.obj \
- $(SLO)$/svx_unoedprx.obj \
- $(SLO)$/svx_unoviwed.obj \
- $(SLO)$/svx_unoviwou.obj \
- $(SLO)$/svx_unofored.obj \
- $(SLO)$/svx_unoforou.obj \
- $(SLO)$/svx_unotext.obj \
- $(SLO)$/svx_unotext2.obj \
- $(SLO)$/svx_unofield.obj
-
-# --- Tagets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/binfilter/bf_svx/source/unoedit/svx_UnoForbiddenCharsTable.cxx b/binfilter/bf_svx/source/unoedit/svx_UnoForbiddenCharsTable.cxx
deleted file mode 100644
index 81de3aae323c..000000000000
--- a/binfilter/bf_svx/source/unoedit/svx_UnoForbiddenCharsTable.cxx
+++ /dev/null
@@ -1,150 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#include "UnoForbiddenCharsTable.hxx"
-
-#include "forbiddencharacterstable.hxx"
-
-#include <osl/mutex.hxx>
-#include <vcl/svapp.hxx>
-#include <rtl/ref.hxx>
-
-#include "unolingu.hxx"
-namespace binfilter {
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::i18n;
-using namespace ::cppu;
-
-SvxUnoForbiddenCharsTable::SvxUnoForbiddenCharsTable(rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars) :
- mxForbiddenChars( xForbiddenChars )
-{
-}
-
-SvxUnoForbiddenCharsTable::~SvxUnoForbiddenCharsTable()
-{
-}
-
-void SvxUnoForbiddenCharsTable::onChange()
-{
-}
-
-ForbiddenCharacters SvxUnoForbiddenCharsTable::getForbiddenCharacters( const Locale& rLocale )
- throw(NoSuchElementException, RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if(!mxForbiddenChars.is())
- throw RuntimeException();
-
- const LanguageType eLang = SvxLocaleToLanguage( rLocale );
- const ForbiddenCharacters* pForbidden = mxForbiddenChars->GetForbiddenCharacters( eLang, FALSE );
- if(!pForbidden)
- throw NoSuchElementException();
-
- return *pForbidden;
-}
-
-sal_Bool SvxUnoForbiddenCharsTable::hasForbiddenCharacters( const Locale& rLocale )
- throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if(!mxForbiddenChars.is())
- return sal_False;
-
- const LanguageType eLang = SvxLocaleToLanguage( rLocale );
- const ForbiddenCharacters* pForbidden = mxForbiddenChars->GetForbiddenCharacters( eLang, FALSE );
-
- return NULL != pForbidden;
-}
-
-void SvxUnoForbiddenCharsTable::setForbiddenCharacters(const Locale& rLocale, const ForbiddenCharacters& rForbiddenCharacters )
- throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if(!mxForbiddenChars.is())
- throw RuntimeException();
-
- const LanguageType eLang = SvxLocaleToLanguage( rLocale );
- mxForbiddenChars->SetForbiddenCharacters( eLang, rForbiddenCharacters );
-
- onChange();
-}
-
-void SvxUnoForbiddenCharsTable::removeForbiddenCharacters( const Locale& rLocale )
- throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if(!mxForbiddenChars.is())
- throw RuntimeException();
-
- const LanguageType eLang = SvxLocaleToLanguage( rLocale );
- mxForbiddenChars->ClearForbiddenCharacters( eLang );
-
- onChange();
-}
-
-// XSupportedLocales
-Sequence< Locale > SAL_CALL SvxUnoForbiddenCharsTable::getLocales()
- throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- const sal_Int32 nCount = mxForbiddenChars.is() ? mxForbiddenChars->Count() : 0;
-
- Sequence< Locale > aLocales( nCount );
- if( nCount )
- {
- Locale* pLocales = aLocales.getArray();
-
- for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
- {
- const ULONG nLanguage = mxForbiddenChars->GetObjectKey( nIndex );
- SvxLanguageToLocale ( *pLocales++, static_cast < LanguageType > (nLanguage) );
- }
- }
-
- return aLocales;
-}
-
-sal_Bool SAL_CALL SvxUnoForbiddenCharsTable::hasLocale( const Locale& aLocale )
- throw(RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- return hasForbiddenCharacters( aLocale );
-}
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/unoedit/svx_unoedacc.cxx b/binfilter/bf_svx/source/unoedit/svx_unoedacc.cxx
deleted file mode 100644
index 6b21d6591ff6..000000000000
--- a/binfilter/bf_svx/source/unoedit/svx_unoedacc.cxx
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/unoedit/svx_unoedhlp.cxx b/binfilter/bf_svx/source/unoedit/svx_unoedhlp.cxx
deleted file mode 100644
index 3b4acc0072b7..000000000000
--- a/binfilter/bf_svx/source/unoedit/svx_unoedhlp.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#ifdef _MSC_VER
-#pragma hdrstop
-#endif
-
-#include <tools/debug.hxx>
-
-#include "unoedhlp.hxx"
-#include "editeng.hxx"
-namespace binfilter {
-
-//------------------------------------------------------------------------
-
-sal_Bool SvxEditSourceHelper::GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, const EditEngine& rEE, USHORT nPara, USHORT nIndex )
-{
- EECharAttribArray aCharAttribs;
-
- rEE.GetCharAttribs( nPara, aCharAttribs );
-
- // find closest index in front of nIndex
- USHORT nAttr, nCurrIndex;
- sal_Int32 nClosestStartIndex;
- for( nAttr=0, nClosestStartIndex=0; nAttr<aCharAttribs.Count(); ++nAttr )
- {
- nCurrIndex = aCharAttribs[nAttr].nStart;
-
- if( nCurrIndex > nIndex )
- break; // aCharAttribs array is sorted in increasing order for nStart values
-
- if( nCurrIndex > nClosestStartIndex )
- {
- nClosestStartIndex = nCurrIndex;
- }
- }
-
- // find closest index behind of nIndex
- sal_Int32 nClosestEndIndex;
- for( nAttr=0, nClosestEndIndex=rEE.GetTextLen(nPara); nAttr<aCharAttribs.Count(); ++nAttr )
- {
- nCurrIndex = aCharAttribs[nAttr].nEnd;
-
- if( nCurrIndex > nIndex &&
- nCurrIndex < nClosestEndIndex )
- {
- nClosestEndIndex = nCurrIndex;
- }
- }
-
- nStartIndex = static_cast<USHORT>( nClosestStartIndex );
- nEndIndex = static_cast<USHORT>( nClosestEndIndex );
-
- return sal_True;
-}
-
-Point SvxEditSourceHelper::EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical )
-{
- return bIsVertical ? Point( -rPoint.Y() + rEESize.Height(), rPoint.X() ) : rPoint;
-}
-
-Point SvxEditSourceHelper::UserSpaceToEE( const Point& rPoint, const Size& rEESize, bool bIsVertical )
-{
- return bIsVertical ? Point( rPoint.Y(), -rPoint.X() + rEESize.Height() ) : rPoint;
-}
-
-Rectangle SvxEditSourceHelper::EEToUserSpace( const Rectangle& rRect, const Size& rEESize, bool bIsVertical )
-{
- // #106775# Don't touch rect if not vertical
- return bIsVertical ? Rectangle( EEToUserSpace(rRect.BottomLeft(), rEESize, bIsVertical),
- EEToUserSpace(rRect.TopRight(), rEESize, bIsVertical) ) : rRect;
-}
-
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/unoedit/svx_unoedprx.cxx b/binfilter/bf_svx/source/unoedit/svx_unoedprx.cxx
deleted file mode 100644
index f1f3a61437d9..000000000000
--- a/binfilter/bf_svx/source/unoedit/svx_unoedprx.cxx
+++ /dev/null
@@ -1,1199 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#ifdef _MSC_VER
-#pragma hdrstop
-#endif
-
-//------------------------------------------------------------------------
-//
-// Global header
-//
-//------------------------------------------------------------------------
-
-#include <limits.h>
-#include <vector>
-#include <algorithm>
-
-
-
-
-
-
-//------------------------------------------------------------------------
-//
-// Project-local header
-//
-//------------------------------------------------------------------------
-
-#include "unoedprx.hxx"
-
-#include "unotext.hxx"
-
-#include "editeng.hxx"
-#include "AccessibleStringWrap.hxx"
-namespace binfilter {
-
-using namespace ::com::sun::star;
-
-
-class SvxAccessibleTextIndex
-{
-public:
- SvxAccessibleTextIndex() :
- mnPara(0),
- mnIndex(0),
- mnEEIndex(0),
- mnFieldOffset(0),
- mnFieldLen(0),
- mbInField(sal_False),
- mnBulletOffset(0),
- mnBulletLen(0),
- mbInBullet(sal_False) {};
- ~SvxAccessibleTextIndex() {};
-
- // Get/Set current paragraph
- void SetParagraph( USHORT nPara )
- {
- mnPara = nPara;
- }
- USHORT GetParagraph() const { return mnPara; }
-
- /** Set the index in the UAA semantic
-
- @param nIndex
- The index from the UA API (fields and bullets are expanded)
-
- @param rTF
- The text forwarder to use in the calculations
- */
- void SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF );
- void SetIndex( USHORT nPara, sal_Int32 nIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetIndex(nIndex, rTF); }
- sal_Int32 GetIndex() const { return mnIndex; }
-
- /** Set the index in the edit engine semantic
-
- Update the object state to reflect the given index position in
- EditEngine/Outliner index values
-
- @param nEEIndex
- The index from the edit engine (fields span exactly one index increment)
-
- @param rTF
- The text forwarder to use in the calculations
- */
- void SetEEIndex( USHORT nEEIndex, const SvxTextForwarder& rTF );
- void SetEEIndex( USHORT nPara, USHORT nEEIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetEEIndex(nEEIndex, rTF); }
- USHORT GetEEIndex() const;
-
- void SetFieldOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnFieldOffset = nOffset; mnFieldLen = nLen; }
- sal_Int32 GetFieldOffset() const { return mnFieldOffset; }
- sal_Int32 GetFieldLen() const { return mnFieldLen; }
- void AreInField( sal_Bool bInField = sal_True ) { mbInField = bInField; }
- sal_Bool InField() const { return mbInField; }
-
- void SetBulletOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnBulletOffset = nOffset; mnBulletLen = nLen; }
- sal_Int32 GetBulletOffset() const { return mnBulletOffset; }
- sal_Int32 GetBulletLen() const { return mnBulletLen; }
- void AreInBullet( sal_Bool bInBullet = sal_True ) { mbInBullet = bInBullet; }
- sal_Bool InBullet() const { return mbInBullet; }
-
- /// returns false if the given range is non-editable (e.g. contains bullets or _parts_ of fields)
- sal_Bool IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const;
-
-private:
- USHORT mnPara;
- sal_Int32 mnIndex;
- sal_Int32 mnEEIndex;
- sal_Int32 mnFieldOffset;
- sal_Int32 mnFieldLen;
- sal_Bool mbInField;
- sal_Int32 mnBulletOffset;
- sal_Int32 mnBulletLen;
- sal_Bool mbInBullet;
-};
-
-ESelection MakeEESelection( const SvxAccessibleTextIndex& rStart, const SvxAccessibleTextIndex& rEnd )
-{
- // deal with field special case: to really get a field contained
- // within a selection, the start index must be before or on the
- // field, the end index after it.
-
- // The SvxAccessibleTextIndex.GetEEIndex method gives the index on
- // the field, as long the input index is on the field. Thus,
- // correction necessary for the end index
-
- // Therefore, for _ranges_, if part of the field is touched, all
- // of the field must be selected
- if( rStart.GetParagraph() <= rEnd.GetParagraph() ||
- (rStart.GetParagraph() == rEnd.GetParagraph() &&
- rStart.GetEEIndex() <= rEnd.GetEEIndex()) )
- {
- if( rEnd.InField() && rEnd.GetFieldOffset() )
- return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
- rEnd.GetParagraph(), rEnd.GetEEIndex()+1 );
- }
- else if( rStart.GetParagraph() > rEnd.GetParagraph() ||
- (rStart.GetParagraph() == rEnd.GetParagraph() &&
- rStart.GetEEIndex() > rEnd.GetEEIndex()) )
- {
- if( rStart.InField() && rStart.GetFieldOffset() )
- return ESelection( rStart.GetParagraph(), rStart.GetEEIndex()+1,
- rEnd.GetParagraph(), rEnd.GetEEIndex() );
- }
-
- return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
- rEnd.GetParagraph(), rEnd.GetEEIndex() );
-}
-
-ESelection MakeEESelection( const SvxAccessibleTextIndex& rIndex )
-{
- return ESelection( rIndex.GetParagraph(), rIndex.GetEEIndex(),
- rIndex.GetParagraph(), rIndex.GetEEIndex() + 1 );
-}
-
-USHORT SvxAccessibleTextIndex::GetEEIndex() const
-{
- DBG_ASSERT(mnEEIndex >= 0 && mnEEIndex <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetEEIndex: index value overflow");
-
- return static_cast< USHORT > (mnEEIndex);
-}
-
-void SvxAccessibleTextIndex::SetEEIndex( USHORT nEEIndex, const SvxTextForwarder& rTF )
-{
- // reset
- mnFieldOffset = 0;
- mbInField = sal_False;
- mnFieldLen = 0;
- mnBulletOffset = 0;
- mbInBullet = sal_False;
- mnBulletLen = 0;
-
- // set known values
- mnEEIndex = nEEIndex;
-
- // calculate unknowns
- USHORT nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
-
- mnIndex = nEEIndex;
-
- EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
-
- // any text bullets?
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType != SVX_NUM_BITMAP )
- {
- mnIndex += aBulletInfo.aText.Len();
- }
-
- for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
- {
- EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
-
- if( aFieldInfo.aPosition.nIndex > nEEIndex )
- break;
-
- if( aFieldInfo.aPosition.nIndex == nEEIndex )
- {
- AreInField();
- break;
- }
-
- // #106010#
- mnIndex += ::std::max(aFieldInfo.aCurrentText.Len()-1, 0);
- }
-}
-
-void SvxAccessibleTextIndex::SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF )
-{
- // reset
- mnFieldOffset = 0;
- mbInField = sal_False;
- mnFieldLen = 0;
- mnBulletOffset = 0;
- mbInBullet = sal_False;
- mnBulletLen = 0;
-
- // set known values
- mnIndex = nIndex;
-
- // calculate unknowns
- USHORT nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
-
- DBG_ASSERT(nIndex >= 0 && nIndex <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- mnEEIndex = nIndex;
-
- EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
-
- // any text bullets?
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType != SVX_NUM_BITMAP )
- {
- sal_Int32 nBulletLen = aBulletInfo.aText.Len();
-
- if( nIndex < nBulletLen )
- {
- AreInBullet();
- SetBulletOffset( nIndex, nBulletLen );
- mnEEIndex = 0;
- return;
- }
-
- mnEEIndex = mnEEIndex - nBulletLen;
- }
-
- for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
- {
- EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
-
- // we're before a field
- if( aFieldInfo.aPosition.nIndex > mnEEIndex )
- break;
-
- // #106010#
- mnEEIndex -= ::std::max(aFieldInfo.aCurrentText.Len()-1, 0);
-
- // we're within a field
- if( aFieldInfo.aPosition.nIndex >= mnEEIndex )
- {
- AreInField();
- SetFieldOffset( ::std::max(aFieldInfo.aCurrentText.Len()-1, 0) - (aFieldInfo.aPosition.nIndex - mnEEIndex),
- aFieldInfo.aCurrentText.Len() );
- mnEEIndex = aFieldInfo.aPosition.nIndex ;
- break;
- }
- }
-}
-
-sal_Bool SvxAccessibleTextIndex::IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const
-{
- if( GetIndex() > rEnd.GetIndex() )
- return rEnd.IsEditableRange( *this );
-
- if( InBullet() || rEnd.InBullet() )
- return sal_False;
-
- if( InField() && GetFieldOffset() )
- return sal_False; // within field
-
- if( rEnd.InField() && rEnd.GetFieldOffset() >= rEnd.GetFieldLen() - 1 )
- return sal_False; // within field
-
- return sal_True;
-}
-
-//---------------------------------------------------------------------------------
-
-SvxEditSourceAdapter::SvxEditSourceAdapter() : mbEditSourceValid( sal_False )
-{
-}
-
-SvxEditSourceAdapter::~SvxEditSourceAdapter()
-{
-}
-
-SvxEditSource* SvxEditSourceAdapter::Clone() const
-{
- if( mbEditSourceValid && mpAdaptee.get() )
- {
- ::std::auto_ptr< SvxEditSource > pClonedAdaptee( mpAdaptee->Clone() );
-
- if( pClonedAdaptee.get() )
- {
- SvxEditSourceAdapter* pClone = new SvxEditSourceAdapter();
-
- if( pClone )
- {
- pClone->SetEditSource( pClonedAdaptee );
- return pClone;
- }
- }
- }
-
- return NULL;
-}
-
-SvxAccessibleTextAdapter* SvxEditSourceAdapter::GetTextForwarderAdapter()
-{
- if( mbEditSourceValid && mpAdaptee.get() )
- {
- SvxTextForwarder* pTextForwarder = mpAdaptee->GetTextForwarder();
-
- if( pTextForwarder )
- {
- maTextAdapter.SetForwarder(*pTextForwarder);
-
- return &maTextAdapter;
- }
- }
-
- return NULL;
-}
-
-SvxTextForwarder* SvxEditSourceAdapter::GetTextForwarder()
-{
- return GetTextForwarderAdapter();
-}
-
-SvxViewForwarder* SvxEditSourceAdapter::GetViewForwarder()
-{
- if( mbEditSourceValid && mpAdaptee.get() )
- return mpAdaptee->GetViewForwarder();
-
- return NULL;
-}
-
-SvxAccessibleTextEditViewAdapter* SvxEditSourceAdapter::GetEditViewForwarderAdapter( sal_Bool bCreate )
-{
- if( mbEditSourceValid && mpAdaptee.get() )
- {
- SvxEditViewForwarder* pEditViewForwarder = mpAdaptee->GetEditViewForwarder(bCreate);
-
- if( pEditViewForwarder )
- {
- SvxAccessibleTextAdapter* pTextAdapter = GetTextForwarderAdapter();
-
- if( pTextAdapter )
- {
- maEditViewAdapter.SetForwarder(*pEditViewForwarder, *pTextAdapter);
-
- return &maEditViewAdapter;
- }
- }
- }
-
- return NULL;
-}
-
-SvxEditViewForwarder* SvxEditSourceAdapter::GetEditViewForwarder( sal_Bool bCreate )
-{
- return GetEditViewForwarderAdapter( bCreate );
-}
-
-void SvxEditSourceAdapter::UpdateData()
-{
- if( mbEditSourceValid && mpAdaptee.get() )
- mpAdaptee->UpdateData();
-}
-
-SfxBroadcaster& SvxEditSourceAdapter::GetBroadcaster() const
-{
- if( mbEditSourceValid && mpAdaptee.get() )
- return mpAdaptee->GetBroadcaster();
-
- return maDummyBroadcaster;
-}
-
-void SvxEditSourceAdapter::SetEditSource( ::std::auto_ptr< SvxEditSource > pAdaptee )
-{
- if( pAdaptee.get() )
- {
- mpAdaptee = pAdaptee;
- mbEditSourceValid = sal_True;
- }
- else
- {
- // do a lazy delete (prevents us from deleting the broadcaster
- // from within a broadcast in
- // AccessibleTextHelper_Impl::Notify)
- mbEditSourceValid = sal_False;
- }
-}
-
-//--------------------------------------------------------------------------------------
-
-SvxAccessibleTextAdapter::SvxAccessibleTextAdapter() : mrTextForwarder( NULL )
-{
-}
-
-SvxAccessibleTextAdapter::~SvxAccessibleTextAdapter()
-{
-}
-
-USHORT SvxAccessibleTextAdapter::GetParagraphCount() const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetParagraphCount();
-}
-
-USHORT SvxAccessibleTextAdapter::GetTextLen( USHORT nParagraph ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aIndex;
- aIndex.SetEEIndex( nParagraph, mrTextForwarder->GetTextLen( nParagraph ), *this );
-
- return static_cast< USHORT >(aIndex.GetIndex());
-}
-
-String SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- // normalize selection
- if( rSel.nStartPara > rSel.nEndPara ||
- (rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) )
- {
- ::std::swap( aStartIndex, aEndIndex );
- }
-
- String sStr = mrTextForwarder->GetText( MakeEESelection(aStartIndex, aEndIndex) );
-
- // trim field text, if necessary
- if( aStartIndex.InField() )
- {
- DBG_ASSERT(aStartIndex.GetFieldOffset() >= 0 &&
- aStartIndex.GetFieldOffset() <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetText: index value overflow");
-
- sStr.Erase(0, static_cast< USHORT > (aStartIndex.GetFieldOffset()) );
- }
- if( aEndIndex.InField() && aEndIndex.GetFieldOffset() )
- {
- DBG_ASSERT(sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) >= 0 &&
- sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetText: index value overflow");
-
- sStr = sStr.Copy(0, static_cast< USHORT > (sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset())) );
- }
-
- EBulletInfo aBulletInfo1 = GetBulletInfo( static_cast< USHORT >(aStartIndex.GetParagraph()) );
- EBulletInfo aBulletInfo2 = GetBulletInfo( static_cast< USHORT >(aEndIndex.GetParagraph()) );
-
- if( aStartIndex.InBullet() )
- {
- // prepend leading bullet
- String sBullet = aBulletInfo1.aText;
-
- DBG_ASSERT(aStartIndex.GetBulletOffset() >= 0 &&
- aStartIndex.GetBulletOffset() <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetText: index value overflow");
-
- sBullet.Erase(0, static_cast< USHORT > (aStartIndex.GetBulletOffset()) );
-
- sBullet += sStr;
- sStr = sBullet;
- }
-
- if( aEndIndex.InBullet() )
- {
- // append trailing bullet
- sStr += aBulletInfo2.aText;;
-
- DBG_ASSERT(sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
- sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetText: index value overflow");
-
- sStr = sStr.Copy(0, static_cast< USHORT > (sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) );
- }
- else if( aStartIndex.GetParagraph() != aEndIndex.GetParagraph() &&
- HaveTextBullet( aEndIndex.GetParagraph() ) )
- {
- String sBullet = aBulletInfo2.aText;
-
- DBG_ASSERT(sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
- sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetText: index value overflow");
-
- sBullet = sBullet.Copy(0, static_cast< USHORT > (sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) );
-
- // insert bullet
- sStr.Insert( sBullet,
- static_cast< USHORT > (GetTextLen(aStartIndex.GetParagraph()) - aStartIndex.GetIndex()) );
- }
-
- return sStr;
-}
-
-SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- return mrTextForwarder->GetAttribs( MakeEESelection(aStartIndex, aEndIndex),
- bOnlyHardAttrib );
-}
-
-SfxItemSet SvxAccessibleTextAdapter::GetParaAttribs( USHORT nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetParaAttribs( nPara );
-}
-
-void SvxAccessibleTextAdapter::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- mrTextForwarder->SetParaAttribs( nPara, rSet );
-}
-
-void SvxAccessibleTextAdapter::GetPortions( USHORT nPara, SvUShorts& rList ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- mrTextForwarder->GetPortions( nPara, rList );
-}
-
-USHORT SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, USHORT nWhich ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- return mrTextForwarder->GetItemState( MakeEESelection(aStartIndex, aEndIndex),
- nWhich );
-}
-
-USHORT SvxAccessibleTextAdapter::GetItemState( USHORT nPara, USHORT nWhich ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetItemState( nPara, nWhich );
-}
-
-void SvxAccessibleTextAdapter::QuickInsertText( const String& rText, const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- mrTextForwarder->QuickInsertText( rText,
- MakeEESelection(aStartIndex, aEndIndex) );
-}
-
-void SvxAccessibleTextAdapter::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- mrTextForwarder->QuickInsertField( rFld,
- MakeEESelection(aStartIndex, aEndIndex) );
-}
-
-void SvxAccessibleTextAdapter::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- mrTextForwarder->QuickSetAttribs( rSet,
- MakeEESelection(aStartIndex, aEndIndex) );
-}
-
-void SvxAccessibleTextAdapter::QuickInsertLineBreak( const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- mrTextForwarder->QuickInsertLineBreak( MakeEESelection(aStartIndex, aEndIndex) );
-}
-
-SfxItemPool* SvxAccessibleTextAdapter::GetPool() const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetPool();
-}
-
-XubString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
-}
-
-BOOL SvxAccessibleTextAdapter::IsValid() const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- if( mrTextForwarder )
- return mrTextForwarder->IsValid();
- else
- return sal_False;
-}
-
-LanguageType SvxAccessibleTextAdapter::GetLanguage( USHORT nPara, USHORT nPos ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aIndex;
-
- aIndex.SetIndex( nPara, nPos, *this );
-
- return mrTextForwarder->GetLanguage( nPara, aIndex.GetEEIndex() );
-}
-
-USHORT SvxAccessibleTextAdapter::GetFieldCount( USHORT nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetFieldCount( nPara );
-}
-
-EFieldInfo SvxAccessibleTextAdapter::GetFieldInfo( USHORT nPara, USHORT nField ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetFieldInfo( nPara, nField );
-}
-
-EBulletInfo SvxAccessibleTextAdapter::GetBulletInfo( USHORT nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetBulletInfo( nPara );
-}
-
-Rectangle SvxAccessibleTextAdapter::GetCharBounds( USHORT nPara, USHORT nIndex ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aIndex;
- aIndex.SetIndex( nPara, nIndex, *this );
-
- // preset if anything goes wrong below
- // n-th char in GetParagraphIndex's paragraph
- Rectangle aRect = mrTextForwarder->GetCharBounds( nPara, static_cast< USHORT >( aIndex.GetEEIndex() ) );
-
- if( aIndex.InBullet() )
- {
- EBulletInfo aBulletInfo = GetBulletInfo( nPara );
-
- OutputDevice* pOutDev = GetRefDevice();
-
- DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetCharBounds: No ref device");
-
- // preset if anything goes wrong below
- aRect = aBulletInfo.aBounds; // better than nothing
- if( pOutDev )
- {
- AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
-
- if( aStringWrap.GetCharacterBounds( aIndex.GetBulletOffset(), aRect ) )
- aRect.Move( aBulletInfo.aBounds.Left(), aBulletInfo.aBounds.Top() );
- }
- }
- else
- {
- // handle field content manually
- if( aIndex.InField() )
- {
- OutputDevice* pOutDev = GetRefDevice();
-
- DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetCharBounds: No ref device");
-
- if( pOutDev )
- {
- ESelection aSel = MakeEESelection( aIndex );
-
- SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mrTextForwarder->GetAttribs( aSel ) );
- AccessibleStringWrap aStringWrap( *pOutDev,
- aFont,
- mrTextForwarder->GetText( aSel ) );
-
- Rectangle aStartRect = mrTextForwarder->GetCharBounds( nPara, static_cast< USHORT >( aIndex.GetEEIndex() ) );
-
- if( !aStringWrap.GetCharacterBounds( aIndex.GetFieldOffset(), aRect ) )
- aRect = aStartRect;
- else
- aRect.Move( aStartRect.Left(), aStartRect.Top() );
- }
- }
- }
-
- return aRect;
-}
-
-Rectangle SvxAccessibleTextAdapter::GetParaBounds( USHORT nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- EBulletInfo aBulletInfo = GetBulletInfo( nPara );
-
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType != SVX_NUM_BITMAP )
- {
- // include bullet in para bounding box
- Rectangle aRect( mrTextForwarder->GetParaBounds( nPara ) );
-
- aRect.Union( aBulletInfo.aBounds );
-
- return aRect;
- }
- else
- return mrTextForwarder->GetParaBounds( nPara );
-}
-
-MapMode SvxAccessibleTextAdapter::GetMapMode() const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetMapMode();
-}
-
-OutputDevice* SvxAccessibleTextAdapter::GetRefDevice() const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetRefDevice();
-}
-
-sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, USHORT& nPara, USHORT& nIndex ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- if( !mrTextForwarder->GetIndexAtPoint( rPoint, nPara, nIndex ) )
- return sal_False;
-
- SvxAccessibleTextIndex aIndex;
- aIndex.SetEEIndex(nPara, nIndex, *this);
-
- DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- nIndex = static_cast< USHORT > (aIndex.GetIndex());
-
- EBulletInfo aBulletInfo = GetBulletInfo( nPara );
-
- // any text bullets?
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType != SVX_NUM_BITMAP )
- {
- if( aBulletInfo.aBounds.IsInside( rPoint) )
- {
- OutputDevice* pOutDev = GetRefDevice();
-
- DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
-
- if( !pOutDev )
- return sal_False;
-
- AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
-
- Point aPoint = rPoint;
- aPoint.Move( -aBulletInfo.aBounds.Left(), -aBulletInfo.aBounds.Top() );
-
- DBG_ASSERT(aStringWrap.GetIndexAtPoint( aPoint ) >= 0 &&
- aStringWrap.GetIndexAtPoint( aPoint ) <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- nIndex = static_cast< USHORT > (aStringWrap.GetIndexAtPoint( aPoint ));
- return sal_True;
- }
- }
-
- if( aIndex.InField() )
- {
- OutputDevice* pOutDev = GetRefDevice();
-
- DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
-
- if( !pOutDev )
- return sal_False;
-
- ESelection aSelection = MakeEESelection( aIndex );
- SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mrTextForwarder->GetAttribs( aSelection ) );
- AccessibleStringWrap aStringWrap( *pOutDev,
- aFont,
- mrTextForwarder->GetText( aSelection ) );
-
- Rectangle aRect = mrTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
- Point aPoint = rPoint;
- aPoint.Move( -aRect.Left(), -aRect.Top() );
-
- DBG_ASSERT(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) >= 0 &&
- aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- nIndex = static_cast< USHORT >(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint ));
- return sal_True;
- }
-
- return sal_True;
-}
-
-sal_Bool SvxAccessibleTextAdapter::GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aIndex;
- aIndex.SetIndex(nPara, nIndex, *this);
- nIndex = aIndex.GetEEIndex();
-
- if( aIndex.InBullet() )
- {
- DBG_ASSERT(aIndex.GetBulletLen() >= 0 &&
- aIndex.GetBulletLen() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- // always treat bullet as separate word
- nStart = 0;
- nEnd = static_cast< USHORT > (aIndex.GetBulletLen());
-
- return sal_True;
- }
-
- if( aIndex.InField() )
- {
- DBG_ASSERT(aIndex.GetIndex() - aIndex.GetFieldOffset() >= 0 &&
- aIndex.GetIndex() - aIndex.GetFieldOffset() <= USHRT_MAX &&
- nStart + aIndex.GetFieldLen() >= 0 &&
- nStart + aIndex.GetFieldLen() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- // always treat field as separate word
- // TODO: to circumvent this, _we_ would have to do the break iterator stuff!
- nStart = static_cast< USHORT > (aIndex.GetIndex() - aIndex.GetFieldOffset());
- nEnd = static_cast< USHORT > (nStart + aIndex.GetFieldLen());
-
- return sal_True;
- }
-
- if( !mrTextForwarder->GetWordIndices( nPara, nIndex, nStart, nEnd ) )
- return sal_False;
-
- aIndex.SetEEIndex( nPara, nStart, *this );
- DBG_ASSERT(aIndex.GetIndex() >= 0 &&
- aIndex.GetIndex() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
- nStart = static_cast< USHORT > (aIndex.GetIndex());
-
- aIndex.SetEEIndex( nPara, nEnd, *this );
- DBG_ASSERT(aIndex.GetIndex() >= 0 &&
- aIndex.GetIndex() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
- nEnd = static_cast< USHORT > (aIndex.GetIndex());
-
- return sal_True;
-}
-
-sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aIndex;
- aIndex.SetIndex(nPara, nIndex, *this);
- nIndex = aIndex.GetEEIndex();
-
- if( aIndex.InBullet() )
- {
- DBG_ASSERT(aIndex.GetBulletLen() >= 0 &&
- aIndex.GetBulletLen() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- // always treat bullet as distinct attribute
- nStartIndex = 0;
- nEndIndex = static_cast< USHORT > (aIndex.GetBulletLen());
-
- return sal_True;
- }
-
- if( aIndex.InField() )
- {
- DBG_ASSERT(aIndex.GetIndex() - aIndex.GetFieldOffset() >= 0 &&
- aIndex.GetIndex() - aIndex.GetFieldOffset() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
-
- // always treat field as distinct attribute
- nStartIndex = static_cast< USHORT > (aIndex.GetIndex() - aIndex.GetFieldOffset());
- nEndIndex = static_cast< USHORT > (nStartIndex + aIndex.GetFieldLen());
-
- return sal_True;
- }
-
- if( !mrTextForwarder->GetAttributeRun( nStartIndex, nEndIndex, nPara, nIndex ) )
- return sal_False;
-
- aIndex.SetEEIndex( nPara, nStartIndex, *this );
- DBG_ASSERT(aIndex.GetIndex() >= 0 &&
- aIndex.GetIndex() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
- nStartIndex = static_cast< USHORT > (aIndex.GetIndex());
-
- aIndex.SetEEIndex( nPara, nEndIndex, *this );
- DBG_ASSERT(aIndex.GetIndex() >= 0 &&
- aIndex.GetIndex() <= USHRT_MAX,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
- nEndIndex = static_cast< USHORT > (aIndex.GetIndex());
-
- return sal_True;
-}
-
-USHORT SvxAccessibleTextAdapter::GetLineCount( USHORT nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetLineCount( nPara );
-}
-
-USHORT SvxAccessibleTextAdapter::GetLineLen( USHORT nPara, USHORT nLine ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
- USHORT nCurrLine;
- USHORT nCurrIndex, nLastIndex;
- for( nCurrLine=0, nCurrIndex=0, nLastIndex=0; nCurrLine<=nLine; ++nCurrLine )
- {
- nLastIndex = nCurrIndex;
- nCurrIndex += mrTextForwarder->GetLineLen( nPara, nCurrLine );
- }
-
- aEndIndex.SetEEIndex( nPara, nCurrIndex, *this );
- if( nLine > 0 )
- {
- aStartIndex.SetEEIndex( nPara, nLastIndex, *this );
-
- return static_cast< USHORT >(aEndIndex.GetIndex() - aStartIndex.GetIndex());
- }
- else
- return static_cast< USHORT >(aEndIndex.GetIndex());
-}
-
-sal_Bool SvxAccessibleTextAdapter::Delete( const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- return mrTextForwarder->Delete( MakeEESelection(aStartIndex, aEndIndex ) );
-}
-
-sal_Bool SvxAccessibleTextAdapter::InsertText( const String& rStr, const ESelection& rSel )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
-
- return mrTextForwarder->InsertText( rStr, MakeEESelection(aStartIndex, aEndIndex) );
-}
-
-sal_Bool SvxAccessibleTextAdapter::QuickFormatDoc( BOOL bFull )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->QuickFormatDoc( bFull );
-}
-
-USHORT SvxAccessibleTextAdapter::GetDepth( USHORT nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->GetDepth( nPara );
-}
-
-sal_Bool SvxAccessibleTextAdapter::SetDepth( USHORT nPara, USHORT nNewDepth )
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- return mrTextForwarder->SetDepth( nPara, nNewDepth );
-}
-
-void SvxAccessibleTextAdapter::SetForwarder( SvxTextForwarder& rForwarder )
-{
- mrTextForwarder = &rForwarder;
-}
-
-sal_Bool SvxAccessibleTextAdapter::HaveTextBullet( USHORT nPara ) const
-{
- DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
-
- EBulletInfo aBulletInfo = GetBulletInfo( nPara );
-
- if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
- aBulletInfo.bVisible &&
- aBulletInfo.nType != SVX_NUM_BITMAP )
- {
- return sal_True;
- }
- else
- {
- return sal_False;
- }
-}
-
-//---------------------------------------------------------------------------------------
-
-SvxAccessibleTextEditViewAdapter::SvxAccessibleTextEditViewAdapter()
-{
-}
-
-SvxAccessibleTextEditViewAdapter::~SvxAccessibleTextEditViewAdapter()
-{
-}
-
-BOOL SvxAccessibleTextEditViewAdapter::IsValid() const
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- if( mrViewForwarder )
- return mrViewForwarder->IsValid();
- else
- return sal_False;
-}
-
-Rectangle SvxAccessibleTextEditViewAdapter::GetVisArea() const
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- return mrViewForwarder->GetVisArea();
-}
-
-Point SvxAccessibleTextEditViewAdapter::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- return mrViewForwarder->LogicToPixel(rPoint, rMapMode);
-}
-
-Point SvxAccessibleTextEditViewAdapter::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- return mrViewForwarder->PixelToLogic(rPoint, rMapMode);
-}
-
-sal_Bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) const
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- ESelection aSelection;
-
- if( !mrViewForwarder->GetSelection( aSelection ) )
- return sal_False;
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetEEIndex( aSelection.nStartPara, aSelection.nStartPos, *mrTextForwarder );
- aEndIndex.SetEEIndex( aSelection.nEndPara, aSelection.nEndPos, *mrTextForwarder );
-
- DBG_ASSERT(aStartIndex.GetIndex() >= 0 && aStartIndex.GetIndex() <= USHRT_MAX &&
- aEndIndex.GetIndex() >= 0 && aEndIndex.GetIndex() <= USHRT_MAX,
- "SvxAccessibleTextEditViewAdapter::GetSelection: index value overflow");
-
- rSel = ESelection( aStartIndex.GetParagraph(), static_cast< USHORT > (aStartIndex.GetIndex()),
- aEndIndex.GetParagraph(), static_cast< USHORT > (aEndIndex.GetIndex()) );
-
- return sal_True;
-}
-
-sal_Bool SvxAccessibleTextEditViewAdapter::SetSelection( const ESelection& rSel )
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- SvxAccessibleTextIndex aStartIndex;
- SvxAccessibleTextIndex aEndIndex;
-
- aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *mrTextForwarder );
- aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *mrTextForwarder );
-
- return mrViewForwarder->SetSelection( MakeEESelection(aStartIndex, aEndIndex) );
-}
-
-sal_Bool SvxAccessibleTextEditViewAdapter::Copy()
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- return mrViewForwarder->Copy();
-}
-
-sal_Bool SvxAccessibleTextEditViewAdapter::Cut()
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- return mrViewForwarder->Cut();
-}
-
-sal_Bool SvxAccessibleTextEditViewAdapter::Paste()
-{
- DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
-
- return mrViewForwarder->Paste();
-}
-
-void SvxAccessibleTextEditViewAdapter::SetForwarder( SvxEditViewForwarder& rForwarder,
- SvxAccessibleTextAdapter& rTextForwarder )
-{
- mrViewForwarder = &rForwarder;
- mrTextForwarder = &rTextForwarder;
-}
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/unoedit/svx_unoedsrc.cxx b/binfilter/bf_svx/source/unoedit/svx_unoedsrc.cxx
deleted file mode 100644
index 9f92ec102d3e..000000000000
--- a/binfilter/bf_svx/source/unoedit/svx_unoedsrc.cxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#ifdef _MSC_VER
-#pragma hdrstop
-#endif
-
-#include <bf_svtools/brdcst.hxx>
-
-#include "unoedsrc.hxx"
-namespace binfilter {
-
-//------------------------------------------------------------------------
-
-SvxTextForwarder::~SvxTextForwarder()
-{
-}
-
-//------------------------------------------------------------------------
-
-SvxViewForwarder::~SvxViewForwarder()
-{
-}
-
-//------------------------------------------------------------------------
-
-SvxEditSource::~SvxEditSource()
-{
-}
-
-SvxViewForwarder* SvxEditSource::GetViewForwarder()
-{
- return NULL;
-}
-
-SvxEditViewForwarder* SvxEditSource::GetEditViewForwarder( sal_Bool bCreate )
-{
- return NULL;
-}
-
-SfxBroadcaster& SvxEditSource::GetBroadcaster() const
-{
- DBG_ERROR("SvxEditSource::GetBroadcaster called for implementation missing this feature!");
-
- static SfxBroadcaster aBroadcaster;
-
- return aBroadcaster;
-}
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/unoedit/svx_unofield.cxx b/binfilter/bf_svx/source/unoedit/svx_unofield.cxx
deleted file mode 100644
index 1e1b97dfbac4..000000000000
--- a/binfilter/bf_svx/source/unoedit/svx_unofield.cxx
+++ /dev/null
@@ -1,1075 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#include <com/sun/star/util/DateTime.hpp>
-
-#include <com/sun/star/text/FilenameDisplayFormat.hpp>
-
-
-#include <vcl/svapp.hxx>
-#include <osl/mutex.hxx>
-
-#include <rtl/uuid.h>
-#include <rtl/memory.h>
-
-#include "eeitem.hxx"
-#define ITEMID_FIELD EE_FEATURE_FIELD
-
-
-#include <bf_svtools/poolitem.hxx>
-
-#include <bf_svx/itemdata.hxx>
-
-#include "svdfield.hxx"
-#include "unofield.hxx"
-#include "unotext.hxx"
-#include "adritem.hxx"
-namespace binfilter {
-
-using namespace ::rtl;
-using namespace ::cppu;
-using namespace ::com::sun::star;
-
-#define QUERYINT( xint ) \
- if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
- aAny <<= uno::Reference< xint >(this)
-
-
-#define WID_DATE 0
-#define WID_BOOL1 1
-#define WID_BOOL2 2
-#define WID_INT32 3
-#define WID_INT16 4
-#define WID_STRING1 5
-#define WID_STRING2 6
-#define WID_STRING3 7
-
-class SvxUnoFieldData_Impl
-{
-public:
- sal_Bool mbBoolean1;
- sal_Bool mbBoolean2;
- sal_Int32 mnInt32;
- sal_Int16 mnInt16;
- OUString msString1;
- OUString msString2;
- OUString msString3;
- util::DateTime maDateTime;
-
- OUString msPresentation;
-};
-
-SfxItemPropertyMap* ImplGetFieldItemPropertyMap( sal_Int32 mnId )
-{
- static SfxItemPropertyMap aExDateTimeFieldPropertyMap_Impl[] =
- {
- { MAP_CHAR_LEN("DateTime"), WID_DATE, &::getCppuType((const util::DateTime*)0), 0, 0 },
- { MAP_CHAR_LEN("IsFixed"), WID_BOOL1, &::getBooleanCppuType(), 0, 0 },
- { MAP_CHAR_LEN("IsDate"), WID_BOOL2, &::getBooleanCppuType(), 0, 0 },
- { MAP_CHAR_LEN("NumberFormat"), WID_INT32, &::getCppuType((const sal_Int16*)0), 0, 0 },
- {0,0}
- };
-
- static SfxItemPropertyMap aDateTimeFieldPropertyMap_Impl[] =
- {
- { MAP_CHAR_LEN("IsDate"), WID_BOOL2, &::getBooleanCppuType(), 0, 0 },
- {0,0}
- };
-
- static SfxItemPropertyMap aUrlFieldPropertyMap_Impl[] =
- {
-
- { MAP_CHAR_LEN("Format"), WID_INT16, &::getCppuType((const sal_Int16*)0), 0, 0 },
- { MAP_CHAR_LEN("Representation"), WID_STRING1, &::getCppuType((const OUString*)0), 0, 0 },
- { MAP_CHAR_LEN("TargetFrame"), WID_STRING2, &::getCppuType((const OUString*)0), 0, 0 },
- { MAP_CHAR_LEN("URL"), WID_STRING3, &::getCppuType((const OUString*)0), 0, 0 },
- {0,0}
- };
-
- static SfxItemPropertyMap aEmptyPropertyMap_Impl[] =
- {
- {0,0}
- };
-
- static SfxItemPropertyMap aExtFileFieldPropertyMap_Impl[] =
- {
- { MAP_CHAR_LEN("IsFixed"), WID_BOOL1, &::getBooleanCppuType(), 0, 0 },
- { MAP_CHAR_LEN("FileFormat"), WID_INT16, &::getCppuType((const sal_Int16*)0), 0, 0 },
- { MAP_CHAR_LEN("CurrentPresentation"), WID_STRING1,&::getCppuType((const OUString*)0), 0, 0 },
- {0,0}
- };
-
- static SfxItemPropertyMap aAuthorFieldPropertyMap_Impl[] =
- {
- { MAP_CHAR_LEN("IsFixed"), WID_BOOL1, &::getBooleanCppuType(), 0, 0 },
- { MAP_CHAR_LEN("CurrentPresentation"), WID_STRING1,&::getCppuType((const OUString*)0), 0, 0 },
- { MAP_CHAR_LEN("Content"), WID_STRING2,&::getCppuType((const OUString*)0), 0, 0 },
- { MAP_CHAR_LEN("AuthorFormat"), WID_INT16, &::getCppuType((const sal_Int16*)0), 0, 0 },
- { MAP_CHAR_LEN("FullName"), WID_BOOL2, &::getBooleanCppuType(), 0, 0 },
- {0,0}
- };
-
- static SfxItemPropertyMap aMeasureFieldPropertyMap_Impl[] =
- {
- { MAP_CHAR_LEN("Kind"), WID_INT16, &::getCppuType((const sal_Int16*)0), 0, 0 },
- {0,0}
- };
-
- switch( mnId )
- {
- case ID_EXT_DATEFIELD:
- case ID_EXT_TIMEFIELD:
- return aExDateTimeFieldPropertyMap_Impl;
- case ID_URLFIELD:
- return aUrlFieldPropertyMap_Impl;
- case ID_DATEFIELD:
- case ID_TIMEFIELD:
- return aDateTimeFieldPropertyMap_Impl;
- case ID_EXT_FILEFIELD:
- return aExtFileFieldPropertyMap_Impl;
- case ID_AUTHORFIELD:
- return aAuthorFieldPropertyMap_Impl;
- case ID_MEASUREFIELD:
- return aMeasureFieldPropertyMap_Impl;
-// case ID_PAGEFIELD:
-// case ID_PAGESFIELD:
-// case ID_FILEFIELD:
-// case ID_TABLEFIELD:
- default:
- return aEmptyPropertyMap_Impl;
- }
-}
-
-static SfxItemPropertyMap aEmptyPropertyMap_Impl[] =
-{
- {0,0}
-};
-
-static sal_Char* aFieldItemNameMap_Impl[] =
-{
- "Date",
- "URL",
- "Page",
- "Pages",
- "Time",
- "File",
- "Table",
- "ExtTime",
- "ExtFile",
- "Author",
- "Measure",
- "ExtDate",
- "Unknown"
-};
-
-/* conversion routines */
-
-static sal_Int16 getFileNameDisplayFormat( SvxFileFormat nFormat )
-{
- switch( nFormat )
- {
- case SVXFILEFORMAT_NAME_EXT: return text::FilenameDisplayFormat::NAME_AND_EXT;
- case SVXFILEFORMAT_FULLPATH: return text::FilenameDisplayFormat::FULL;
- case SVXFILEFORMAT_PATH: return text::FilenameDisplayFormat::PATH;
-// case SVXFILEFORMAT_NAME:
- default: return text::FilenameDisplayFormat::NAME;
- }
-}
-
-static SvxFileFormat setFileNameDisplayFormat( sal_Int16 nFormat )
-{
- switch( nFormat )
- {
- case text::FilenameDisplayFormat::FULL: return SVXFILEFORMAT_FULLPATH;
- case text::FilenameDisplayFormat::PATH: return SVXFILEFORMAT_PATH;
- case text::FilenameDisplayFormat::NAME: return SVXFILEFORMAT_NAME;
-// case text::FilenameDisplayFormat::NAME_AND_EXT:
- default:
- return SVXFILEFORMAT_NAME_EXT;
- }
-}
-
-static util::DateTime getDate( ULONG nDate )
-{
- util::DateTime aDate;
- memset( &aDate, 0, sizeof( util::DateTime ) );
-
- Date aTempDate( nDate );
-
- aDate.Day = aTempDate.GetDay();
- aDate.Month = aTempDate.GetMonth();
- aDate.Year = aTempDate.GetYear();
-
- return aDate;
-}
-
-inline Date setDate( util::DateTime& rDate )
-{
- return Date( rDate.Day, rDate.Month, rDate.Year );
-}
-
-static util::DateTime getTime( long nTime )
-{
- util::DateTime aTime;
- memset( &aTime, 0, sizeof( util::DateTime ) );
-
- Time aTempTime( nTime );
-
- aTime.HundredthSeconds = aTempTime.Get100Sec();
- aTime.Seconds = aTempTime.GetSec();
- aTime.Minutes = aTempTime.GetMin();
- aTime.Hours = aTempTime.GetHour();
-
- return aTime;
-}
-
-inline Time setTime( util::DateTime& rDate )
-{
- return Time( rDate.Hours, rDate.Minutes, rDate.Seconds, rDate.HundredthSeconds );
-}
-
-// ====================================================================
-// class SvxUnoTextField
-// ====================================================================
-UNO3_GETIMPLEMENTATION_IMPL( SvxUnoTextField );
-
-SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) throw()
-: OComponentHelper( getMutex() ),
- mpPropSet(NULL),
- mpImpl( new SvxUnoFieldData_Impl ),
- mnServiceId(nServiceId)
-{
- mpPropSet = new SfxItemPropertySet( ImplGetFieldItemPropertyMap(mnServiceId) );
-
- memset( &(mpImpl->maDateTime), 0, sizeof( util::DateTime ) );
-
- switch( nServiceId )
- {
- case ID_EXT_DATEFIELD:
- case ID_DATEFIELD:
- mpImpl->mbBoolean2 = sal_True;
- mpImpl->mnInt32 = SVXDATEFORMAT_STDSMALL;
- mpImpl->mbBoolean1 = sal_False;
- break;
-
- case ID_EXT_TIMEFIELD:
- case ID_TIMEFIELD:
- mpImpl->mbBoolean2 = sal_False;
- mpImpl->mbBoolean1 = sal_False;
- mpImpl->mnInt32 = SVXTIMEFORMAT_STANDARD;
- break;
-
- case ID_URLFIELD:
- mpImpl->mnInt16 = SVXURLFORMAT_REPR;
- break;
-
- case ID_EXT_FILEFIELD:
- mpImpl->mbBoolean1 = sal_False;
- mpImpl->mnInt16 = text::FilenameDisplayFormat::FULL;
- break;
-
- case ID_AUTHORFIELD:
- mpImpl->mnInt16 = SVXAUTHORFORMAT_FULLNAME;
- mpImpl->mbBoolean1 = sal_False;
- mpImpl->mbBoolean2 = sal_True;
- break;
-
- case ID_MEASUREFIELD:
- mpImpl->mnInt16 = SDRMEASUREFIELD_VALUE;
- break;
-
- default:
- mpImpl->mbBoolean1 = sal_False;
- mpImpl->mbBoolean2 = sal_False;
- mpImpl->mnInt32 = 0;
- mpImpl->mnInt16 = 0;
-
- }
-}
-
-SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, const OUString& rPresentation, const SvxFieldData* pData ) throw()
-: OComponentHelper( getMutex() ),
- mxAnchor( xAnchor ),
- mpPropSet(NULL),
- mpImpl( new SvxUnoFieldData_Impl ),
- mnServiceId(ID_UNKNOWN)
-{
- DBG_ASSERT(pData, "pFieldData == NULL! [CL]" );
-
- mpImpl->msPresentation = rPresentation;
-
- if(pData)
- {
- mnServiceId = GetFieldId(pData);
- DBG_ASSERT(mnServiceId != ID_UNKNOWN, "unknown SvxFieldData! [CL]");
- if(mnServiceId != ID_UNKNOWN)
- {
- // extract field properties from data class
- switch( mnServiceId )
- {
- case ID_DATEFIELD:
- case ID_EXT_DATEFIELD:
- mpImpl->mbBoolean2 = sal_True;
- mpImpl->maDateTime = getDate( ((SvxDateField*)pData)->GetFixDate() );
- mpImpl->mnInt32 = ((SvxDateField*)pData)->GetFormat();
- mpImpl->mbBoolean1 = ((SvxDateField*)pData)->GetType() == SVXDATETYPE_FIX;
- break;
-
- case ID_TIMEFIELD:
- mpImpl->mbBoolean2 = sal_False;
- mpImpl->mbBoolean1 = sal_False;
- mpImpl->mnInt32 = SVXTIMEFORMAT_STANDARD;
- break;
-
- case ID_EXT_TIMEFIELD:
- mpImpl->mbBoolean2 = sal_False;
- mpImpl->maDateTime = getTime( ((SvxExtTimeField*)pData)->GetFixTime() );
- mpImpl->mbBoolean1 = ((SvxExtTimeField*)pData)->GetType() == SVXTIMETYPE_FIX;
- mpImpl->mnInt32 = ((SvxExtTimeField*)pData)->GetFormat();
- break;
-
- case ID_URLFIELD:
- mpImpl->msString1 = ((SvxURLField*)pData)->GetRepresentation();
- mpImpl->msString2 = ((SvxURLField*)pData)->GetTargetFrame();
- mpImpl->msString3 = ((SvxURLField*)pData)->GetURL();
- mpImpl->mnInt16 = ((SvxURLField*)pData)->GetFormat();
- break;
-
- case ID_EXT_FILEFIELD:
- mpImpl->msString1 = ((SvxExtFileField*)pData)->GetFile();
- mpImpl->mbBoolean1 = ((SvxExtFileField*)pData)->GetType() == SVXFILETYPE_FIX;
- mpImpl->mnInt16 = getFileNameDisplayFormat(((SvxExtFileField*)pData)->GetFormat());
- break;
-
- case ID_AUTHORFIELD:
- mpImpl->msString1 = ((SvxAuthorField*)pData)->GetFormatted();
- mpImpl->msString2 = ((SvxAuthorField*)pData)->GetFormatted();
- mpImpl->mnInt16 = ((SvxAuthorField*)pData)->GetFormat();
- mpImpl->mbBoolean1 = ((SvxAuthorField*)pData)->GetType() == SVXAUTHORTYPE_FIX;
- mpImpl->mbBoolean2 = ((SvxAuthorField*)pData)->GetType() != SVXAUTHORFORMAT_SHORTNAME;
- break;
-
- case ID_MEASUREFIELD:
- mpImpl->mnInt16 = ((SdrMeasureField*)pData)->GetMeasureFieldKind();
- break;
- }
- }
- }
-
- mpPropSet = new SfxItemPropertySet( ImplGetFieldItemPropertyMap(mnServiceId) );
-}
-
-SvxUnoTextField::~SvxUnoTextField() throw()
-{
- delete mpPropSet;
- delete mpImpl;
-}
-
-SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
-{
- SvxFieldData* pData = NULL;
-
- switch( mnServiceId )
- {
- case ID_TIMEFIELD:
- case ID_EXT_TIMEFIELD:
- case ID_DATEFIELD:
- case ID_EXT_DATEFIELD:
- {
- if( mpImpl->mbBoolean2 ) // IsDate?
- {
- Date aDate( setDate( mpImpl->maDateTime ) );
- pData = new SvxDateField( aDate, mpImpl->mbBoolean1?SVXDATETYPE_FIX:SVXDATETYPE_VAR );
- if( mpImpl->mnInt32 >= SVXDATEFORMAT_APPDEFAULT && mpImpl->mnInt32 <= SVXDATEFORMAT_F )
- ((SvxDateField*)pData)->SetFormat( (SvxDateFormat)mpImpl->mnInt32 );
- }
- else
- {
- Time aTime;
-
- if( mnServiceId != ID_TIMEFIELD && mnServiceId != ID_DATEFIELD )
- {
- Time aTime( setTime( mpImpl->maDateTime ) );
- pData = new SvxExtTimeField( aTime, mpImpl->mbBoolean1?SVXTIMETYPE_FIX:SVXTIMETYPE_VAR );
-
- if( mpImpl->mnInt32 >= SVXTIMEFORMAT_APPDEFAULT && mpImpl->mnInt32 <= SVXTIMEFORMAT_AM_HMSH )
- ((SvxExtTimeField*)pData)->SetFormat( (SvxTimeFormat)mpImpl->mnInt32 );
- }
- else
- {
- pData = new SvxTimeField();
- }
- }
-
- }
- break;
-
- case ID_URLFIELD:
- pData = new SvxURLField( mpImpl->msString3, mpImpl->msString1, mpImpl->msString1.getLength() ? SVXURLFORMAT_REPR : SVXURLFORMAT_URL );
- ((SvxURLField*)pData)->SetTargetFrame( mpImpl->msString2 );
- if( mpImpl->mnInt16 >= SVXURLFORMAT_APPDEFAULT && mpImpl->mnInt16 <= SVXURLFORMAT_REPR )
- ((SvxURLField*)pData)->SetFormat( (SvxURLFormat)mpImpl->mnInt16 );
- break;
-
- case ID_PAGEFIELD:
- pData = new SvxPageField();
- break;
-
- case ID_PAGESFIELD:
- pData = new SvxPagesField();
- break;
-
- case ID_FILEFIELD:
- pData = new SvxFileField();
- break;
-
- case ID_TABLEFIELD:
- pData = new SvxTableField();
- break;
-
- case ID_EXT_FILEFIELD:
- {
- // #92009# pass fixed attribute to constructor
- pData = new SvxExtFileField( mpImpl->msString1,
- mpImpl->mbBoolean1 ? SVXFILETYPE_FIX : SVXFILETYPE_VAR,
- setFileNameDisplayFormat((SvxFileFormat)mpImpl->mnInt16 ) );
- break;
- }
-
- case ID_AUTHORFIELD:
- {
- ::rtl::OUString aContent;
- String aFirstName;
- String aLastName;
- String aEmpty;
-
- // do we have CurrentPresentation given?
- // mimic behaviour of writer, which means:
- // prefer CurrentPresentation over Content
- // if both are given.
- if( mpImpl->msString1.getLength() )
- aContent = mpImpl->msString1;
- else
- aContent = mpImpl->msString2;
-
- sal_Int32 nPos = aContent.lastIndexOf( sal_Char(' '), 0 );
- if( nPos > 0 )
- {
- aFirstName = aContent.copy( 0, nPos );
- aLastName = aContent.copy( nPos + 1 );
- }
- else
- {
- aLastName = aContent;
- }
-
- // #92009# pass fixed attribute to constructor
- pData = new SvxAuthorField( SvxAddressItem( aEmpty, aEmpty, aFirstName, aLastName ),
- mpImpl->mbBoolean1 ? SVXAUTHORTYPE_FIX : SVXAUTHORTYPE_VAR );
-
- if( !mpImpl->mbBoolean2 )
- {
- ((SvxAuthorField*)pData)->SetFormat( SVXAUTHORFORMAT_SHORTNAME );
- }
- else if( mpImpl->mnInt16 >= SVXAUTHORFORMAT_FULLNAME || mpImpl->mnInt16 <= SVXAUTHORFORMAT_SHORTNAME )
- {
- ((SvxAuthorField*)pData)->SetFormat( (SvxAuthorFormat) mpImpl->mnInt16 );
- }
-
- break;
- }
-
- case ID_MEASUREFIELD:
- {
- SdrMeasureFieldKind eKind = SDRMEASUREFIELD_VALUE;
- if( mpImpl->mnInt16 == (sal_Int16)SDRMEASUREFIELD_UNIT || mpImpl->mnInt16 == (sal_Int16)SDRMEASUREFIELD_ROTA90BLANCS )
- eKind = (SdrMeasureFieldKind) mpImpl->mnInt16;
- pData = new SdrMeasureField( eKind);
- break;
- }
- };
-
- return pData;
-}
-
-// uno::XInterface
-uno::Any SAL_CALL SvxUnoTextField::queryAggregation( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- uno::Any aAny;
-
- QUERYINT( beans::XPropertySet );
- else QUERYINT( text::XTextContent );
- else QUERYINT( text::XTextField );
- else QUERYINT( lang::XServiceInfo );
- else QUERYINT( lang::XUnoTunnel );
- else
- return OComponentHelper::queryAggregation( rType );
-
- return aAny;
-}
-
-// XTypeProvider
-
-uno::Sequence< uno::Type > SAL_CALL SvxUnoTextField::getTypes()
- throw (uno::RuntimeException)
-{
- if( maTypeSequence.getLength() == 0 )
- {
- maTypeSequence = OComponentHelper::getTypes();
- sal_Int32 nOldCount = maTypeSequence.getLength();
-
- maTypeSequence.realloc( nOldCount + 4 ); // !DANGER! keep this updated
- uno::Type* pTypes = &maTypeSequence.getArray()[nOldCount];
-
- *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextField >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0);
- }
- return maTypeSequence;
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextField::getImplementationId()
- throw (uno::RuntimeException)
-{
- static uno::Sequence< sal_Int8 > aId;
- if( aId.getLength() == 0 )
- {
- aId.realloc( 16 );
- rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
- }
- return aId;
-}
-
-uno::Any SAL_CALL SvxUnoTextField::queryInterface( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- return OComponentHelper::queryInterface(rType);
-}
-
-void SAL_CALL SvxUnoTextField::acquire() throw( )
-{
- OComponentHelper::acquire();
-}
-
-void SAL_CALL SvxUnoTextField::release() throw( )
-{
- OComponentHelper::release();
-}
-
-// Interface text::XTextField
-OUString SAL_CALL SvxUnoTextField::getPresentation( sal_Bool bShowCommand )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if(bShowCommand)
- {
- DBG_ASSERT( ((sal_uInt32)mnServiceId) < ID_UNKNOWN, "Unknown field type" );
- return OUString::createFromAscii( aFieldItemNameMap_Impl[(((sal_uInt32)mnServiceId) > ID_UNKNOWN)? ID_UNKNOWN : mnServiceId ] );
- }
- else
- {
- return mpImpl->msPresentation;
- }
-}
-
-// Interface text::XTextContent
-void SAL_CALL SvxUnoTextField::attach( const uno::Reference< text::XTextRange >& xTextRange )
- throw(lang::IllegalArgumentException, uno::RuntimeException)
-{
- SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xTextRange );
- if(pRange == NULL)
- throw lang::IllegalArgumentException();
-
- SvxFieldData* pData = CreateFieldData();
- if( pData )
- pRange->attachField( pData );
-
- delete pData;
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextField::getAnchor()
- throw(uno::RuntimeException)
-{
- return mxAnchor;
-}
-
-// lang::XComponent
-void SAL_CALL SvxUnoTextField::dispose()
- throw(uno::RuntimeException)
-{
- OComponentHelper::dispose();
-}
-
-void SAL_CALL SvxUnoTextField::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw(uno::RuntimeException)
-{
- OComponentHelper::addEventListener(xListener);
-}
-
-void SAL_CALL SvxUnoTextField::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
- throw(uno::RuntimeException)
-{
- OComponentHelper::removeEventListener(aListener);
-}
-
-
-// Interface beans::XPropertySet
-uno::Reference< beans::XPropertySetInfo > SAL_CALL SvxUnoTextField::getPropertySetInfo( )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return mpPropSet->getPropertySetInfo();
-}
-
-void SAL_CALL SvxUnoTextField::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
- throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if( mpImpl == NULL )
- throw uno::RuntimeException();
-
- const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(mpPropSet->getPropertyMap(), aPropertyName );
- if ( !pMap )
- throw beans::UnknownPropertyException();
-
- switch( pMap->nWID )
- {
- case WID_DATE:
- if(aValue >>= mpImpl->maDateTime)
- return;
- break;
- case WID_BOOL1:
- if(aValue >>= mpImpl->mbBoolean1)
- return;
- break;
- case WID_BOOL2:
- if(aValue >>= mpImpl->mbBoolean2)
- return;
- break;
- case WID_INT16:
- if(aValue >>= mpImpl->mnInt16)
- return;
- break;
- case WID_INT32:
- if(aValue >>= mpImpl->mnInt32)
- return;
- break;
- case WID_STRING1:
- if(aValue >>= mpImpl->msString1)
- return;
- break;
- case WID_STRING2:
- if(aValue >>= mpImpl->msString2)
- return;
- break;
- case WID_STRING3:
- if(aValue >>= mpImpl->msString3)
- return;
- break;
- }
-
- throw lang::IllegalArgumentException();
-
-/*
- case WID_FORMAT:
- {
- sal_Int32 nFormat;
-
- switch( mnId )
- {
- case ID_DATEFIELD:
- {
- SvxDateField* pDate = PTR_CAST( SvxDateField, aFieldItem.GetField() );
- if(pDate)
- pDate->SetFormat( (SvxDateFormat)nFormat );
- break;
- }
- case ID_URLFIELD:
- {
- SvxURLField* pURL = PTR_CAST( SvxURLField, aFieldItem.GetField() );
- if(pURL)
- pURL->SetFormat( (SvxURLFormat)nFormat );
- break;
- }
- case ID_EXT_TIMEFIELD:
- {
- SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, aFieldItem.GetField() );
- if(pTime)
- pTime->SetFormat( (SvxTimeFormat)nFormat );
- break;
- }
- case ID_EXT_FILEFIELD:
- {
- SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, aFieldItem.GetField() );
- if(pFile)
- pFile->SetFormat( (SvxFileFormat)nFormat );
- break;
- }
- case ID_AUTHORFIELD:
- {
- SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, aFieldItem.GetField() );
- if(pAuthor)
- pAuthor->SetFormat( (SvxAuthorFormat)nFormat );
- break;
- }
- default:
- throw beans::UnknownPropertyException();
- }
- }
- break;
- case WID_FIX:
- {
- if( aValue.hasValue() || aValue.getValueType() != ::getCppuBooleanType() )
- throw lang::IllegalArgumentException();
- sal_Bool bFix( *(sal_Bool*)aValue.getValue() );
- switch( mnId )
- {
- case ID_EXT_TIMEFIELD:
- {
- SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, aFieldItem.GetField() );
- if(pTime)
- pTime->SetType( (SvxTimeType)bFix?SVXTIMETYPE_FIX:SVXTIMETYPE_VAR );
- break;
- }
- case ID_DATEFIELD:
- {
- SvxDateField* pDate = PTR_CAST( SvxDateField, aFieldItem.GetField() );
- if(pDate)
- pDate->SetType( (SvxDateType)bFix?SVXDATETYPE_FIX:SVXDATETYPE_VAR );
- break;
- }
- case ID_EXT_FILEFIELD:
- {
- SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, aFieldItem.GetField() );
- if(pFile)
- pFile->SetType( (SvxFileType)bFix?SVXFILETYPE_FIX:SVXFILETYPE_VAR );
- break;
- }
- case ID_AUTHORFIELD:
- {
- SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, aFieldItem.GetField() );
- if(pAuthor)
- pAuthor->SetType( (SvxAuthorType)bFix?SVXAUTHORTYPE_FIX:SVXAUTHORTYPE_VAR );
- break;
- }
- default:
- throw beans::UnknownPropertyException();
- }
- }
- break;
- case WID_PRES:
- case WID_URL:
- case WID_TARGET:
- {
- SvxURLField* pURL = PTR_CAST( SvxURLField, aFieldItem.GetField() );
- if(pURL)
- {
- OUString aUnoStr;
- if(!(aValue >>= aUnoStr))
- throw lang::IllegalArgumentException();
-
- switch( pMap->nWID )
- {
- case WID_PRES:
- pURL->SetRepresentation( aUnoStr );
- break;
- case WID_URL:
- pURL->SetURL( aUnoStr );
- break;
- case WID_TARGET:
- pURL->SetTargetFrame( aUnoStr );
- break;
- }
- }
- break;
- }
- }
-
- SfxItemSet aSet = pForwarder->GetAttribs( GetSelection() );
- aSet.Put( aFieldItem );
-*/
-}
-
-uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- uno::Any aValue;
-
- const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(mpPropSet->getPropertyMap(), PropertyName );
- if ( !pMap )
- throw beans::UnknownPropertyException();
-
- switch( pMap->nWID )
- {
- case WID_DATE:
- aValue <<= mpImpl->maDateTime;
- break;
- case WID_BOOL1:
- aValue <<= mpImpl->mbBoolean1;
- break;
- case WID_BOOL2:
- aValue <<= mpImpl->mbBoolean2;
- break;
- case WID_INT16:
- aValue <<= mpImpl->mnInt16;
- break;
- case WID_INT32:
- aValue <<= mpImpl->mnInt32;
- break;
- case WID_STRING1:
- aValue <<= mpImpl->msString1;
- break;
- case WID_STRING2:
- aValue <<= mpImpl->msString2;
- break;
- case WID_STRING3:
- aValue <<= mpImpl->msString3;
- break;
- }
-
- return aValue;
-
-/*
- switch(pMap->nWID)
- {
- case WID_FORMAT:
- switch( mnId )
- {
- case ID_DATEFIELD:
- {
- SvxDateField* pDate = PTR_CAST( SvxDateField, pFieldItem->GetField() );
- if(pDate)
- aValue <<= (sal_Int32)pDate->GetFormat();
- break;
- }
- case ID_URLFIELD:
- {
- SvxURLField* pURL = PTR_CAST( SvxURLField, pFieldItem->GetField() );
- if(pURL)
- aValue <<= (sal_Int32)pURL->GetFormat();
- break;
- }
- case ID_EXT_TIMEFIELD:
- {
- SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, pFieldItem->GetField() );
- if(pTime)
- aValue <<= (sal_Int32)pTime->GetFormat();
- break;
- }
- case ID_EXT_FILEFIELD:
- {
- SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, pFieldItem->GetField() );
- if(pFile)
- aValue <<= (sal_Int32)pFile->GetFormat();
- break;
- }
- case ID_AUTHORFIELD:
- {
- SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, pFieldItem->GetField() );
- if(pAuthor)
- aValue <<= (sal_Int32)pAuthor->GetFormat();
- break;
- }
- default:
- throw beans::UnknownPropertyException();
- }
- break;
- case WID_FIX:
- {
- sal_Bool bFix = sal_False;
- switch( mnId )
- {
- case ID_EXT_TIMEFIELD:
- {
- SvxExtTimeField* pTime = PTR_CAST( SvxExtTimeField, pFieldItem->GetField() );
- if(pTime)
- bFix = pTime->GetType() == SVXTIMETYPE_FIX;
- break;
- }
- case ID_DATEFIELD:
- {
- SvxDateField* pDate = PTR_CAST( SvxDateField, pFieldItem->GetField() );
- if(pDate)
- bFix = pDate->GetType() == SVXDATETYPE_FIX;
- break;
- }
- case ID_EXT_FILEFIELD:
- {
- SvxExtFileField* pFile = PTR_CAST( SvxExtFileField, pFieldItem->GetField() );
- if(pFile)
- bFix = pFile->GetType() == SVXFILETYPE_FIX;
- break;
- }
- case ID_AUTHORFIELD:
- {
- SvxAuthorField* pAuthor = PTR_CAST( SvxAuthorField, pFieldItem->GetField() );
- if(pAuthor)
- bFix = pAuthor->GetType() == SVXAUTHORTYPE_FIX;
- break;
- }
- default:
- throw beans::UnknownPropertyException();
- }
- aValue.setValue( &bFix, ::getCppuBooleanType() );
- }
- break;
- case WID_PRES:
- case WID_URL:
- case WID_TARGET:
- {
- SvxURLField* pURL = PTR_CAST( SvxURLField, pFieldItem->GetField() );
- if(pURL)
- {
- OUString aStr;
- switch( pMap->nWID )
- {
- case WID_PRES:
- aStr = pURL->GetRepresentation();
- break;
- case WID_URL:
- aStr = pURL->GetURL();
- break;
- case WID_TARGET:
- aStr = pURL->GetTargetFrame();
- break;
- }
- aValue <<= aStr;
- }
- break;
- }
- case WID_FCOLOR:
- case WID_TCOLOR:
- {
- Color* pFColor = NULL;
- Color* pTColor = NULL;
- const ESelection aSel = GetSelection();
-
- pForwarder->CalcFieldValue( *pFieldItem, aSel.nStartPara, aSel.nStartPos, pTColor, pFColor );
-
- if( pMap->nWID == WID_FCOLOR )
- aValue <<= (sal_Int32)pFColor->GetColor();
- else
- aValue <<= (sal_Int32)pTColor->GetColor();
- break;
-
- delete pTColor;
- delete pFColor;
- }
- }
- return aValue;
-*/
-}
-
-void SAL_CALL SvxUnoTextField::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-void SAL_CALL SvxUnoTextField::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-void SAL_CALL SvxUnoTextField::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-void SAL_CALL SvxUnoTextField::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-
-// OComponentHelper
-void SvxUnoTextField::disposing()
-{
- // nothing to do
-}
-
-sal_Int32 SvxUnoTextField::GetFieldId( const SvxFieldData* pFieldData ) const throw()
-{
- if( pFieldData->ISA( SvxURLField ) )
- return ID_URLFIELD;
- else if( pFieldData->ISA( SvxPageField ) )
- return ID_PAGEFIELD;
- else if( pFieldData->ISA( SvxPagesField ) )
- return ID_PAGESFIELD;
- else if( pFieldData->ISA( SvxTimeField ) )
- return ID_TIMEFIELD;
- else if( pFieldData->ISA( SvxFileField ) )
- return ID_FILEFIELD;
- else if( pFieldData->ISA( SvxTableField ) )
- return ID_TABLEFIELD;
- else if( pFieldData->ISA( SvxExtTimeField ) )
- return ID_EXT_TIMEFIELD;
- else if( pFieldData->ISA( SvxExtFileField ) )
- return ID_EXT_FILEFIELD;
- else if( pFieldData->ISA( SvxAuthorField ) )
- return ID_AUTHORFIELD;
- else if( pFieldData->ISA( SvxDateField ) )
- return ID_EXT_DATEFIELD;
- else if( pFieldData->ISA( SdrMeasureField ) )
- return ID_MEASUREFIELD;
-
- return ID_UNKNOWN;
-}
-
-// lang::XServiceInfo
-OUString SAL_CALL SvxUnoTextField::getImplementationName() throw(uno::RuntimeException)
-{
- return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextField"));
-}
-
-static const sal_Char* pServiceNames[] =
-{
- "com.sun.star.text.TextField.DateTime",
- "com.sun.star.text.TextField.URL",
- "com.sun.star.text.TextField.PageNumber",
- "com.sun.star.text.TextField.PageCount",
- "com.sun.star.text.TextField.DateTime",
- "com.sun.star.text.TextField.DocInfo.Title", // SvxFileField is used for title
- "com.sun.star.text.TextField.SheetName",
- "com.sun.star.text.TextField.DateTime",
- "com.sun.star.text.TextField.FileName",
- "com.sun.star.text.TextField.Author",
- "com.sun.star.text.TextField.Measure",
- "com.sun.star.text.TextField.DateTime"
-};
-
-uno::Sequence< OUString > SAL_CALL SvxUnoTextField::getSupportedServiceNames()
- throw(uno::RuntimeException)
-{
- uno::Sequence< OUString > aSeq( 3 );
- OUString* pServices = aSeq.getArray();
- pServices[0] = OUString::createFromAscii( pServiceNames[mnServiceId] );
- pServices[1] = OUString::createFromAscii( "com.sun.star.text.TextContent" ),
- pServices[2] = OUString::createFromAscii( "com.sun.star.text.TextField" );
-
- return aSeq;
-}
-
-sal_Bool SAL_CALL SvxUnoTextField::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
-{
- return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
-}
-
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/unoedit/svx_unofored.cxx b/binfilter/bf_svx/source/unoedit/svx_unofored.cxx
deleted file mode 100644
index 8513850fd5ff..000000000000
--- a/binfilter/bf_svx/source/unoedit/svx_unofored.cxx
+++ /dev/null
@@ -1,503 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#ifdef _MSC_VER
-#pragma hdrstop
-#endif
-
-#include <algorithm>
-
-#include <com/sun/star/i18n/WordType.hpp>
-
-#include <unoedhlp.hxx>
-#include <outliner.hxx>
-#include <editobj.hxx> // nur fuer die GetText-Kruecke
-
-#include "unofored.hxx"
-namespace binfilter {
-
-using namespace ::com::sun::star;
-
-//------------------------------------------------------------------------
-
-SvxEditEngineForwarder::SvxEditEngineForwarder( EditEngine& rEngine ) :
- rEditEngine( rEngine )
-{
-}
-
-SvxEditEngineForwarder::~SvxEditEngineForwarder()
-{
- // die EditEngine muss ggf. von aussen geloescht werden
-}
-
-USHORT SvxEditEngineForwarder::GetParagraphCount() const
-{
- return rEditEngine.GetParagraphCount();
-}
-
-USHORT SvxEditEngineForwarder::GetTextLen( USHORT nParagraph ) const
-{
- return rEditEngine.GetTextLen( nParagraph );
-}
-
-String SvxEditEngineForwarder::GetText( const ESelection& rSel ) const
-{
- String aRet = rEditEngine.GetText( rSel, LINEEND_LF );
- aRet.ConvertLineEnd();
- return aRet;
-}
-
-SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib ) const
-{
- if( rSel.nStartPara == rSel.nEndPara )
- {
- sal_uInt8 nFlags = 0;
- switch( bOnlyHardAttrib )
- {
- case EditEngineAttribs_All:
- nFlags = GETATTRIBS_ALL;
- break;
- case EditEngineAttribs_HardAndPara:
- nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS;
- break;
- case EditEngineAttribs_OnlyHard:
- nFlags = GETATTRIBS_CHARATTRIBS;
- break;
- default:
- DBG_ERROR("unknown flags for SvxOutlinerForwarder::GetAttribs");
- }
-
- return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags );
- }
- else
- {
- return rEditEngine.GetAttribs( rSel, bOnlyHardAttrib );
- }
-}
-
-SfxItemSet SvxEditEngineForwarder::GetParaAttribs( USHORT nPara ) const
-{
- SfxItemSet aSet( rEditEngine.GetParaAttribs( nPara ) );
-
- USHORT nWhich = EE_PARA_START;
- while( nWhich <= EE_PARA_END )
- {
- if( aSet.GetItemState( nWhich, TRUE ) != SFX_ITEM_ON )
- {
- if( rEditEngine.HasParaAttrib( nPara, nWhich ) )
- aSet.Put( rEditEngine.GetParaAttrib( nPara, nWhich ) );
- }
- nWhich++;
- }
-
- return aSet;
-}
-
-void SvxEditEngineForwarder::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet )
-{
- rEditEngine.SetParaAttribs( nPara, rSet );
-}
-
-SfxItemPool* SvxEditEngineForwarder::GetPool() const
-{
- return rEditEngine.GetEmptyItemSet().GetPool();
-}
-
-void SvxEditEngineForwarder::GetPortions( USHORT nPara, SvUShorts& rList ) const
-{
- rEditEngine.GetPortions( nPara, rList );
-}
-
-void SvxEditEngineForwarder::QuickInsertText( const String& rText, const ESelection& rSel )
-{
- rEditEngine.QuickInsertText( rText, rSel );
-}
-
-void SvxEditEngineForwarder::QuickInsertLineBreak( const ESelection& rSel )
-{
- rEditEngine.QuickInsertLineBreak( rSel );
-}
-
-void SvxEditEngineForwarder::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
-{
- rEditEngine.QuickInsertField( rFld, rSel );
-}
-
-void SvxEditEngineForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
-{
- rEditEngine.QuickSetAttribs( rSet, rSel );
-}
-
-BOOL SvxEditEngineForwarder::IsValid() const
-{
- // cannot reliably query EditEngine state
- // while in the middle of an update
- return rEditEngine.GetUpdateMode();
-}
-
-XubString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor )
-{
- return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
-}
-
-USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, USHORT nWhich )
-{
- EECharAttribArray aAttribs;
-
- const SfxPoolItem* pLastItem = NULL;
-
- SfxItemState eState = SFX_ITEM_DEFAULT;
-
- // check all paragraphs inside the selection
- for( USHORT nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++ )
- {
- SfxItemState eParaState = SFX_ITEM_DEFAULT;
-
- // calculate start and endpos for this paragraph
- USHORT nPos = 0;
- if( rSel.nStartPara == nPara )
- nPos = rSel.nStartPos;
-
- USHORT nEndPos = rSel.nEndPos;
- if( rSel.nEndPara != nPara )
- nEndPos = rEditEngine.GetTextLen( nPara );
-
-
- // get list of char attribs
- rEditEngine.GetCharAttribs( nPara, aAttribs );
-
- BOOL bEmpty = TRUE; // we found no item inside the selektion of this paragraph
- BOOL bGaps = FALSE; // we found items but theire gaps between them
- USHORT nLastEnd = nPos;
-
- const SfxPoolItem* pParaItem = NULL;
-
- for( USHORT nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++ )
- {
- struct EECharAttrib aAttrib = aAttribs.GetObject( nAttrib );
- DBG_ASSERT( aAttrib.pAttr, "GetCharAttribs gives corrupt data" );
-
- const sal_Bool bEmptyPortion = aAttrib.nStart == aAttrib.nEnd;
- if( (!bEmptyPortion && (aAttrib.nStart >= nEndPos)) || (bEmptyPortion && (aAttrib.nStart > nEndPos)) )
- break; // break if we are already behind our selektion
-
- if( (!bEmptyPortion && (aAttrib.nEnd <= nPos)) || (bEmptyPortion && (aAttrib.nEnd < nPos)) )
- continue; // or if the attribute ends before our selektion
-
- if( aAttrib.pAttr->Which() != nWhich )
- continue; // skip if is not the searched item
-
- // if we already found an item
- if( pParaItem )
- {
- // ... and its different to this one than the state is dont care
- if( *pParaItem != *aAttrib.pAttr )
- return SFX_ITEM_DONTCARE;
- }
- else
- {
- pParaItem = aAttrib.pAttr;
- }
-
- if( bEmpty )
- bEmpty = FALSE;
-
- if( !bGaps && aAttrib.nStart > nLastEnd )
- bGaps = TRUE;
-
- nLastEnd = aAttrib.nEnd;
- }
-
- if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) )
- bGaps = TRUE;
-/*
- // since we have no portion with our item or if there were gaps
- if( bEmpty || bGaps )
- {
- // we need to check the paragraph item
- const SfxItemSet& rParaSet = rEditEngine.GetParaAttribs( nPara );
- if( rParaSet.GetItemState( nWhich ) == SFX_ITEM_SET )
- {
- eState = SFX_ITEM_SET;
- // get item from the paragraph
- const SfxPoolItem* pTempItem = rParaSet.GetItem( nWhich );
- if( pParaItem )
- {
- if( *pParaItem != *pTempItem )
- return SFX_ITEM_DONTCARE;
- }
- else
- {
- pParaItem = pTempItem;
- }
-
- // set if theres no last item or if its the same
- eParaState = SFX_ITEM_SET;
- }
- else if( bEmpty )
- {
- eParaState = SFX_ITEM_DEFAULT;
- }
- else if( bGaps )
- {
- // gaps and item not set in paragraph, thats a dont care
- return SFX_ITEM_DONTCARE;
- }
- }
- else
- {
- eParaState = SFX_ITEM_SET;
- }
-*/
- if( bEmpty )
- eParaState = SFX_ITEM_DEFAULT;
- else if( bGaps )
- eParaState = SFX_ITEM_DONTCARE;
- else
- eParaState = SFX_ITEM_SET;
-
- // if we already found an item check if we found the same
- if( pLastItem )
- {
- if( (pParaItem == NULL) || (*pLastItem != *pParaItem) )
- return SFX_ITEM_DONTCARE;
- }
- else
- {
- pLastItem = pParaItem;
- eState = eParaState;
- }
- }
-
- return eState;
-}
-
-USHORT SvxEditEngineForwarder::GetItemState( const ESelection& rSel, USHORT nWhich ) const
-{
- return GetSvxEditEngineItemState( rEditEngine, rSel, nWhich );
-}
-
-USHORT SvxEditEngineForwarder::GetItemState( USHORT nPara, USHORT nWhich ) const
-{
- const SfxItemSet& rSet = rEditEngine.GetParaAttribs( nPara );
- return rSet.GetItemState( nWhich );
-}
-
-LanguageType SvxEditEngineForwarder::GetLanguage( USHORT nPara, USHORT nIndex ) const
-{
- return rEditEngine.GetLanguage(nPara, nIndex);
-}
-
-USHORT SvxEditEngineForwarder::GetFieldCount( USHORT nPara ) const
-{
- return rEditEngine.GetFieldCount(nPara);
-}
-
-EFieldInfo SvxEditEngineForwarder::GetFieldInfo( USHORT nPara, USHORT nField ) const
-{
- return rEditEngine.GetFieldInfo( nPara, nField );
-}
-
-EBulletInfo SvxEditEngineForwarder::GetBulletInfo( USHORT nPara ) const
-{
- return EBulletInfo();
-}
-
-Rectangle SvxEditEngineForwarder::GetCharBounds( USHORT nPara, USHORT nIndex ) const
-{
- // #101701#
- // EditEngine's 'internal' methods like GetCharacterBounds()
- // don't rotate for vertical text.
- Size aSize( rEditEngine.CalcTextWidth(), rEditEngine.GetTextHeight() );
- ::std::swap( aSize.Width(), aSize.Height() );
- bool bIsVertical( rEditEngine.IsVertical() == TRUE );
-
- // #108900# Handle virtual position one-past-the end of the string
- if( nIndex >= rEditEngine.GetTextLen(nPara) )
- {
- Rectangle aLast;
-
- if( nIndex )
- {
- // use last character, if possible
- aLast = rEditEngine.GetCharacterBounds( EPosition(nPara, nIndex-1) );
-
- // move at end of this last character, make one pixel wide
- aLast.Move( aLast.Right() - aLast.Left(), 0 );
- aLast.SetSize( Size(1, aLast.GetHeight()) );
-
- // take care for CTL
- aLast = SvxEditSourceHelper::EEToUserSpace( aLast, aSize, bIsVertical );
- }
- else
- {
- // #109864# Bounds must lie within the paragraph
- aLast = GetParaBounds( nPara );
-
- // #109151# Don't use paragraph height, but line height
- // instead. aLast is already CTL-correct
- if( bIsVertical)
- aLast.SetSize( Size( rEditEngine.GetLineHeight(nPara,0), 1 ) );
- else
- aLast.SetSize( Size( 1, rEditEngine.GetLineHeight(nPara,0) ) );
- }
-
- return aLast;
- }
- else
- {
- return SvxEditSourceHelper::EEToUserSpace( rEditEngine.GetCharacterBounds( EPosition(nPara, nIndex) ),
- aSize, bIsVertical );
- }
-}
-
-Rectangle SvxEditEngineForwarder::GetParaBounds( USHORT nPara ) const
-{
- const Point aPnt = rEditEngine.GetDocPosTopLeft( nPara );
- ULONG nWidth;
- ULONG nHeight;
- ULONG nTextWidth;
-
- if( rEditEngine.IsVertical() )
- {
- // #101701#
- // Hargl. EditEngine's 'external' methods return the rotated
- // dimensions, 'internal' methods like GetTextHeight( n )
- // don't rotate.
- nWidth = rEditEngine.GetTextHeight( nPara );
- nHeight = rEditEngine.GetTextHeight();
- nTextWidth = rEditEngine.GetTextHeight();
-
- return Rectangle( nTextWidth - aPnt.Y() - nWidth, 0, nTextWidth - aPnt.Y(), nHeight );
- }
- else
- {
- nWidth = rEditEngine.CalcTextWidth();
- nHeight = rEditEngine.GetTextHeight( nPara );
-
- return Rectangle( 0, aPnt.Y(), nWidth, aPnt.Y() + nHeight );
- }
-}
-
-MapMode SvxEditEngineForwarder::GetMapMode() const
-{
- return rEditEngine.GetRefMapMode();
-}
-
-OutputDevice* SvxEditEngineForwarder::GetRefDevice() const
-{
- return rEditEngine.GetRefDevice();
-}
-
-sal_Bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, USHORT& nPara, USHORT& nIndex ) const
-{
- // #101701#
- Size aSize( rEditEngine.CalcTextWidth(), rEditEngine.GetTextHeight() );
- ::std::swap( aSize.Width(), aSize.Height() );
- Point aEEPos( SvxEditSourceHelper::UserSpaceToEE( rPos,
- aSize,
- rEditEngine.IsVertical() == TRUE ));
-
- EPosition aDocPos = rEditEngine.FindDocPosition( aEEPos );
-
- nPara = aDocPos.nPara;
- nIndex = aDocPos.nIndex;
-
- return sal_True;
-}
-
-sal_Bool SvxEditEngineForwarder::GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const
-{
- ESelection aRes = rEditEngine.GetWord( ESelection(nPara, nIndex, nPara, nIndex), ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
-
- if( aRes.nStartPara == nPara &&
- aRes.nStartPara == aRes.nEndPara )
- {
- nStart = aRes.nStartPos;
- nEnd = aRes.nEndPos;
-
- return sal_True;
- }
-
- return sal_False;
-}
-
-sal_Bool SvxEditEngineForwarder::GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const
-{
- return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rEditEngine, nPara, nIndex );
-}
-
-USHORT SvxEditEngineForwarder::GetLineCount( USHORT nPara ) const
-{
- return rEditEngine.GetLineCount(nPara);
-}
-
-USHORT SvxEditEngineForwarder::GetLineLen( USHORT nPara, USHORT nLine ) const
-{
- return rEditEngine.GetLineLen(nPara, nLine);
-}
-
-sal_Bool SvxEditEngineForwarder::QuickFormatDoc( BOOL bFull )
-{
- rEditEngine.QuickFormatDoc();
-
- return sal_True;
-}
-
-sal_Bool SvxEditEngineForwarder::Delete( const ESelection& rSelection )
-{
- rEditEngine.QuickDelete( rSelection );
- rEditEngine.QuickFormatDoc();
-
- return sal_True;
-}
-
-sal_Bool SvxEditEngineForwarder::InsertText( const String& rStr, const ESelection& rSelection )
-{
- rEditEngine.QuickInsertText( rStr, rSelection );
- rEditEngine.QuickFormatDoc();
-
- return sal_True;
-}
-
-USHORT SvxEditEngineForwarder::GetDepth( USHORT nPara ) const
-{
- // EditEngine does not support outline depth
- return 0;
-}
-
-sal_Bool SvxEditEngineForwarder::SetDepth( USHORT nPara, USHORT nNewDepth )
-{
- // EditEngine does not support outline depth
- return nNewDepth == 0 ? sal_True : sal_False;
-}
-
-//------------------------------------------------------------------------
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/unoedit/svx_unoforou.cxx b/binfilter/bf_svx/source/unoedit/svx_unoforou.cxx
deleted file mode 100644
index 202885aa1ee6..000000000000
--- a/binfilter/bf_svx/source/unoedit/svx_unoforou.cxx
+++ /dev/null
@@ -1,505 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#ifdef _MSC_VER
-#pragma hdrstop
-#endif
-
-#include <algorithm>
-
-#include <bf_svtools/style.hxx>
-#include <com/sun/star/i18n/WordType.hpp>
-
-#include <bf_svtools/itemset.hxx>
-#include <outliner.hxx>
-#include <unoedhlp.hxx>
-#include <svdobj.hxx>
-
-
-
-
-#include "unoforou.hxx"
-#include "unofored.hxx"
-namespace binfilter {
-
-using namespace ::com::sun::star;
-
-//------------------------------------------------------------------------
-
-SvxOutlinerForwarder::SvxOutlinerForwarder( Outliner& rOutl, SdrObject* pSdrObj ) :
- rOutliner( rOutl ),
- pSdrObject( pSdrObj ),
- mpAttribsCache( NULL ),
- mpParaAttribsCache( NULL ),
- mnParaAttribsCache( 0 )
-{
-}
-
-SvxOutlinerForwarder::~SvxOutlinerForwarder()
-{
- flushCache();
-}
-
-USHORT SvxOutlinerForwarder::GetParagraphCount() const
-{
- return (USHORT)rOutliner.GetParagraphCount();
-}
-
-USHORT SvxOutlinerForwarder::GetTextLen( USHORT nParagraph ) const
-{
- return rOutliner.GetEditEngine().GetTextLen( nParagraph );
-}
-
-String SvxOutlinerForwarder::GetText( const ESelection& rSel ) const
-{
- //! GetText(ESelection) sollte es wohl auch mal am Outliner geben
- // solange den Hack fuer die EditEngine uebernehmen:
- EditEngine* pEditEngine = (EditEngine*)&rOutliner.GetEditEngine();
- return pEditEngine->GetText( rSel, LINEEND_LF );
-}
-
-static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib, EditEngine& rEditEngine )
-{
- if( rSel.nStartPara == rSel.nEndPara )
- {
- sal_uInt8 nFlags = 0;
-
- switch( bOnlyHardAttrib )
- {
- case EditEngineAttribs_All:
- nFlags = GETATTRIBS_ALL;
- break;
- case EditEngineAttribs_HardAndPara:
- nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS;
- break;
- case EditEngineAttribs_OnlyHard:
- nFlags = GETATTRIBS_CHARATTRIBS;
- break;
- default:
- DBG_ERROR("unknown flags for SvxOutlinerForwarder::GetAttribs");
- }
- return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags );
- }
- else
- {
- return rEditEngine.GetAttribs( rSel, bOnlyHardAttrib );
- }
-}
-
-SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib ) const
-{
- if( mpAttribsCache && ( 0 == bOnlyHardAttrib ) )
- {
- // have we the correct set in cache?
- if( ((SvxOutlinerForwarder*)this)->maAttribCacheSelection.IsEqual(rSel) )
- {
- // yes! just return the cache
- return *mpAttribsCache;
- }
- else
- {
- // no, we need delete the old cache
- delete mpAttribsCache;
- mpAttribsCache = NULL;
- }
- }
-
- //! gibt's das nicht am Outliner ???
- //! und warum ist GetAttribs an der EditEngine nicht const?
- EditEngine& rEditEngine = (EditEngine&)rOutliner.GetEditEngine();
-
- SfxItemSet aSet( ImplOutlinerForwarderGetAttribs( rSel, bOnlyHardAttrib, rEditEngine ) );
-
- if( 0 == bOnlyHardAttrib )
- {
- mpAttribsCache = new SfxItemSet( aSet );
- maAttribCacheSelection = rSel;
- }
-
- SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( rSel.nStartPara );
- if( pStyle )
- aSet.SetParent( &(pStyle->GetItemSet() ) );
-
- return aSet;
-}
-
-SfxItemSet SvxOutlinerForwarder::GetParaAttribs( USHORT nPara ) const
-{
- if( mpParaAttribsCache )
- {
- // have we the correct set in cache?
- if( nPara == mnParaAttribsCache )
- {
- // yes! just return the cache
- return *mpParaAttribsCache;
- }
- else
- {
- // no, we need delete the old cache
- delete mpParaAttribsCache;
- mpParaAttribsCache = NULL;
- }
- }
-
- mpParaAttribsCache = new SfxItemSet( rOutliner.GetParaAttribs( nPara ) );
- mnParaAttribsCache = nPara;
-
- EditEngine& rEditEngine = (EditEngine&)rOutliner.GetEditEngine();
-
- SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( nPara );
- if( pStyle )
- mpParaAttribsCache->SetParent( &(pStyle->GetItemSet() ) );
-
- return *mpParaAttribsCache;
-}
-
-void SvxOutlinerForwarder::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet )
-{
- flushCache();
-
- const SfxItemSet* pOldParent = rSet.GetParent();
- if( pOldParent )
- ((SfxItemSet*)&rSet)->SetParent( NULL );
-
- rOutliner.SetParaAttribs( nPara, rSet, true );
-
- if( pOldParent )
- ((SfxItemSet*)&rSet)->SetParent( pOldParent );
-}
-
-SfxItemPool* SvxOutlinerForwarder::GetPool() const
-{
- return rOutliner.GetEmptyItemSet().GetPool();
-}
-
-void SvxOutlinerForwarder::GetPortions( USHORT nPara, SvUShorts& rList ) const
-{
- ((EditEngine&)rOutliner.GetEditEngine()).GetPortions( nPara, rList );
-}
-
-void SvxOutlinerForwarder::QuickInsertText( const String& rText, const ESelection& rSel )
-{
- flushCache();
- if( rText.Len() == 0 )
- {
- rOutliner.QuickDelete( rSel );
- }
- else
- {
- rOutliner.QuickInsertText( rText, rSel );
- }
-}
-
-void SvxOutlinerForwarder::QuickInsertLineBreak( const ESelection& rSel )
-{
- flushCache();
- rOutliner.QuickInsertLineBreak( rSel );
-}
-
-void SvxOutlinerForwarder::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
-{
- flushCache();
- rOutliner.QuickInsertField( rFld, rSel );
-}
-
-void SvxOutlinerForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
-{
- flushCache();
- rOutliner.QuickSetAttribs( rSet, rSel );
-}
-
-XubString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor )
-{
- return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
-}
-
-BOOL SvxOutlinerForwarder::IsValid() const
-{
- // cannot reliably query outliner state
- // while in the middle of an update
- return rOutliner.GetUpdateMode();
-}
-
-extern USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, USHORT nWhich );
-
-USHORT SvxOutlinerForwarder::GetItemState( const ESelection& rSel, USHORT nWhich ) const
-{
- return GetSvxEditEngineItemState( (EditEngine&)rOutliner.GetEditEngine(), rSel, nWhich );
-}
-
-USHORT SvxOutlinerForwarder::GetItemState( USHORT nPara, USHORT nWhich ) const
-{
- const SfxItemSet& rSet = rOutliner.GetParaAttribs( nPara );
- return rSet.GetItemState( nWhich );
-}
-
-
-void SvxOutlinerForwarder::flushCache()
-{
- if( mpAttribsCache )
- {
- delete mpAttribsCache;
- mpAttribsCache = NULL;
- }
-
- if( mpParaAttribsCache )
- {
- delete mpParaAttribsCache;
- mpParaAttribsCache = NULL;
- }
-}
-
-LanguageType SvxOutlinerForwarder::GetLanguage( USHORT nPara, USHORT nIndex ) const
-{
- return rOutliner.GetLanguage(nPara, nIndex);
-}
-
-USHORT SvxOutlinerForwarder::GetFieldCount( USHORT nPara ) const
-{
- return rOutliner.GetEditEngine().GetFieldCount(nPara);
-}
-
-EFieldInfo SvxOutlinerForwarder::GetFieldInfo( USHORT nPara, USHORT nField ) const
-{
- return rOutliner.GetEditEngine().GetFieldInfo( nPara, nField );
-}
-
-EBulletInfo SvxOutlinerForwarder::GetBulletInfo( USHORT nPara ) const
-{
- return rOutliner.GetBulletInfo( nPara );
-}
-
-Rectangle SvxOutlinerForwarder::GetCharBounds( USHORT nPara, USHORT nIndex ) const
-{
- // #101701#
- // EditEngine's 'internal' methods like GetCharacterBounds()
- // don't rotate for vertical text.
- Size aSize( rOutliner.CalcTextSize() );
- ::std::swap( aSize.Width(), aSize.Height() );
- bool bIsVertical( rOutliner.IsVertical() == TRUE );
-
- // #108900# Handle virtual position one-past-the end of the string
- if( nIndex >= GetTextLen(nPara) )
- {
- Rectangle aLast;
-
- if( nIndex )
- {
- // use last character, if possible
- aLast = rOutliner.GetEditEngine().GetCharacterBounds( EPosition(nPara, nIndex-1) );
-
- // move at end of this last character, make one pixel wide
- aLast.Move( aLast.Right() - aLast.Left(), 0 );
- aLast.SetSize( Size(1, aLast.GetHeight()) );
-
- // take care for CTL
- aLast = SvxEditSourceHelper::EEToUserSpace( aLast, aSize, bIsVertical );
- }
- else
- {
- // #109864# Bounds must lie within the paragraph
- aLast = GetParaBounds( nPara );
-
- // #109151# Don't use paragraph height, but line height
- // instead. aLast is already CTL-correct
- if( bIsVertical)
- aLast.SetSize( Size( rOutliner.GetLineHeight(nPara,0), 1 ) );
- else
- aLast.SetSize( Size( 1, rOutliner.GetLineHeight(nPara,0) ) );
- }
-
- return aLast;
- }
- else
- {
- return SvxEditSourceHelper::EEToUserSpace( rOutliner.GetEditEngine().GetCharacterBounds( EPosition(nPara, nIndex) ),
- aSize, bIsVertical );
- }
-}
-
-Rectangle SvxOutlinerForwarder::GetParaBounds( USHORT nPara ) const
-{
- Point aPnt = rOutliner.GetDocPosTopLeft( nPara );
- Size aSize = rOutliner.CalcTextSize();
-
- if( rOutliner.IsVertical() )
- {
- // #101701#
- // Hargl. Outliner's 'external' methods return the rotated
- // dimensions, 'internal' methods like GetTextHeight( n )
- // don't rotate.
- ULONG nWidth = rOutliner.GetTextHeight( nPara );
-
- return Rectangle( aSize.Width() - aPnt.Y() - nWidth, 0, aSize.Width() - aPnt.Y(), aSize.Height() );
- }
- else
- {
- ULONG nHeight = rOutliner.GetTextHeight( nPara );
-
- return Rectangle( 0, aPnt.Y(), aSize.Width(), aPnt.Y() + nHeight );
- }
-}
-
-MapMode SvxOutlinerForwarder::GetMapMode() const
-{
- return rOutliner.GetRefMapMode();
-}
-
-OutputDevice* SvxOutlinerForwarder::GetRefDevice() const
-{
- return rOutliner.GetRefDevice();
-}
-
-sal_Bool SvxOutlinerForwarder::GetIndexAtPoint( const Point& rPos, USHORT& nPara, USHORT& nIndex ) const
-{
- // #101701#
- Size aSize( rOutliner.CalcTextSize() );
- ::std::swap( aSize.Width(), aSize.Height() );
- Point aEEPos( SvxEditSourceHelper::UserSpaceToEE( rPos,
- aSize,
- rOutliner.IsVertical() == TRUE ));
-
- EPosition aDocPos = rOutliner.GetEditEngine().FindDocPosition( aEEPos );
-
- nPara = aDocPos.nPara;
- nIndex = aDocPos.nIndex;
-
- return sal_True;
-}
-
-sal_Bool SvxOutlinerForwarder::GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const
-{
- ESelection aRes = rOutliner.GetEditEngine().GetWord( ESelection(nPara, nIndex, nPara, nIndex), ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
-
- if( aRes.nStartPara == nPara &&
- aRes.nStartPara == aRes.nEndPara )
- {
- nStart = aRes.nStartPos;
- nEnd = aRes.nEndPos;
-
- return sal_True;
- }
-
- return sal_False;
-}
-
-sal_Bool SvxOutlinerForwarder::GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const
-{
- return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rOutliner.GetEditEngine(), nPara, nIndex );
-}
-
-USHORT SvxOutlinerForwarder::GetLineCount( USHORT nPara ) const
-{
- return static_cast < USHORT >( rOutliner.GetLineCount(nPara) );
-}
-
-USHORT SvxOutlinerForwarder::GetLineLen( USHORT nPara, USHORT nLine ) const
-{
- return rOutliner.GetLineLen(nPara, nLine);
-}
-
-sal_Bool SvxOutlinerForwarder::QuickFormatDoc( BOOL bFull )
-{
- rOutliner.QuickFormatDoc();
-
- return sal_True;
-}
-
-sal_Bool SvxOutlinerForwarder::Delete( const ESelection& rSelection )
-{
- flushCache();
- rOutliner.QuickDelete( rSelection );
- rOutliner.QuickFormatDoc();
-
- return sal_True;
-}
-
-sal_Bool SvxOutlinerForwarder::InsertText( const String& rStr, const ESelection& rSelection )
-{
- flushCache();
- rOutliner.QuickInsertText( rStr, rSelection );
- rOutliner.QuickFormatDoc();
-
- return sal_True;
-}
-
-USHORT SvxOutlinerForwarder::GetDepth( USHORT nPara ) const
-{
- DBG_ASSERT( nPara < GetParagraphCount(), "SvxOutlinerForwarder::GetDepth: Invalid paragraph index");
-
- Paragraph* pPara = rOutliner.GetParagraph( nPara );
-
- USHORT nLevel(0);
-
- if( pPara )
- {
- nLevel = rOutliner.GetDepth( nPara );
-
- if(pSdrObject != NULL)
- {
- if((pSdrObject->GetObjInventor() == SdrInventor) &&
- (pSdrObject->GetObjIdentifier() == OBJ_OUTLINETEXT))
- --nLevel;
- }
- }
-
- return nLevel;
-}
-
-sal_Bool SvxOutlinerForwarder::SetDepth( USHORT nPara, USHORT nNewDepth )
-{
- DBG_ASSERT( nPara < GetParagraphCount(), "SvxOutlinerForwarder::SetDepth: Invalid paragraph index");
-
- if(pSdrObject == NULL)
- return sal_False;
-
- const sal_Bool bOutlinerText = (pSdrObject->GetObjInventor() == SdrInventor) && (pSdrObject->GetObjIdentifier() == OBJ_OUTLINETEXT);
-
- if(bOutlinerText)
- ++nNewDepth;
-
- if(nNewDepth >= 0 && nNewDepth <= 9)
- {
- Paragraph* pPara = rOutliner.GetParagraph( nPara );
- if( pPara )
- {
- rOutliner.SetDepth( pPara, nNewDepth );
- if( bOutlinerText )
- rOutliner.SetLevelDependendStyleSheet( nPara );
-
- return sal_True;
- }
- }
-
- return sal_False;
-}
-
-//------------------------------------------------------------------------
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/unoedit/svx_unotext.cxx b/binfilter/bf_svx/source/unoedit/svx_unotext.cxx
deleted file mode 100644
index be5733d75e72..000000000000
--- a/binfilter/bf_svx/source/unoedit/svx_unotext.cxx
+++ /dev/null
@@ -1,2154 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#include <vcl/svapp.hxx>
-
-#include <com/sun/star/text/HoriOrientation.hpp>
-#include <com/sun/star/text/ControlCharacter.hpp>
-#include <com/sun/star/text/XTextField.hdl>
-
-
-
-#include <eeitem.hxx>
-
-
-#define ITEMID_FONT EE_CHAR_FONTINFO
-
-#define ITEMID_TABSTOP EE_PARA_TABS
-
-#include "svdobj.hxx"
-
-#include <bf_svtools/intitem.hxx>
-
-#define ITEMID_FIELD EE_FEATURE_FIELD
-#include <rtl/uuid.h>
-#include <rtl/memory.h>
-
-#include "unoshtxt.hxx"
-#include "unonrule.hxx"
-#include "unofdesc.hxx"
-#include "unofield.hxx"
-
-
-
-#include <bf_svx/itemdata.hxx>
-
-#include "flditem.hxx"
-#include "unoshprp.hxx"
-#include "numitem.hxx"
-#include "editeng.hxx"
-namespace binfilter {
-
-using namespace ::rtl;
-using namespace ::cppu;
-using namespace ::com::sun::star;
-
-#define QUERYINT( xint ) \
- if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
- aAny <<= uno::Reference< xint >(this)
-
-SfxItemPropertyMap aEmptyPropMap[] =
-{
- {0,0}
-};
-
-extern const SfxItemPropertyMap* ImplGetSvxTextPortionPropertyMap();
-
-// ====================================================================
-// helper fuer Item/Property Konvertierung
-// ====================================================================
-
-// Numerierung
-const unsigned short aSvxToUnoAdjust[] =
-{
- text::HoriOrientation::LEFT,
- text::HoriOrientation::RIGHT,
- text::HoriOrientation::FULL,
- text::HoriOrientation::CENTER,
- text::HoriOrientation::FULL,
- text::HoriOrientation::LEFT
-};
-
-const SvxAdjust aUnoToSvxAdjust[] =
-{
- SVX_ADJUST_LEFT,
- SVX_ADJUST_RIGHT,
- SVX_ADJUST_CENTER,
- SVX_ADJUST_LEFT,
- SVX_ADJUST_LEFT,
- SVX_ADJUST_LEFT,
- SVX_ADJUST_BLOCK
-};
-
-SvxAdjust ConvertUnoAdjust( unsigned short nAdjust ) throw()
-{
- DBG_ASSERT( nAdjust <= 7, "Enum hat sich geaendert! [CL]" );
- return aUnoToSvxAdjust[nAdjust];
-}
-
-unsigned short ConvertUnoAdjust( SvxAdjust eAdjust ) throw()
-{
- DBG_ASSERT( eAdjust <= 6, "Enum hat sich geaendert! [CL]" );
- return aSvxToUnoAdjust[eAdjust];
-}
-
-void GetSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw()
-{
- DBG_ASSERT( pForwarder, "I need a valid SvxTextForwarder!" );
- if( pForwarder )
- {
- sal_Int16 nParaCount = pForwarder->GetParagraphCount();
- if(nParaCount>0)
- nParaCount--;
-
- rSel = ESelection( 0,0, nParaCount, pForwarder->GetTextLen( nParaCount ));
- }
-}
-
-void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw()
-{
- DBG_ASSERT( pForwarder, "I need a valid SvxTextForwarder!" );
- if( pForwarder )
- {
- if( rSel.nStartPara == 0xffff )
- {
- ::binfilter::GetSelection( rSel, pForwarder );//STRIP008 ::GetSelection( rSel, pForwarder );
- }
- else
- {
- ESelection aMaxSelection;
- GetSelection( aMaxSelection, pForwarder );
-
- // check start position
- if( rSel.nStartPara < aMaxSelection.nStartPara )
- {
- rSel.nStartPara = aMaxSelection.nStartPara;
- rSel.nStartPos = aMaxSelection.nStartPos;
- }
- else if( rSel.nStartPara > aMaxSelection.nEndPara )
- {
- rSel.nStartPara = aMaxSelection.nEndPara;
- rSel.nStartPos = aMaxSelection.nEndPos;
- }
- else if( rSel.nStartPos > pForwarder->GetTextLen( rSel.nStartPara ) )
- {
- rSel.nStartPos = pForwarder->GetTextLen( rSel.nStartPara );
- }
-
- // check end position
- if( rSel.nEndPara < aMaxSelection.nStartPara )
- {
- rSel.nEndPara = aMaxSelection.nStartPara;
- rSel.nEndPos = aMaxSelection.nStartPos;
- }
- else if( rSel.nEndPara > aMaxSelection.nEndPara )
- {
- rSel.nEndPara = aMaxSelection.nEndPara;
- rSel.nEndPos = aMaxSelection.nEndPos;
- }
- else if( rSel.nEndPos > pForwarder->GetTextLen( rSel.nEndPara ) )
- {
- rSel.nEndPos = pForwarder->GetTextLen( rSel.nEndPara );
- }
- }
- }
-}
-
-// ====================================================================
-// class SvxUnoTextRangeBase
-// ====================================================================
-
-UNO3_GETIMPLEMENTATION_IMPL( SvxUnoTextRangeBase );
-
-SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SfxItemPropertyMap* _pMap ) throw()
-: aPropSet(_pMap), pEditSource(NULL)
-{
-}
-
-SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const SfxItemPropertyMap* _pMap ) throw()
-: aPropSet(_pMap)
-{
- SolarMutexGuard aGuard;
-
- DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!");
-
- pEditSource = pSource->Clone();
- ESelection aSelection;
- ::binfilter::GetSelection( aSelection, pEditSource->GetTextForwarder() );//STRIP008 ::GetSelection( aSelection, pEditSource->GetTextForwarder() );
- SetSelection( aSelection );
-}
-
-SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw()
-: aPropSet(rRange.getPropertyMap())
-{
- SolarMutexGuard aGuard;
-
- pEditSource = rRange.pEditSource ? rRange.pEditSource->Clone() : NULL;
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- aSelection = rRange.aSelection;
- CheckSelection( aSelection, pForwarder );
- }
-}
-
-SvxUnoTextRangeBase::~SvxUnoTextRangeBase() throw()
-{
- delete pEditSource;
-}
-
-void SvxUnoTextRangeBase::SetEditSource( SvxEditSource* pSource ) throw()
-{
- DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!");
- DBG_ASSERT(pEditSource==NULL,"SvxUnoTextRangeBase::SetEditSource called while SvxEditSource already set" );
-
- pEditSource = pSource;
-
- aSelection.nStartPara = 0xffff;
-}
-
-/** puts a field item with a copy of the given FieldData into the itemset
- corresponding with this range */
-void SvxUnoTextRangeBase::attachField( const SvxFieldData* pData ) throw()
-{
- SolarMutexGuard aGuard;
-
- if( pData )
- {
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- SvxFieldItem aField( *pData );
- pForwarder->QuickInsertField( aField, aSelection );
- }
- }
-}
-
-void SvxUnoTextRangeBase::SetSelection( const ESelection& rSelection ) throw()
-{
- SolarMutexGuard aGuard;
-
- aSelection = rSelection;
- CheckSelection( aSelection, pEditSource->GetTextForwarder() );
-}
-
-// Interface XTextRange ( XText )
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart(void)
- throw( uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- uno::Reference< text::XTextRange > xRange;
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
-
- CheckSelection( aSelection, pForwarder );
-
- SvxUnoTextBase* pText = SvxUnoTextBase::getImplementation( getText() );
-
- if(pText == NULL)
- throw uno::RuntimeException();
-
- SvxUnoTextRange* pRange = new SvxUnoTextRange( *pText );
- xRange = pRange;
-
- ESelection aNewSel = aSelection;
- aNewSel.nEndPara = aNewSel.nStartPara;
- aNewSel.nEndPos = aNewSel.nStartPos;
- pRange->SetSelection( aNewSel );
- }
-
- return xRange;
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd(void)
- throw( uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- uno::Reference< text::XTextRange > xRet;
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- CheckSelection( aSelection, pForwarder );
-
- SvxUnoTextBase* pText = SvxUnoTextBase::getImplementation( getText() );
-
- if(pText == NULL)
- throw uno::RuntimeException();
-
- SvxUnoTextRange* pNew = new SvxUnoTextRange( *pText );
- xRet = pNew;
-
- ESelection aNewSel = aSelection;
- aNewSel.nStartPara = aNewSel.nEndPara;
- aNewSel.nStartPos = aNewSel.nEndPos;
- pNew->SetSelection( aNewSel );
- }
- return xRet;
-}
-
-OUString SAL_CALL SvxUnoTextRangeBase::getString(void)
- throw( uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- CheckSelection( aSelection, pForwarder );
-
- return pForwarder->GetText( aSelection );
- }
- else
- {
- const OUString aEmpty;
- return aEmpty;
- }
-}
-
-void SAL_CALL SvxUnoTextRangeBase::setString(const OUString& aString)
- throw( uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- CheckSelection( aSelection, pForwarder );
-
- String aConverted( aString );
- aConverted.ConvertLineEnd( LINEEND_LF ); // Zeilenenden nur einfach zaehlen
-
- pForwarder->QuickInsertText( aConverted, aSelection );
- pEditSource->UpdateData();
-
- // Selektion anpassen
- //! Wenn die EditEngine bei QuickInsertText die Selektion zurueckgeben wuerde,
- //! waer's einfacher...
- CollapseToStart();
-
- sal_uInt16 nLen = aConverted.Len();
- if (nLen)
- GoRight( nLen, sal_True );
- }
-}
-
-// Interface beans::XPropertySet
-uno::Reference< beans::XPropertySetInfo > SAL_CALL SvxUnoTextRangeBase::getPropertySetInfo(void)
- throw( uno::RuntimeException )
-{
- return aPropSet.getPropertySetInfo();
-}
-
-void SAL_CALL SvxUnoTextRangeBase::setPropertyValue(const OUString& PropertyName, const uno::Any& aValue)
- throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
-{
- _setPropertyValue( PropertyName, aValue, -1 );
-}
-
-void SAL_CALL SvxUnoTextRangeBase::_setPropertyValue( const OUString& PropertyName, const uno::Any& aValue, sal_Int32 nPara )
- throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
-
- CheckSelection( aSelection, pForwarder );
-
- const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(aPropSet.getPropertyMap(), PropertyName );
- if ( pMap )
- {
- ESelection aSel( GetSelection() );
- sal_Bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
-
- if( nPara == -1 && !bParaAttrib )
- {
- SfxItemSet aOldSet( pForwarder->GetAttribs( aSel ) );
- // we have a selection and no para attribute
- SfxItemSet aNewSet( *aOldSet.GetPool(), aOldSet.GetRanges() );
-
- setPropertyValue( pMap, aValue, aSelection, aOldSet, aNewSet );
-
-
- pForwarder->QuickSetAttribs( aNewSet, GetSelection() );
- }
- else
- {
- sal_Int32 nEndPara;
-
- if( nPara == -1 )
- {
- nPara = aSel.nStartPara;
- nEndPara = aSel.nEndPara;
- }
- else
- {
- // only one paragraph
- nEndPara = nPara;
- }
-
- while( nPara <= nEndPara )
- {
- // we have a paragraph
- SfxItemSet aSet( pForwarder->GetParaAttribs( (USHORT)nPara ) );
- setPropertyValue( pMap, aValue, aSelection, aSet, aSet );
- pForwarder->SetParaAttribs( (USHORT)nPara, aSet );
- nPara++;
- }
- }
-
- GetEditSource()->UpdateData();
- return;
- }
- }
-
- throw beans::UnknownPropertyException();
-}
-
-void SvxUnoTextRangeBase::setPropertyValue( const SfxItemPropertyMap* pMap, const uno::Any& rValue, const ESelection& rSelection, const SfxItemSet& rOldSet, SfxItemSet& rNewSet ) throw( beans::UnknownPropertyException, lang::IllegalArgumentException )
-{
- if(!SetPropertyValueHelper( rOldSet, pMap, rValue, rNewSet, &rSelection, (SvxTextEditSource*)GetEditSource() ))
- {
- // Fuer Teile von zusammengesetzten Items mit mehreren Properties (z.B. Hintergrund)
- // muss vorher das alte Item aus dem Dokument geholt werden
- rNewSet.Put(rOldSet.Get(pMap->nWID)); // altes Item in neuen Set
- aPropSet.setPropertyValue(pMap, rValue, rNewSet);
- }
-}
-
-sal_Bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemSet& rOldSet, const SfxItemPropertyMap* pMap, const uno::Any& aValue, SfxItemSet& rNewSet, const ESelection* pSelection /* = NULL */, SvxTextEditSource* pEditSource /* = NULL*/ ) throw( uno::RuntimeException )
-{
- switch( pMap->nWID )
- {
- case WID_FONTDESC:
- {
- awt::FontDescriptor aDesc;
- if(aValue >>= aDesc)
- {
- SvxUnoFontDescriptor::FillItemSet( aDesc, rNewSet );
- return sal_True;
- }
- }
- break;
-
- case EE_PARA_NUMBULLET:
- {
- uno::Reference< container::XIndexReplace > xRule;
- if( !aValue.hasValue() || ((aValue >>= xRule) && !xRule.is()) )
- return sal_True;
-
- return sal_False;
- }
- break;
-
- case WID_NUMLEVEL:
- {
- SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
- if(pForwarder && pSelection)
- {
- sal_Int16 nLevel;
- if( aValue >>= nLevel )
- {
- // #101004# Call interface method instead of unsafe cast
- if(! pForwarder->SetDepth( pSelection->nStartPara, nLevel ) )
- throw lang::IllegalArgumentException();
-
- return sal_True;
- }
- }
- }
- break;
- case EE_PARA_BULLETSTATE:
- {
- sal_Bool bBullet;
- if( aValue >>= bBullet )
- {
- SfxUInt16Item aItem( EE_PARA_BULLETSTATE, bBullet );
- rNewSet.Put(aItem);
- return sal_True;
- }
- }
- break;
-
- default:
- return sal_False;
- }
-
- throw lang::IllegalArgumentException();
- return sal_False;
-}
-
-uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyValue(const OUString& PropertyName)
- throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
-{
- return _getPropertyValue( PropertyName, -1 );
-}
-
-uno::Any SAL_CALL SvxUnoTextRangeBase::_getPropertyValue(const OUString& PropertyName, sal_Int32 nPara )
- throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- uno::Any aAny;
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(aPropSet.getPropertyMap(), PropertyName );
- if( pMap )
- {
- SfxItemSet* pAttribs = NULL;
- if( nPara != -1 )
- pAttribs = pForwarder->GetParaAttribs( (USHORT)nPara ).Clone();
- else
- pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
-
- // Dontcare durch Default ersetzen, damit man immer eine Reflection hat
- pAttribs->ClearInvalidItems();
-
- getPropertyValue( pMap, aAny, *pAttribs );
-
- delete pAttribs;
- return aAny;
- }
- }
-
- throw beans::UnknownPropertyException();
- return aAny;
-}
-
-void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertyMap* pMap, uno::Any& rAny, const SfxItemSet& rSet ) throw( beans::UnknownPropertyException )
-{
- switch( pMap->nWID )
- {
- case EE_FEATURE_FIELD:
- if ( rSet.GetItemState( EE_FEATURE_FIELD, sal_False ) == SFX_ITEM_SET )
- {
- SvxFieldItem* pItem = (SvxFieldItem*)rSet.GetItem( EE_FEATURE_FIELD );
- const SvxFieldData* pData = pItem->GetField();
- uno::Reference< text::XTextRange > xAnchor( this );
-
- // get presentation string for field
- Color* pTColor = NULL;
- Color* pFColor = NULL;
-
- SvxTextForwarder* pForwarder = pEditSource->GetTextForwarder();
- OUString aPresentation( pForwarder->CalcFieldValue( *pData, aSelection.nStartPara, aSelection.nStartPos, pTColor, pFColor ) );
-
- delete pTColor;
- delete pFColor;
-
- uno::Reference< text::XTextField > xField( new SvxUnoTextField( xAnchor, aPresentation, pData ) );
- rAny <<= xField;
- }
- break;
-
- case WID_PORTIONTYPE:
- if ( rSet.GetItemState( EE_FEATURE_FIELD, sal_False ) == SFX_ITEM_SET )
- {
- OUString aType( RTL_CONSTASCII_USTRINGPARAM("TextField") );
- rAny <<= aType;
- }
- else
- {
- OUString aType( RTL_CONSTASCII_USTRINGPARAM("Text") );
- rAny <<= aType;
- }
- break;
-
- default:
- if(!GetPropertyValueHelper( *((SfxItemSet*)(&rSet)), pMap, rAny, &aSelection, (SvxTextEditSource*)GetEditSource() ))
- rAny = aPropSet.getPropertyValue(pMap, rSet);
- }
-}
-
-sal_Bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet& rSet, const SfxItemPropertyMap* pMap, uno::Any& aAny, const ESelection* pSelection /* = NULL */, SvxTextEditSource* pEditSource /* = NULL */ )
- throw( uno::RuntimeException )
-{
- switch( pMap->nWID )
- {
- case WID_FONTDESC:
- {
- awt::FontDescriptor aDesc;
- SvxUnoFontDescriptor::FillFromItemSet( rSet, aDesc );
- aAny <<= aDesc;
- }
- break;
-
- case EE_PARA_NUMBULLET:
- {
- if((rSet.GetItemState( EE_PARA_NUMBULLET, sal_True ) & (SFX_ITEM_SET|SFX_ITEM_DEFAULT)) == 0)
- throw uno::RuntimeException();
-
- SvxNumBulletItem* pBulletItem = (SvxNumBulletItem*)rSet.GetItem( EE_PARA_NUMBULLET, sal_True );
-
- if( pBulletItem == NULL )
- throw uno::RuntimeException();
-
- aAny <<= SvxCreateNumRule( pBulletItem->GetNumRule() );
- }
- break;
-
- case WID_NUMLEVEL:
- {
- SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
- if(pForwarder && pSelection)
- {
- // #101004# Call interface method instead of unsafe cast
- sal_Int16 nLevel( pForwarder->GetDepth( pSelection->nStartPara ) );
- aAny <<= nLevel;
- }
- }
- break;
- case EE_PARA_BULLETSTATE:
- {
- sal_Bool bState = sal_False;
- if( rSet.GetItemState( EE_PARA_BULLETSTATE, sal_True ) & (SFX_ITEM_SET|SFX_ITEM_DEFAULT))
- {
- SfxUInt16Item* pItem = (SfxUInt16Item*)rSet.GetItem( EE_PARA_BULLETSTATE, sal_True );
- bState = pItem->GetValue() == TRUE;
- }
-
- aAny.setValue( &bState, ::getCppuBooleanType() );
- }
- break;
- default:
-
- return sal_False;
- }
-
- return sal_True;
-}
-
-// wird (noch) nicht unterstuetzt
-void SAL_CALL SvxUnoTextRangeBase::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-void SAL_CALL SvxUnoTextRangeBase::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-void SAL_CALL SvxUnoTextRangeBase::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-void SAL_CALL SvxUnoTextRangeBase::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
-
-// XMultiPropertySet
-void SAL_CALL SvxUnoTextRangeBase::setPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues ) throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- _setPropertyValues( aPropertyNames, aValues, -1 );
-}
-
-void SAL_CALL SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues, sal_Int32 nPara ) throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- CheckSelection( aSelection, pForwarder );
-
- ESelection aSel( GetSelection() );
-
- sal_Bool bUnknownProperty = sal_False;
-
- const OUString* pPropertyNames = aPropertyNames.getConstArray();
- const uno::Any* pValues = aValues.getConstArray();
- sal_Int32 nCount = aPropertyNames.getLength();
-
- sal_Int32 nEndPara = nPara;
- sal_Int32 nTempPara = nPara;
-
- if( nTempPara == -1 )
- {
- nTempPara = aSel.nStartPara;
- nEndPara = aSel.nEndPara;
- }
-
- SfxItemSet* pOldAttrSet = NULL;
- SfxItemSet* pNewAttrSet = NULL;
-
- SfxItemSet* pOldParaSet = NULL;
- SfxItemSet* pNewParaSet = NULL;
-
- const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
-
- for( ; nCount; nCount--, pPropertyNames++, pValues++ )
- {
- pMap = SfxItemPropertyMap::GetByName(pMap, *pPropertyNames );
- if( NULL == pMap )
- {
- bUnknownProperty = sal_True;
- break;
- }
-
- sal_Bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
-
- if( (nPara == -1) && !bParaAttrib )
- {
- if( NULL == pNewAttrSet )
- {
- const SfxItemSet aSet( pForwarder->GetAttribs( aSel ) );
- pOldAttrSet = new SfxItemSet( aSet );
- pNewAttrSet = new SfxItemSet( *pOldAttrSet->GetPool(), pOldAttrSet->GetRanges() );
- }
-
- setPropertyValue( pMap, *pValues, GetSelection(), *pOldAttrSet, *pNewAttrSet );
-
- if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
- {
- const SfxPoolItem* pItem;
- if( pNewAttrSet->GetItemState( pMap->nWID, sal_True, &pItem ) == SFX_ITEM_SET )
- {
- pOldAttrSet->Put( *pItem );
- }
- }
- }
- else
- {
- if( NULL == pNewParaSet )
- {
- const SfxItemSet aSet( pForwarder->GetParaAttribs( (USHORT)nTempPara ) );
- pOldParaSet = new SfxItemSet( aSet );
- pNewParaSet = new SfxItemSet( *pOldParaSet->GetPool(), pOldParaSet->GetRanges() );
- }
-
- setPropertyValue( pMap, *pValues, GetSelection(), *pOldParaSet, *pNewParaSet );
-
- if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
- {
- const SfxPoolItem* pItem;
- if( pNewParaSet->GetItemState( pMap->nWID, sal_True, &pItem ) == SFX_ITEM_SET )
- {
- pOldParaSet->Put( *pItem );
- }
- }
-
- }
-
- if (pMap)
- pMap++;
- else
- pMap = aPropSet.getPropertyMap();
- }
-
- if( !bUnknownProperty )
- {
- sal_Bool bNeedsUpdate = sal_False;
-
- if( pNewParaSet )
- {
-
- if( pNewParaSet->Count() )
- {
- while( nTempPara <= nEndPara )
- {
- SfxItemSet aSet( pForwarder->GetParaAttribs( (USHORT)nTempPara ) );
- aSet.Put( *pNewParaSet );
- pForwarder->SetParaAttribs( (USHORT)nTempPara, aSet );
- nTempPara++;
- }
- bNeedsUpdate = sal_True;
- }
-
- delete pNewParaSet;
- delete pOldParaSet;
- }
-
- if( pNewAttrSet )
- {
- if( pNewAttrSet->Count() )
- {
- pForwarder->QuickSetAttribs( *pNewAttrSet, GetSelection() );
- bNeedsUpdate = sal_True;
- }
- delete pNewAttrSet;
- delete pOldAttrSet;
-
- }
-
- if( bNeedsUpdate )
- GetEditSource()->UpdateData();
- }
-
- if( bUnknownProperty )
- throw beans::UnknownPropertyException();
- }
-}
-
-uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::getPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (uno::RuntimeException)
-{
- return _getPropertyValues( aPropertyNames, -1 );
-}
-
-uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::_getPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames, sal_Int32 nPara ) throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- sal_Int32 nCount = aPropertyNames.getLength();
-
-
- uno::Sequence< uno::Any > aValues( nCount );
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- SfxItemSet* pAttribs = NULL;
- if( nPara != -1 )
- pAttribs = pForwarder->GetParaAttribs( (USHORT)nPara ).Clone();
- else
- pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
-
- pAttribs->ClearInvalidItems();
-
- const OUString* pPropertyNames = aPropertyNames.getConstArray();
- uno::Any* pValues = aValues.getArray();
-
- const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
-
- for( ; nCount; nCount--, pPropertyNames++, pValues++ )
- {
- pMap = SfxItemPropertyMap::GetByName(pMap, *pPropertyNames );
- if( NULL == pMap )
- throw beans::UnknownPropertyException();
-
- getPropertyValue( pMap, *pValues, *pAttribs );
-
- if (pMap)
- pMap++;
- else
- pMap = aPropSet.getPropertyMap();
- }
-
- delete pAttribs;
-
- }
-
- return aValues;
-}
-
-void SAL_CALL SvxUnoTextRangeBase::addPropertiesChangeListener( const uno::Sequence< ::rtl::OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener ) throw (uno::RuntimeException)
-{
-}
-
-void SAL_CALL SvxUnoTextRangeBase::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& xListener ) throw (uno::RuntimeException)
-{
-}
-
-void SAL_CALL SvxUnoTextRangeBase::firePropertiesChangeEvent( const uno::Sequence< ::rtl::OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener ) throw (uno::RuntimeException)
-{
-}
-
-// beans::XPropertyState
-beans::PropertyState SAL_CALL SvxUnoTextRangeBase::getPropertyState( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- return _getPropertyState( PropertyName, -1 );
-}
-
-static sal_uInt16 aSvxUnoFontDescriptorWhichMap[] = { EE_CHAR_FONTINFO, EE_CHAR_FONTHEIGHT, EE_CHAR_ITALIC,
- EE_CHAR_UNDERLINE, EE_CHAR_WEIGHT, EE_CHAR_STRIKEOUT,
- EE_CHAR_WLM, 0 };
-
-beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const OUString& PropertyName, sal_Int32 nPara /* = -1 */)
- throw( beans::UnknownPropertyException, uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(aPropSet.getPropertyMap(), PropertyName );
- if ( pMap )
- {
- SfxItemState eItemState = SFX_ITEM_UNKNOWN;
- sal_uInt16 nWID = 0;
-
- switch( pMap->nWID )
- {
- case WID_FONTDESC:
- {
- sal_uInt16* pWhichId = aSvxUnoFontDescriptorWhichMap;
- SfxItemState eTempItemState;
- while( *pWhichId )
- {
- if(nPara != -1)
- eTempItemState = pForwarder->GetItemState( (USHORT)nPara, *pWhichId );
- else
- eTempItemState = pForwarder->GetItemState( GetSelection(), *pWhichId );
-
- switch( eTempItemState )
- {
- case SFX_ITEM_DISABLED:
- case SFX_ITEM_DONTCARE:
- eItemState = SFX_ITEM_DONTCARE;
- break;
-
- case SFX_ITEM_DEFAULT:
- if( eItemState != SFX_ITEM_DEFAULT )
- {
- if( eItemState == SFX_ITEM_UNKNOWN )
- eItemState = SFX_ITEM_DEFAULT;
- }
- break;
-
- case SFX_ITEM_READONLY:
- case SFX_ITEM_SET:
- if( eItemState != SFX_ITEM_SET )
- {
- if( eItemState == SFX_ITEM_UNKNOWN )
- eItemState = SFX_ITEM_SET;
- }
- break;
- default:
- throw beans::UnknownPropertyException();
- }
-
- pWhichId++;
- }
- }
- break;
-
- case WID_NUMLEVEL:
- eItemState = SFX_ITEM_SET;
- break;
-
- default:
- nWID = pMap->nWID;
- }
-
- if( nWID != 0 )
- {
- if( nPara != -1 )
- eItemState = pForwarder->GetItemState( (USHORT)nPara, nWID );
- else
- eItemState = pForwarder->GetItemState( GetSelection(), nWID );
- }
-
- switch( eItemState )
- {
- case SFX_ITEM_DONTCARE:
- case SFX_ITEM_DISABLED:
- return beans::PropertyState_AMBIGUOUS_VALUE;
- case SFX_ITEM_READONLY:
- case SFX_ITEM_SET:
- return beans::PropertyState_DIRECT_VALUE;
- case SFX_ITEM_DEFAULT:
- return beans::PropertyState_DEFAULT_VALUE;
-// case SFX_ITEM_UNKNOWN:
- }
- }
- }
- throw beans::UnknownPropertyException();
-}
-
-uno::Sequence< beans::PropertyState > SAL_CALL SvxUnoTextRangeBase::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
- throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- return _getPropertyStates( aPropertyName, -1 );
-}
-
-uno::Sequence< beans::PropertyState > SvxUnoTextRangeBase::_getPropertyStates(const uno::Sequence< OUString >& PropertyName, sal_Int32 nPara /* = -1 */)
- throw( beans::UnknownPropertyException, uno::RuntimeException )
-{
- const sal_Int32 nCount = PropertyName.getLength();
- const OUString* pNames = PropertyName.getConstArray();
-
- uno::Sequence< beans::PropertyState > aRet( nCount );
- beans::PropertyState* pState = aRet.getArray();
-
-
-
- const sal_Bool bPara = nPara != -1;
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- SfxItemSet* pSet = NULL;
- if( nPara != -1 )
- {
- const SfxItemSet aSet( pForwarder->GetParaAttribs( (USHORT)nPara ) );
- pSet = new SfxItemSet( aSet );
- }
- else
- {
- ESelection aSel( GetSelection() );
- CheckSelection( aSel, pForwarder );
- const SfxItemSet aSet(pForwarder->GetAttribs( aSel, EditEngineAttribs_OnlyHard ) );
- pSet = new SfxItemSet( aSet );
- }
-
- sal_Bool bUnknownPropertyFound = sal_False;
- const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
- for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
- {
- pMap = SfxItemPropertyMap::GetByName(pMap, *pNames++ );
- if( NULL == pMap )
- {
- bUnknownPropertyFound = sal_True;
- break;
- }
-
- SfxItemState eItemState = SFX_ITEM_UNKNOWN;
- sal_uInt16 nWID = 0;
-
- switch( pMap->nWID )
- {
- case WID_FONTDESC:
- {
- sal_uInt16* pWhichId = aSvxUnoFontDescriptorWhichMap;
- SfxItemState eTempItemState;
- while( *pWhichId )
- {
- eTempItemState = pSet->GetItemState( *pWhichId );
-
- switch( eTempItemState )
- {
- case SFX_ITEM_DISABLED:
- case SFX_ITEM_DONTCARE:
- eItemState = SFX_ITEM_DONTCARE;
- break;
-
- case SFX_ITEM_DEFAULT:
- if( eItemState != SFX_ITEM_DEFAULT )
- {
- if( eItemState == SFX_ITEM_UNKNOWN )
- eItemState = SFX_ITEM_DEFAULT;
- }
- break;
-
- case SFX_ITEM_READONLY:
- case SFX_ITEM_SET:
- if( eItemState != SFX_ITEM_SET )
- {
- if( eItemState == SFX_ITEM_UNKNOWN )
- eItemState = SFX_ITEM_SET;
- }
- break;
- default:
- bUnknownPropertyFound = sal_True;
- break;
- }
-
- pWhichId++;
- }
- }
- break;
-
- case WID_NUMLEVEL:
- eItemState = SFX_ITEM_SET;
- break;
-
- default:
- nWID = pMap->nWID;
- }
-
- if( bUnknownPropertyFound )
- break;
-
- if( nWID != 0 )
- eItemState = pSet->GetItemState( nWID, sal_False );
-
- switch( eItemState )
- {
- case SFX_ITEM_READONLY:
- case SFX_ITEM_SET:
- *pState++ = beans::PropertyState_DIRECT_VALUE;
- break;
- case SFX_ITEM_DEFAULT:
- *pState++ = beans::PropertyState_DEFAULT_VALUE;
- break;
-// case SFX_ITEM_UNKNOWN:
-// case SFX_ITEM_DONTCARE:
-// case SFX_ITEM_DISABLED:
- default:
- *pState++ = beans::PropertyState_AMBIGUOUS_VALUE;
- }
-
- if (pMap)
- pMap++;
- else
- pMap = aPropSet.getPropertyMap();
- }
-
- delete pSet;
-
- if( bUnknownPropertyFound )
- throw beans::UnknownPropertyException();
- }
-
- return aRet;
-}
-
-void SAL_CALL SvxUnoTextRangeBase::setPropertyToDefault( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- _setPropertyToDefault( PropertyName, -1 );
-}
-
-void SvxUnoTextRangeBase::_setPropertyToDefault(const OUString& PropertyName, sal_Int32 nPara /* = -1 */)
- throw( beans::UnknownPropertyException, uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- do
- {
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
-
- if( NULL == pForwarder )
- break;
-
- CheckSelection( aSelection, pEditSource->GetTextForwarder() );
-
- const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(aPropSet.getPropertyMap(), PropertyName );
- if( NULL == pMap )
- break;
-
- SfxItemSet aSet( *pForwarder->GetPool(), TRUE );
-
- if( pMap->nWID == WID_FONTDESC )
- {
- SvxUnoFontDescriptor::setPropertyToDefault( aSet );
- }
- else if( pMap->nWID == WID_NUMLEVEL )
- {
- // #101004# Call interface method instead of unsafe cast
- pForwarder->SetDepth( aSelection.nStartPara, 0 );
- return;
- }
- else
- {
- aSet.InvalidateItem( pMap->nWID );
- }
-
- if(nPara != -1)
- pForwarder->SetParaAttribs( (USHORT)nPara, aSet );
- else
- pForwarder->QuickSetAttribs( aSet, GetSelection() );
-
- GetEditSource()->UpdateData();
-
- return;
- }
- while(0);
-
- throw beans::UnknownPropertyException();
-}
-
-uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aPropertyName )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(aPropSet.getPropertyMap(), aPropertyName );
- if( pMap )
- {
- SfxItemPool* pPool = pForwarder->GetPool();
-
- switch( pMap->nWID )
- {
- case WID_FONTDESC:
- return SvxUnoFontDescriptor::getPropertyDefault( pPool );
-
- case WID_NUMLEVEL:
- {
- uno::Any aValue;
- aValue <<= (sal_Int16)0;
- return aValue;
- }
- default:
- {
- // Default aus ItemPool holen
- if(pPool->IsWhich(pMap->nWID))
- {
- SfxItemSet aSet( *pPool, pMap->nWID, pMap->nWID);
- aSet.Put(pPool->GetDefaultItem(pMap->nWID));
- return aPropSet.getPropertyValue(pMap, aSet);
- }
- }
- }
- }
- }
- throw beans::UnknownPropertyException();
-}
-
-// internal
-void SvxUnoTextRangeBase::CollapseToStart(void) throw()
-{
- CheckSelection( aSelection, pEditSource->GetTextForwarder() );
-
- aSelection.nEndPara = aSelection.nStartPara;
- aSelection.nEndPos = aSelection.nStartPos;
-}
-
-void SvxUnoTextRangeBase::CollapseToEnd(void) throw()
-{
- CheckSelection( aSelection, pEditSource->GetTextForwarder() );
-
- aSelection.nStartPara = aSelection.nEndPara;
- aSelection.nStartPos = aSelection.nEndPos;
-}
-
-sal_Bool SvxUnoTextRangeBase::IsCollapsed(void) throw()
-{
- CheckSelection( aSelection, pEditSource->GetTextForwarder() );
-
- return ( aSelection.nStartPara == aSelection.nEndPara &&
- aSelection.nStartPos == aSelection.nEndPos );
-}
-
-sal_Bool SvxUnoTextRangeBase::GoLeft(sal_Int16 nCount, sal_Bool Expand) throw()
-{
- CheckSelection( aSelection, pEditSource->GetTextForwarder() );
-
- // #75098# use end position, as in Writer (start is anchor, end is cursor)
- sal_uInt16 nNewPos = aSelection.nEndPos;
- sal_uInt16 nNewPar = aSelection.nEndPara;
-
- sal_Bool bOk = sal_True;
- SvxTextForwarder* pForwarder = NULL;
- while ( nCount > nNewPos && bOk )
- {
- if ( nNewPar == 0 )
- bOk = sal_False;
- else
- {
- if ( !pForwarder )
- pForwarder = pEditSource->GetTextForwarder(); // erst hier, wenn's noetig ist...
-
- --nNewPar;
- nCount -= nNewPos + 1;
- nNewPos = pForwarder->GetTextLen( nNewPar );
- }
- }
-
- if ( bOk )
- {
- nNewPos -= nCount;
- aSelection.nStartPara = nNewPar;
- aSelection.nStartPos = nNewPos;
- }
-
- if (!Expand)
- CollapseToStart();
-
- return bOk;
-}
-
-sal_Bool SvxUnoTextRangeBase::GoRight(sal_Int16 nCount, sal_Bool Expand) throw()
-{
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- CheckSelection( aSelection, pForwarder );
-
-
- sal_uInt16 nNewPos = aSelection.nEndPos + nCount; //! Ueberlauf ???
- sal_uInt16 nNewPar = aSelection.nEndPara;
-
- sal_Bool bOk = sal_True;
- sal_uInt16 nParCount = pForwarder->GetParagraphCount();
- sal_uInt16 nThisLen = pForwarder->GetTextLen( nNewPar );
- while ( nNewPos > nThisLen && bOk )
- {
- if ( nNewPar + 1 >= nParCount )
- bOk = sal_False;
- else
- {
- nNewPos -= nThisLen+1;
- ++nNewPar;
- nThisLen = pForwarder->GetTextLen( nNewPar );
- }
- }
-
- if (bOk)
- {
- aSelection.nEndPara = nNewPar;
- aSelection.nEndPos = nNewPos;
- }
-
- if (!Expand)
- CollapseToEnd();
-
- return bOk;
- }
- return sal_False;
-}
-
-void SvxUnoTextRangeBase::GotoStart(sal_Bool Expand) throw()
-{
- aSelection.nStartPara = 0;
- aSelection.nStartPos = 0;
-
- if (!Expand)
- CollapseToStart();
-}
-
-void SvxUnoTextRangeBase::GotoEnd(sal_Bool Expand) throw()
-{
- CheckSelection( aSelection, pEditSource->GetTextForwarder() );
-
- SvxTextForwarder* pForwarder = pEditSource ? pEditSource->GetTextForwarder() : NULL;
- if( pForwarder )
- {
-
- sal_uInt16 nPar = pForwarder->GetParagraphCount();
- if (nPar)
- --nPar;
-
- aSelection.nEndPara = nPar;
- aSelection.nEndPos = pForwarder->GetTextLen( nPar );
-
- if (!Expand)
- CollapseToEnd();
- }
-}
-
-// lang::XServiceInfo
-sal_Bool SAL_CALL SvxUnoTextRangeBase::supportsService( const OUString& ServiceName )
- throw(uno::RuntimeException)
-{
- return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
-}
-
-uno::Sequence< OUString > SAL_CALL SvxUnoTextRangeBase::getSupportedServiceNames()
- throw(uno::RuntimeException)
-{
- uno::Sequence< OUString > aSeq;
- SvxServiceInfoHelper::addToSequence( aSeq, 3, "com.sun.star.style.CharacterProperties",
- "com.sun.star.style.CharacterPropertiesComplex",
- "com.sun.star.style.CharacterPropertiesAsian");
- return aSeq;
-}
-
-
-// ====================================================================
-// class SvxUnoTextRange
-// ====================================================================
-
-uno::Sequence< uno::Type > SvxUnoTextRange::maTypeSequence;
-
-SvxUnoTextRange::SvxUnoTextRange( const SvxUnoTextBase& rParent, sal_Bool bPortion /* = sal_False */ ) throw()
-:SvxUnoTextRangeBase( rParent.GetEditSource(), bPortion ? ImplGetSvxTextPortionPropertyMap() : rParent.getPropertyMap() ),
- mbPortion( bPortion )
-{
- xParentText = (text::XText*)&rParent;
-}
-
-SvxUnoTextRange::~SvxUnoTextRange() throw()
-{
-}
-
-uno::Any SAL_CALL SvxUnoTextRange::queryAggregation( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- uno::Any aAny;
-
- QUERYINT( text::XTextRange );
- else if( rType == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) )
- aAny <<= uno::Reference< beans::XPropertySet >(this);
- else QUERYINT( beans::XPropertyState );
- else if( rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0) )
- aAny <<= uno::Reference< beans::XMultiPropertySet >(this);
- else QUERYINT( lang::XServiceInfo );
- else QUERYINT( lang::XTypeProvider );
- else QUERYINT( lang::XUnoTunnel );
- else
- return OWeakAggObject::queryAggregation( rType );
-
- return aAny;
-}
-
-uno::Any SAL_CALL SvxUnoTextRange::queryInterface( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- return OWeakAggObject::queryInterface(rType);
-}
-
-void SAL_CALL SvxUnoTextRange::acquire()
- throw( )
-{
- OWeakAggObject::acquire();
-}
-
-void SAL_CALL SvxUnoTextRange::release()
- throw( )
-{
- OWeakAggObject::release();
-}
-
-// XTypeProvider
-
-uno::Sequence< uno::Type > SAL_CALL SvxUnoTextRange::getTypes()
- throw (uno::RuntimeException)
-{
- if( maTypeSequence.getLength() == 0 )
- {
- maTypeSequence.realloc( 7 ); // !DANGER! keep this updated
- uno::Type* pTypes = maTypeSequence.getArray();
-
- *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0);
- }
- return maTypeSequence;
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextRange::getImplementationId()
- throw (uno::RuntimeException)
-{
- static uno::Sequence< sal_Int8 > aId;
- if( aId.getLength() == 0 )
- {
- aId.realloc( 16 );
- rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
- }
- return aId;
-}
-
-// XTextRange
-uno::Reference< text::XText > SAL_CALL SvxUnoTextRange::getText()
- throw(uno::RuntimeException)
-{
- return xParentText;
-}
-
-// lang::XServiceInfo
-OUString SAL_CALL SvxUnoTextRange::getImplementationName()
- throw(uno::RuntimeException)
-{
- return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextRange"));
-}
-
-// ====================================================================
-// class SvxUnoText
-// ====================================================================
-
-// UNO3_GETIMPLEMENTATION2_IMPL( SvxUnoText, SvxUnoTextRangeBase );
-
-uno::Sequence< uno::Type > SvxUnoTextBase::maTypeSequence;
-
-SvxUnoTextBase::SvxUnoTextBase( const SfxItemPropertyMap* _pMap ) throw()
-: SvxUnoTextRangeBase( _pMap )
-{
-}
-
-SvxUnoTextBase::SvxUnoTextBase( const SvxEditSource* pSource, const SfxItemPropertyMap* _pMap, uno::Reference < text::XText > xParent ) throw()
-: SvxUnoTextRangeBase( pSource, _pMap )
-{
- xParentText = xParent;
- ESelection aSelection;
- ::binfilter::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );//STRIP008 ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
- SetSelection( aSelection );
-}
-
-SvxUnoTextBase::SvxUnoTextBase( const SvxUnoTextBase& rText ) throw()
-:SvxUnoTextRangeBase( rText )
-{
- xParentText = rText.xParentText;
-}
-
-SvxUnoTextBase::~SvxUnoTextBase() throw()
-{
-}
-
-sal_Bool SvxUnoTextBase::queryAggregation( const uno::Type & rType, uno::Any& aAny )
-{
- QUERYINT( text::XText );
- else QUERYINT( text::XSimpleText );
- else if( rType == ::getCppuType((const uno::Reference< text::XTextRange >*)0) )
- aAny <<= uno::Reference< text::XTextRange >((text::XText*)(this));
- else QUERYINT(container::XEnumerationAccess );
- else QUERYINT( container::XElementAccess );
- else QUERYINT( beans::XPropertySet );
- else QUERYINT( beans::XMultiPropertySet );
- else QUERYINT( beans::XPropertyState );
- else QUERYINT( lang::XServiceInfo );
- else QUERYINT( text::XTextRangeMover );
- else QUERYINT( lang::XTypeProvider );
- else QUERYINT( lang::XUnoTunnel );
- else
- return sal_False;
-
- return sal_True;
-}
-
-// XInterface
-uno::Any SAL_CALL SvxUnoTextBase::queryAggregation( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- uno::Any aAny;
- queryAggregation( rType, aAny );
- return aAny;
-}
-
-// XTypeProvider
-
-uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getStaticTypes() throw()
-{
- if( maTypeSequence.getLength() == 0 )
- {
- maTypeSequence.realloc( 9 ); // !DANGER! keep this updated
- uno::Type* pTypes = maTypeSequence.getArray();
-
- *pTypes++ = ::getCppuType(( const uno::Reference< text::XText >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeMover >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0);
- }
- return maTypeSequence;
-}
-
-uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getTypes()
- throw (uno::RuntimeException)
-{
- return getStaticTypes();
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextBase::getImplementationId()
- throw (uno::RuntimeException)
-{
- static uno::Sequence< sal_Int8 > aId;
- if( aId.getLength() == 0 )
- {
- aId.realloc( 16 );
- rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
- }
- return aId;
-}
-
-// XSimpleText
-
-uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursor()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return new SvxUnoTextCursor( *this );
-}
-
-uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursorByRange( const uno::Reference< text::XTextRange >& aTextPosition )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- SvxUnoTextCursor* pCursor = new SvxUnoTextCursor( *this );
- uno::Reference< text::XTextCursor > xCursor( pCursor );
-
- if( aTextPosition.is() )
- {
- SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( aTextPosition );
- if(pRange)
- pCursor->SetSelection( pRange->GetSelection() );
- }
-
- return xCursor;
-}
-
-void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if( !xRange.is() )
- return;
-
- ESelection aSelection;
- ::binfilter::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );//STRIP008 ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
- SetSelection( aSelection );
-
- SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
- if(pRange)
- {
- // setString am SvxUnoTextRangeBase statt selber QuickInsertText und UpdateData,
- // damit die Selektion am SvxUnoTextRangeBase angepasst wird.
- //! Eigentlich muessten alle Cursor-Objekte dieses Textes angepasst werden!
-
- if (!bAbsorb) // nicht ersetzen -> hinten anhaengen
- pRange->CollapseToEnd();
-
- pRange->setString( aString );
-
- pRange->CollapseToEnd();
- }
-}
-
-void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb )
- throw(lang::IllegalArgumentException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
-
- if( pForwarder )
- {
- ESelection aSelection;
- ::binfilter::GetSelection( aSelection, pForwarder );//STRIP008 ::GetSelection( aSelection, pForwarder );
- SetSelection( aSelection );
-
- switch( nControlCharacter )
- {
- case text::ControlCharacter::PARAGRAPH_BREAK:
- {
- const String aText( (char)13, 1 ); // '\r' geht auf'm Mac nicht
- insertString( xRange, aText, bAbsorb );
-
- return;
- }
- case text::ControlCharacter::LINE_BREAK:
- {
- SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
- if(pRange)
- {
- ESelection aRange = pRange->GetSelection();
-
- if( bAbsorb )
- {
- const String aEmpty;
- pForwarder->QuickInsertText( aEmpty, aRange );
-
- aRange.nEndPos = aRange.nStartPos;
- aRange.nEndPara = aRange.nStartPara;
- }
- else
- {
- aRange.nStartPos = aRange.nEndPos;
- aRange.nStartPara = aRange.nStartPara;
- }
-
- pForwarder->QuickInsertLineBreak( aRange );
- GetEditSource()->UpdateData();
-
- aRange.nEndPos += 1;
- if( !bAbsorb )
- aRange.nStartPos += 1;
-
- pRange->SetSelection( aRange );
- }
- return;
- }
- case text::ControlCharacter::APPEND_PARAGRAPH:
- {
- SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
- if(pRange)
- {
- ESelection aRange = pRange->GetSelection();
-// ESelection aOldSelection = aRange;
-
- aRange.nStartPos = pForwarder->GetTextLen( aRange.nStartPara );
-
- aRange.nEndPara = aRange.nStartPara;
- aRange.nEndPos = aRange.nStartPos;
-
- pRange->SetSelection( aRange );
- const String aText( (char)13, 1 ); // '\r' geht auf'm Mac nicht
- pRange->setString( aText );
-
- aRange.nStartPos = 0;
- aRange.nStartPara += 1;
- aRange.nEndPos = 0;
- aRange.nEndPara += 1;
-
- pRange->SetSelection( aRange );
-
- return;
- }
- }
- }
- }
-
- throw lang::IllegalArgumentException();
-}
-
-// XText
-void SAL_CALL SvxUnoTextBase::insertTextContent( const uno::Reference< text::XTextRange >& xRange, const uno::Reference< text::XTextContent >& xContent, sal_Bool bAbsorb )
- throw(lang::IllegalArgumentException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
- if( pForwarder )
- {
-
- SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
- SvxUnoTextField* pField = SvxUnoTextField::getImplementation( xContent );
-
- if( pRange == NULL || pField == NULL )
- throw lang::IllegalArgumentException();
-
- ESelection aSelection = pRange->GetSelection();
- if( !bAbsorb )
- {
- aSelection.nStartPara = aSelection.nEndPara;
- aSelection.nStartPos = aSelection.nEndPos;
- }
-
- SvxFieldData* pFieldData = pField->CreateFieldData();
- if( pField == NULL )
- throw lang::IllegalArgumentException();
-
- SvxFieldItem aField( *pFieldData );
- pForwarder->QuickInsertField( aField, aSelection );
- GetEditSource()->UpdateData();
-
- pField->SetAnchor( uno::Reference< text::XTextRange >::query( (cppu::OWeakObject*)this ) );
-
- aSelection.nEndPos += 1;
- aSelection.nStartPos = aSelection.nEndPos;
- pRange->SetSelection( aSelection );
-
- delete pFieldData;
- }
-}
-
-void SAL_CALL SvxUnoTextBase::removeTextContent( const uno::Reference< text::XTextContent >& xContent ) throw(container::NoSuchElementException, uno::RuntimeException)
-{
-}
-
-// XTextRange
-
-uno::Reference< text::XText > SAL_CALL SvxUnoTextBase::getText()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- ESelection aSelection;
- ::binfilter::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );//STRIP008 ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
- ((SvxUnoTextBase*)this)->SetSelection( aSelection );
-
- return (text::XText*)this;
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::getStart()
- throw(uno::RuntimeException)
-{
- return SvxUnoTextRangeBase::getStart();
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::getEnd()
- throw(uno::RuntimeException)
-{
- return SvxUnoTextRangeBase::getEnd();
-}
-
-OUString SAL_CALL SvxUnoTextBase::getString() throw( uno::RuntimeException )
-{
- return SvxUnoTextRangeBase::getString();
-}
-
-void SAL_CALL SvxUnoTextBase::setString( const OUString& aString ) throw(uno::RuntimeException)
-{
- SvxUnoTextRangeBase::setString(aString);
-}
-
-
-// XEnumerationAccess
-uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextBase::createEnumeration()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- ESelection aSelection;
- ::binfilter::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );//STRIP008 ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
- SetSelection( aSelection );
-
- uno::Reference< container::XEnumeration > xEnum( (container::XEnumeration*) new SvxUnoTextContentEnumeration( *this ) );
- return xEnum;
-}
-
-// XElementAccess ( container::XEnumerationAccess )
-uno::Type SAL_CALL SvxUnoTextBase::getElementType( ) throw(uno::RuntimeException)
-{
- return ::getCppuType((const uno::Reference< text::XTextRange >*)0 );
-}
-
-sal_Bool SAL_CALL SvxUnoTextBase::hasElements( ) throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if(GetEditSource())
- {
- SvxTextForwarder* pForwarder = GetEditSource()->GetTextForwarder();
- if(pForwarder)
- return pForwarder->GetParagraphCount() != 0;
- }
-
- return sal_False;
-}
-
-// text::XTextRangeMover
-void SAL_CALL SvxUnoTextBase::moveTextRange( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nParagraphs )
- throw(uno::RuntimeException)
-{
-}
-
-// lang::XServiceInfo
-OUString SAL_CALL SvxUnoTextBase::getImplementationName()
- throw(uno::RuntimeException)
-{
- return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextBase"));
-}
-
-uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames( )
- throw(uno::RuntimeException)
-{
- uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
- SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.text.Text" );
- return aSeq;
-}
-
-const uno::Sequence< sal_Int8 > & SvxUnoTextBase::getUnoTunnelId() throw()
-{
- static uno::Sequence< sal_Int8 > * pSeq = 0;
- if( !pSeq )
- {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pSeq )
- {
- static uno::Sequence< sal_Int8 > aSeq( 16 );
- rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
- pSeq = &aSeq;
- }
- }
- return *pSeq;
-}
-
-SvxUnoTextBase* SvxUnoTextBase::getImplementation( const uno::Reference< uno::XInterface >& xInt )
-{
- uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
- if( xUT.is() )
- return (SvxUnoTextBase*)xUT->getSomething( SvxUnoTextBase::getUnoTunnelId() );
- else
- return NULL;
-}
-
-sal_Int64 SAL_CALL SvxUnoTextBase::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException) \
-{
- if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
- rId.getConstArray(), 16 ) )
- {
- return (sal_Int64)this;
- }
- else
- {
- return SvxUnoTextRangeBase::getSomething( rId );
- }
-}
-
-// --------------------------------------------------------------------
-
-SvxUnoText::SvxUnoText( const SvxEditSource* pSource, const SfxItemPropertyMap* _pMap, uno::Reference < text::XText > xParent ) throw()
-: SvxUnoTextBase( pSource, _pMap, xParent )
-{
-}
-
-SvxUnoText::SvxUnoText( const SvxUnoText& rText ) throw()
-: SvxUnoTextBase( rText )
-{
-}
-
-SvxUnoText::~SvxUnoText() throw()
-{
-}
-
-// uno::XInterface
-uno::Any SAL_CALL SvxUnoText::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException )
-{
- uno::Any aAny( SvxUnoTextBase::queryAggregation( rType ) );
- if( !aAny.hasValue() )
- aAny = OWeakAggObject::queryAggregation( rType );
-
- return aAny;
-}
-
-uno::Any SAL_CALL SvxUnoText::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException )
-{
- return OWeakAggObject::queryInterface( rType );
-}
-
-void SAL_CALL SvxUnoText::acquire() throw( )
-{
- OWeakAggObject::acquire();
-}
-
-void SAL_CALL SvxUnoText::release() throw( )
-{
- OWeakAggObject::release();
-}
-
-// lang::XTypeProvider
-uno::Sequence< uno::Type > SAL_CALL SvxUnoText::getTypes( ) throw( uno::RuntimeException )
-{
- return SvxUnoTextBase::getTypes();
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxUnoText::getImplementationId( ) throw( uno::RuntimeException )
-{
- static uno::Sequence< sal_Int8 > aId;
- if( aId.getLength() == 0 )
- {
- aId.realloc( 16 );
- rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
- }
- return aId;
-}
-
-const uno::Sequence< sal_Int8 > & SvxUnoText::getUnoTunnelId() throw()
-{
- static uno::Sequence< sal_Int8 > * pSeq = 0;
- if( !pSeq )
- {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pSeq )
- {
- static uno::Sequence< sal_Int8 > aSeq( 16 );
- rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
- pSeq = &aSeq;
- }
- }
- return *pSeq;
-}
-
-sal_Int64 SAL_CALL SvxUnoText::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException) \
-{
- if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
- rId.getConstArray(), 16 ) )
- {
- return (sal_Int64)this;
- }
- else
- {
- return SvxUnoTextBase::getSomething( rId );
- }
-}
-
-
-// --------------------------------------------------------------------
-
-SvxDummyTextSource::~SvxDummyTextSource()
-{
-};
-
-SvxEditSource* SvxDummyTextSource::Clone() const
-{
- return new SvxDummyTextSource();
-}
-
-SvxTextForwarder* SvxDummyTextSource::GetTextForwarder()
-{
- return this;
-}
-
-void SvxDummyTextSource::UpdateData()
-{
-}
-
-sal_uInt16 SvxDummyTextSource::GetParagraphCount() const
-{
- return 0;
-}
-
-sal_uInt16 SvxDummyTextSource::GetTextLen( sal_uInt16 nParagraph ) const
-{
- return 0;
-}
-
-String SvxDummyTextSource::GetText( const ESelection& rSel ) const
-{
- return String();
-}
-
-SfxItemSet SvxDummyTextSource::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib ) const
-{
- String aDummyStr(RTL_CONSTASCII_USTRINGPARAM("Dummy"));
- SfxItemPool aPool(aDummyStr,0,0,NULL);
- return SfxItemSet(aPool);
-}
-
-SfxItemSet SvxDummyTextSource::GetParaAttribs( sal_uInt16 nPara ) const
-{
- return GetAttribs(ESelection());
-}
-
-void SvxDummyTextSource::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
-{
-}
-
-void SvxDummyTextSource::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const
-{
-}
-
-sal_uInt16 SvxDummyTextSource::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
-{
- return 0;
-}
-
-sal_uInt16 SvxDummyTextSource::GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const
-{
- return 0;
-}
-
-SfxItemPool* SvxDummyTextSource::GetPool() const
-{
- return NULL;
-}
-
-void SvxDummyTextSource::QuickInsertText( const String& rText, const ESelection& rSel )
-{
-}
-
-void SvxDummyTextSource::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
-{
-}
-
-void SvxDummyTextSource::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
-{
-}
-
-void SvxDummyTextSource::QuickInsertLineBreak( const ESelection& rSel )
-{
-};
-
-XubString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor )
-{
- return XubString();
-}
-
-sal_Bool SvxDummyTextSource::IsValid() const
-{
- return sal_False;
-}
-
-void SvxDummyTextSource::SetNotifyHdl( const Link& )
-{
-}
-
-LanguageType SvxDummyTextSource::GetLanguage( USHORT nPara, USHORT nIndex ) const
-{
- return LANGUAGE_DONTKNOW;
-}
-
-USHORT SvxDummyTextSource::GetFieldCount( USHORT nPara ) const
-{
- return 0;
-}
-
-EFieldInfo SvxDummyTextSource::GetFieldInfo( USHORT nPara, USHORT nField ) const
-{
- return EFieldInfo();
-}
-
-EBulletInfo SvxDummyTextSource::GetBulletInfo( USHORT nPara ) const
-{
- return EBulletInfo();
-}
-
-Rectangle SvxDummyTextSource::GetCharBounds( USHORT nPara, USHORT nIndex ) const
-{
- return Rectangle();
-}
-
-Rectangle SvxDummyTextSource::GetParaBounds( USHORT nPara ) const
-{
- return Rectangle();
-}
-
-MapMode SvxDummyTextSource::GetMapMode() const
-{
- return MapMode();
-}
-
-OutputDevice* SvxDummyTextSource::GetRefDevice() const
-{
- return NULL;
-}
-
-sal_Bool SvxDummyTextSource::GetIndexAtPoint( const Point&, USHORT& nPara, USHORT& nIndex ) const
-{
- return sal_False;
-}
-
-sal_Bool SvxDummyTextSource::GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const
-{
- return sal_False;
-}
-
-sal_Bool SvxDummyTextSource::GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const
-{
- return sal_False;
-}
-
-USHORT SvxDummyTextSource::GetLineCount( USHORT nPara ) const
-{
- return 0;
-}
-
-USHORT SvxDummyTextSource::GetLineLen( USHORT nPara, USHORT nLine ) const
-{
- return 0;
-}
-
-sal_Bool SvxDummyTextSource::QuickFormatDoc( BOOL bFull )
-{
- return sal_False;
-}
-
-USHORT SvxDummyTextSource::GetDepth( USHORT nPara ) const
-{
- return 0;
-}
-
-sal_Bool SvxDummyTextSource::SetDepth( USHORT nPara, USHORT nNewDepth )
-{
- return nNewDepth == 0 ? sal_True : sal_False;
-}
-
-sal_Bool SvxDummyTextSource::Delete( const ESelection& )
-{
- return sal_False;
-}
-
-sal_Bool SvxDummyTextSource::InsertText( const String&, const ESelection& )
-{
- return sal_False;
-}
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/unoedit/svx_unotext2.cxx b/binfilter/bf_svx/source/unoedit/svx_unotext2.cxx
deleted file mode 100644
index a969e917609f..000000000000
--- a/binfilter/bf_svx/source/unoedit/svx_unotext2.cxx
+++ /dev/null
@@ -1,635 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#include <vcl/svapp.hxx>
-#include <osl/mutex.hxx>
-
-#define _SVSTDARR_USHORTS
-#include <bf_svtools/svstdarr.hxx>
-
-#include <rtl/uuid.h>
-#include <rtl/memory.h>
-
-#include <eeitem.hxx>
-
-#define ITEMID_FIELD EE_FEATURE_FIELD
-
-
-#include <bf_svtools/poolitem.hxx>
-
-#include <bf_svx/itemdata.hxx>
-
-#include "unotext.hxx"
-namespace binfilter {
-
-using namespace ::rtl;
-using namespace ::cppu;
-using namespace ::com::sun::star;
-
-#define QUERYINT( xint ) \
- if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
- aAny <<= uno::Reference< xint >(this)
-
-// ====================================================================
-// SvxUnoTextContentEnumeration
-// ====================================================================
-
-SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText ) throw()
-: rText( _rText )
-{
- xParentText = const_cast<SvxUnoTextBase*>(&rText);
- if( rText.GetEditSource() )
- pEditSource = rText.GetEditSource()->Clone();
- else
- pEditSource = NULL;
- nNextParagraph = 0;
-}
-
-SvxUnoTextContentEnumeration::~SvxUnoTextContentEnumeration() throw()
-{
- delete pEditSource;
-}
-
-// container::XEnumeration
-sal_Bool SAL_CALL SvxUnoTextContentEnumeration::hasMoreElements(void)
- throw( uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
- return nNextParagraph < pEditSource->GetTextForwarder()->GetParagraphCount();
-}
-
-uno::Any SvxUnoTextContentEnumeration::nextElement(void) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
-{
- SolarMutexGuard aGuard;
-
- if(!hasMoreElements())
- throw container::NoSuchElementException();
-
- SvxUnoTextContent* pContent = new SvxUnoTextContent( rText, nNextParagraph++ );
- uno::Reference< text::XTextContent > xRef( pContent );
- return uno::Any( &xRef, ::getCppuType((const uno::Reference< text::XTextContent>*)0) );
-}
-
-// ====================================================================
-// class SvxUnoTextContent
-// ====================================================================
-uno::Reference< text::XText > xDummyText;
-uno::Sequence< uno::Type > SvxUnoTextContent::maTypeSequence;
-
-SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw()
-: SvxUnoTextRangeBase(rText),rParentText(rText),
- aDisposeListeners(aDisposeContainerMutex),
- nParagraph(nPara),
- bDisposing( sal_False )
-{
- xParentText = const_cast<SvxUnoTextBase*>(&rText);
- SetSelection( ESelection( nParagraph,0, nParagraph, GetEditSource()->GetTextForwarder()->GetTextLen( nParagraph ) ) );
-}
-
-SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw()
-: SvxUnoTextRangeBase(rContent),
- aDisposeListeners(aDisposeContainerMutex),
- rParentText(rContent.rParentText),
- bDisposing( sal_False )
-{
- xParentText = rContent.xParentText;
- nParagraph = rContent.nParagraph;
- SetSelection( rContent.GetSelection() );
-}
-
-SvxUnoTextContent::~SvxUnoTextContent() throw()
-{
-}
-
-// uno::XInterface
-uno::Any SAL_CALL SvxUnoTextContent::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException )
-{
- uno::Any aAny;
-
- QUERYINT( text::XTextRange );
- else QUERYINT( beans::XPropertySet );
- else QUERYINT( beans::XMultiPropertySet );
- else QUERYINT( beans::XPropertyState );
- else QUERYINT( text::XTextContent );
- else QUERYINT( lang::XComponent );
- else QUERYINT( container::XEnumerationAccess );
- else QUERYINT( container::XElementAccess );
- else QUERYINT( lang::XServiceInfo );
- else QUERYINT( lang::XTypeProvider );
- else QUERYINT( lang::XUnoTunnel );
- else
- return OWeakAggObject::queryAggregation( rType );
-
- return aAny;
-}
-
-uno::Any SAL_CALL SvxUnoTextContent::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException )
-{
- return OWeakAggObject::queryInterface(rType);
-}
-
-void SAL_CALL SvxUnoTextContent::acquire() throw( )
-{
- OWeakAggObject::acquire();
-}
-
-void SAL_CALL SvxUnoTextContent::release() throw( )
-{
- OWeakAggObject::release();
-}
-
-// XTypeProvider
-
-uno::Sequence< uno::Type > SAL_CALL SvxUnoTextContent::getTypes()
- throw (uno::RuntimeException)
-{
- if( maTypeSequence.getLength() == 0 )
- {
- maTypeSequence.realloc( 9 ); // !DANGER! keep this updated
- uno::Type* pTypes = maTypeSequence.getArray();
-
- *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextContent >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0);
- }
- return maTypeSequence;
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextContent::getImplementationId()
- throw (uno::RuntimeException)
-{
- static uno::Sequence< sal_Int8 > aId;
- if( aId.getLength() == 0 )
- {
- aId.realloc( 16 );
- rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
- }
- return aId;
-}
-
-// text::XTextRange
-
-uno::Reference< text::XText > SAL_CALL SvxUnoTextContent::getText()
- throw(uno::RuntimeException)
-{
- return xParentText;
-}
-
-// text::XTextContent
-void SAL_CALL SvxUnoTextContent::attach( const uno::Reference< text::XTextRange >& xTextRange )
- throw(lang::IllegalArgumentException, uno::RuntimeException)
-{
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextContent::getAnchor() throw( uno::RuntimeException )
-{
- return uno::Reference< text::XTextRange >::query( xParentText );
-}
-
-// XComponent
-
-void SAL_CALL SvxUnoTextContent::dispose()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if( bDisposing )
- return; // catched a recursion
-
- bDisposing = sal_True;
-
- lang::EventObject aEvt;
- aEvt.Source = *(OWeakAggObject*) this;
- aDisposeListeners.disposeAndClear(aEvt);
-
- if( xParentText.is() )
- xParentText->removeTextContent( this );
-}
-
-void SAL_CALL SvxUnoTextContent::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw(uno::RuntimeException)
-{
- aDisposeListeners.addInterface(xListener);
-}
-
-void SAL_CALL SvxUnoTextContent::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
- throw(uno::RuntimeException)
-{
- aDisposeListeners.removeInterface(aListener);
-}
-
-// XEnumerationAccess
-
-uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextContent::createEnumeration( )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- return new SvxUnoTextRangeEnumeration( rParentText, nParagraph );
-}
-
-// XElementAccess ( container::XEnumerationAccess )
-
-uno::Type SAL_CALL SvxUnoTextContent::getElementType()
- throw(uno::RuntimeException)
-{
- return ::getCppuType((const uno::Reference< text::XTextRange >*)0);
-}
-
-sal_Bool SAL_CALL SvxUnoTextContent::hasElements()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
- if( pForwarder )
- {
- SvUShorts aPortions;
- pForwarder->GetPortions( nParagraph, aPortions );
- return aPortions.Count() > 0;
- }
- else
- {
- return 0;
- }
-}
-
-// XPropertySet
-
-void SAL_CALL SvxUnoTextContent::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
- throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- _setPropertyValue( aPropertyName, aValue, nParagraph );
-}
-
-uno::Any SAL_CALL SvxUnoTextContent::getPropertyValue( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return _getPropertyValue( PropertyName, nParagraph );
-}
-
-// XMultiPropertySet
-void SAL_CALL SvxUnoTextContent::setPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues ) throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- _setPropertyValues( aPropertyNames, aValues, nParagraph );
-}
-
-uno::Sequence< uno::Any > SAL_CALL SvxUnoTextContent::getPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (uno::RuntimeException)
-{
- return _getPropertyValues( aPropertyNames, nParagraph );
-}
-
-// beans::XPropertyState
-beans::PropertyState SAL_CALL SvxUnoTextContent::getPropertyState( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- return _getPropertyState( PropertyName, nParagraph );
-}
-
-uno::Sequence< beans::PropertyState > SAL_CALL SvxUnoTextContent::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
- throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- return _getPropertyStates( aPropertyName, nParagraph );
-}
-
-void SAL_CALL SvxUnoTextContent::setPropertyToDefault( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, uno::RuntimeException)
-{
- _setPropertyToDefault( PropertyName, nParagraph );
-}
-
-// lang::XServiceInfo
-
-OUString SAL_CALL SvxUnoTextContent::getImplementationName()
- throw(uno::RuntimeException)
-{
- return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextContent") );
-}
-
-uno::Sequence< OUString > SAL_CALL SvxUnoTextContent::getSupportedServiceNames()
- throw(uno::RuntimeException)
-{
- uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
- SvxServiceInfoHelper::addToSequence( aSeq, 5, "com.sun.star.style.ParagraphProperties",
- "com.sun.star.style.ParagraphPropertiesComplex",
- "com.sun.star.style.ParagraphPropertiesAsian",
- "com.sun.star.text.TextContent",
- "com.sun.star.text.Paragraph");
- return aSeq;
-}
-
-// ====================================================================
-// class SvxUnoTextRangeEnumeration
-// ====================================================================
-
-SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw()
-: xParentText( const_cast<SvxUnoTextBase*>(&rText) ),
- rParentText( rText ),
- nParagraph( nPara ),
- nNextPortion( 0 )
-{
- pEditSource = rText.GetEditSource() ? rText.GetEditSource()->Clone() : NULL;
-
- if( pEditSource && pEditSource->GetTextForwarder() )
- {
- pPortions = new SvUShorts;
- pEditSource->GetTextForwarder()->GetPortions( nPara, *pPortions );
- }
- else
- {
- pPortions = NULL;
- }
-}
-
-SvxUnoTextRangeEnumeration::~SvxUnoTextRangeEnumeration() throw()
-{
- delete pEditSource;
- delete pPortions;
-}
-
-// container::XEnumeration
-
-sal_Bool SAL_CALL SvxUnoTextRangeEnumeration::hasMoreElements()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- return pPortions ? nNextPortion < pPortions->Count() : 0;
-}
-
-uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement()
- throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- if( pPortions == NULL || nNextPortion >= pPortions->Count() )
- throw container::NoSuchElementException();
-
- sal_uInt16 nStartPos = 0;
- if (nNextPortion > 0)
- nStartPos = pPortions->GetObject(nNextPortion-1);
- sal_uInt16 nEndPos = pPortions->GetObject(nNextPortion);
- ESelection aSel( nParagraph, nStartPos, nParagraph, nEndPos );
-
- uno::Reference< text::XTextRange > xRange;
-
- SvxTextForwarder* pForwarder = rParentText.GetEditSource()->GetTextForwarder();
-
- SvxUnoTextRange* pRange = new SvxUnoTextRange( rParentText, sal_True );
- xRange = pRange;
-
- pRange->SetSelection(aSel);
- nNextPortion++;
-
- return uno::Any( &xRange, ::getCppuType((const uno::Reference< text::XTextRange >*)0) );
-}
-
-// ====================================================================
-// class SvxUnoTextCursor
-// ====================================================================
-
-uno::Sequence< uno::Type > SvxUnoTextCursor::maTypeSequence;
-
-SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw()
-: SvxUnoTextRangeBase(rText),
- xParentText( const_cast<SvxUnoTextBase*>(&rText) )
-{
-}
-
-SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw()
-: SvxUnoTextRangeBase(rCursor),
- xParentText(rCursor.xParentText)
-{
-}
-
-SvxUnoTextCursor::~SvxUnoTextCursor() throw()
-{
-}
-
-// automatisch auskommentiert - [getIdlClass(es) or queryInterface] - Bitte XTypeProvider benutzen!
-//sal_Bool SvxUnoTextCursor::queryInterface( uno::Uik aUIK, Reference< uno::XInterface > & xRef)
-uno::Any SAL_CALL SvxUnoTextCursor::queryAggregation( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- uno::Any aAny;
-
- if( rType == ::getCppuType((const uno::Reference< text::XTextRange >*)0) )
- aAny <<= uno::Reference< text::XTextRange >((text::XText*)(this));
- else QUERYINT( text::XTextCursor );
- else QUERYINT( beans::XPropertySet );
- else QUERYINT( beans::XMultiPropertySet );
- else QUERYINT( beans::XPropertyState );
- else QUERYINT( lang::XServiceInfo );
- else QUERYINT( lang::XTypeProvider );
- else QUERYINT( lang::XUnoTunnel );
- else
- return OWeakAggObject::queryAggregation( rType );
-
- return aAny;
-}
-
-uno::Any SAL_CALL SvxUnoTextCursor::queryInterface( const uno::Type & rType )
- throw(uno::RuntimeException)
-{
- return OWeakAggObject::queryInterface(rType);
-}
-
-void SAL_CALL SvxUnoTextCursor::acquire() throw ( )
-{
- OWeakAggObject::acquire();
-}
-
-void SAL_CALL SvxUnoTextCursor::release() throw ( )
-{
- OWeakAggObject::release();
-}
-
-// XTypeProvider
-uno::Sequence< uno::Type > SAL_CALL SvxUnoTextCursor::getTypes()
- throw(uno::RuntimeException)
-{
- if( maTypeSequence.getLength() == 0 )
- {
- maTypeSequence.realloc( 8 ); // !DANGER! keep this updated
- uno::Type* pTypes = maTypeSequence.getArray();
-
- *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCursor >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0);
- *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0);
- }
- return maTypeSequence;
-}
-
-uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextCursor::getImplementationId()
- throw (uno::RuntimeException)
-{
- static uno::Sequence< sal_Int8 > aId;
- if( aId.getLength() == 0 )
- {
- aId.realloc( 16 );
- rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
- }
- return aId;
-}
-
-// text::XTextCursor
-void SAL_CALL SvxUnoTextCursor::collapseToStart()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- CollapseToStart();
-}
-
-void SAL_CALL SvxUnoTextCursor::collapseToEnd()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- CollapseToEnd();
-}
-
-sal_Bool SAL_CALL SvxUnoTextCursor::isCollapsed()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return IsCollapsed();
-}
-
-sal_Bool SAL_CALL SvxUnoTextCursor::goLeft( sal_Int16 nCount, sal_Bool bExpand )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return GoLeft( nCount, bExpand );
-}
-
-sal_Bool SAL_CALL SvxUnoTextCursor::goRight( sal_Int16 nCount, sal_Bool bExpand )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return GoRight( nCount, bExpand );
-}
-
-void SAL_CALL SvxUnoTextCursor::gotoStart( sal_Bool bExpand )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- GotoStart( bExpand );
-}
-
-void SAL_CALL SvxUnoTextCursor::gotoEnd( sal_Bool bExpand )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- GotoEnd( bExpand );
-}
-
-void SAL_CALL SvxUnoTextCursor::gotoRange( const uno::Reference< text::XTextRange >& xRange, sal_Bool bExpand )
- throw(uno::RuntimeException)
-{
- if( !xRange.is() )
- return;
-
- SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( xRange );
-
- if( pRange )
- {
- ESelection aNewSel = pRange->GetSelection();
-
- if( bExpand )
- {
- const ESelection& rOldSel = GetSelection();
- aNewSel.nStartPara = rOldSel.nStartPara;
- aNewSel.nStartPos = rOldSel.nStartPos;
- }
-
- SetSelection( aNewSel );
- }
-}
-
-// text::XTextRange (rest in SvxTextRange)
-uno::Reference< text::XText > SAL_CALL SvxUnoTextCursor::getText(void) throw( uno::RuntimeException )
-{
- return xParentText;
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextCursor::getStart()
- throw(uno::RuntimeException)
-{
- return SvxUnoTextRangeBase::getStart();
-}
-
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextCursor::getEnd()
- throw(uno::RuntimeException)
-{
- return SvxUnoTextRangeBase::getEnd();
-}
-
-OUString SAL_CALL SvxUnoTextCursor::getString() throw( uno::RuntimeException )
-{
- return SvxUnoTextRangeBase::getString();
-}
-
-void SAL_CALL SvxUnoTextCursor::setString( const OUString& aString ) throw(uno::RuntimeException)
-{
- SvxUnoTextRangeBase::setString(aString);
-}
-// lang::XServiceInfo
-OUString SAL_CALL SvxUnoTextCursor::getImplementationName() throw(uno::RuntimeException)
-{
- return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextCursor"));
-}
-
-sal_Bool SAL_CALL SvxUnoTextCursor::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
-{
- return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
-}
-
-uno::Sequence< OUString > SAL_CALL SvxUnoTextCursor::getSupportedServiceNames() throw(uno::RuntimeException)
-{
- uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
- SvxServiceInfoHelper::addToSequence( aSeq, 4,"com.sun.star.style.ParagraphProperties",
- "com.sun.star.style.ParagraphPropertiesComplex",
- "com.sun.star.style.ParagraphPropertiesAsian",
- "com.sun.star.text.TextCursor");
- return aSeq;
-}
-
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/unoedit/svx_unoviwed.cxx b/binfilter/bf_svx/source/unoedit/svx_unoviwed.cxx
deleted file mode 100644
index e28b4201b964..000000000000
--- a/binfilter/bf_svx/source/unoedit/svx_unoviwed.cxx
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-
-
-#include "unoviwed.hxx"
-#include "editview.hxx"
-#include "editeng.hxx"
-#include "svdotext.hxx"
-namespace binfilter {
-
-SvxEditEngineViewForwarder::~SvxEditEngineViewForwarder()
-{
-}
-
-BOOL SvxEditEngineViewForwarder::IsValid() const
-{
- return sal_True;
-}
-
-Rectangle SvxEditEngineViewForwarder::GetVisArea() const
-{
- OutputDevice* pOutDev = mrView.GetWindow();
-
- if( pOutDev )
- {
- Rectangle aVisArea = mrView.GetVisArea();
-
- // figure out map mode from edit engine
- EditEngine* pEditEngine = mrView.GetEditEngine();
-
- if( pEditEngine )
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- aVisArea = OutputDevice::LogicToLogic( aVisArea,
- pEditEngine->GetRefMapMode(),
- aMapMode.GetMapUnit() );
- aMapMode.SetOrigin(Point());
- return pOutDev->LogicToPixel( aVisArea, aMapMode );
- }
- }
-
- return Rectangle();
-}
-
-Point SvxEditEngineViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
-{
- OutputDevice* pOutDev = mrView.GetWindow();
-
- if( pOutDev )
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- Point aPoint( OutputDevice::LogicToLogic( rPoint, rMapMode,
- aMapMode.GetMapUnit() ) );
- aMapMode.SetOrigin(Point());
- return pOutDev->LogicToPixel( aPoint, aMapMode );
- }
-
- return Point();
-}
-
-Point SvxEditEngineViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
-{
- OutputDevice* pOutDev = mrView.GetWindow();
-
- if( pOutDev )
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- aMapMode.SetOrigin(Point());
- Point aPoint( pOutDev->PixelToLogic( rPoint, aMapMode ) );
- return OutputDevice::LogicToLogic( aPoint,
- aMapMode.GetMapUnit(),
- rMapMode );
- }
-
- return Point();
-}
-
-sal_Bool SvxEditEngineViewForwarder::GetSelection( ESelection& rSelection ) const
-{
- rSelection = mrView.GetSelection();
- return sal_True;
-}
-
-sal_Bool SvxEditEngineViewForwarder::SetSelection( const ESelection& rSelection )
-{
- mrView.SetSelection( rSelection );
- return sal_True;
-}
-
-sal_Bool SvxEditEngineViewForwarder::Copy()
-{
- mrView.Copy();
- return sal_True;
-}
-
-sal_Bool SvxEditEngineViewForwarder::Cut()
-{
- mrView.Cut();
- return sal_True;
-}
-
-sal_Bool SvxEditEngineViewForwarder::Paste()
-{
- mrView.Paste();
- return sal_True;
-}
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svx/source/unoedit/svx_unoviwou.cxx b/binfilter/bf_svx/source/unoedit/svx_unoviwou.cxx
deleted file mode 100644
index b66899a365f7..000000000000
--- a/binfilter/bf_svx/source/unoedit/svx_unoviwou.cxx
+++ /dev/null
@@ -1,167 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-
-
-#include "unoviwou.hxx"
-#include "outliner.hxx"
-#include "svdotext.hxx"
-namespace binfilter {
-
-
-SvxDrawOutlinerViewForwarder::SvxDrawOutlinerViewForwarder( OutlinerView& rOutl, const Point& rShapePosTopLeft ) :
- mrOutlinerView ( rOutl ), maTextShapeTopLeft( rShapePosTopLeft )
-{
-}
-
-SvxDrawOutlinerViewForwarder::~SvxDrawOutlinerViewForwarder()
-{
-}
-
-Point SvxDrawOutlinerViewForwarder::GetTextOffset() const
-{
- // #101029# calc text offset from shape anchor
- Rectangle aOutputRect( mrOutlinerView.GetOutputArea() );
-
- return aOutputRect.TopLeft() - maTextShapeTopLeft;
-}
-
-BOOL SvxDrawOutlinerViewForwarder::IsValid() const
-{
- return sal_True;
-}
-
-Rectangle SvxDrawOutlinerViewForwarder::GetVisArea() const
-{
- OutputDevice* pOutDev = mrOutlinerView.GetWindow();
-
- if( pOutDev )
- {
- Rectangle aVisArea = mrOutlinerView.GetVisArea();
-
- // #101029#
- Point aTextOffset( GetTextOffset() );
- aVisArea.Move( aTextOffset.X(), aTextOffset.Y() );
-
- // figure out map mode from edit engine
- Outliner* pOutliner = mrOutlinerView.GetOutliner();
-
- if( pOutliner )
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- aVisArea = OutputDevice::LogicToLogic( aVisArea,
- pOutliner->GetRefMapMode(),
- aMapMode.GetMapUnit() );
- aMapMode.SetOrigin(Point());
- return pOutDev->LogicToPixel( aVisArea, aMapMode );
- }
- }
-
- return Rectangle();
-}
-
-Point SvxDrawOutlinerViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
-{
- OutputDevice* pOutDev = mrOutlinerView.GetWindow();
-
- if( pOutDev )
- {
- Point aPoint1( rPoint );
- Point aTextOffset( GetTextOffset() );
-
- // #101029#
- aPoint1.X() += aTextOffset.X();
- aPoint1.Y() += aTextOffset.Y();
-
- MapMode aMapMode(pOutDev->GetMapMode());
- Point aPoint2( OutputDevice::LogicToLogic( aPoint1, rMapMode,
- aMapMode.GetMapUnit() ) );
- aMapMode.SetOrigin(Point());
- return pOutDev->LogicToPixel( aPoint2, aMapMode );
- }
-
- return Point();
-}
-
-Point SvxDrawOutlinerViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
-{
- OutputDevice* pOutDev = mrOutlinerView.GetWindow();
-
- if( pOutDev )
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- aMapMode.SetOrigin(Point());
- Point aPoint1( pOutDev->PixelToLogic( rPoint, aMapMode ) );
- Point aPoint2( OutputDevice::LogicToLogic( aPoint1,
- aMapMode.GetMapUnit(),
- rMapMode ) );
- // #101029#
- Point aTextOffset( GetTextOffset() );
-
- aPoint2.X() -= aTextOffset.X();
- aPoint2.Y() -= aTextOffset.Y();
-
- return aPoint2;
- }
-
- return Point();
-}
-
-sal_Bool SvxDrawOutlinerViewForwarder::GetSelection( ESelection& rSelection ) const
-{
- rSelection = mrOutlinerView.GetSelection();
- return sal_True;
-}
-
-sal_Bool SvxDrawOutlinerViewForwarder::SetSelection( const ESelection& rSelection )
-{
- mrOutlinerView.SetSelection( rSelection );
- return sal_True;
-}
-
-sal_Bool SvxDrawOutlinerViewForwarder::Copy()
-{
- mrOutlinerView.Copy();
- return sal_True;
-}
-
-sal_Bool SvxDrawOutlinerViewForwarder::Cut()
-{
- mrOutlinerView.Cut();
- return sal_True;
-}
-
-sal_Bool SvxDrawOutlinerViewForwarder::Paste()
-{
- mrOutlinerView.Paste();
- return sal_True;
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */