SV_DECL_VARARR->std::vector
This commit is contained in:
@@ -33,8 +33,6 @@
|
|||||||
#include <tools/string.hxx>
|
#include <tools/string.hxx>
|
||||||
#include "editeng/editengdllapi.h"
|
#include "editeng/editengdllapi.h"
|
||||||
|
|
||||||
#include <svl/svarray.hxx>
|
|
||||||
|
|
||||||
class SfxItemSet;
|
class SfxItemSet;
|
||||||
class SfxPoolItem;
|
class SfxPoolItem;
|
||||||
class SvParser;
|
class SvParser;
|
||||||
@@ -305,8 +303,6 @@ struct EECharAttrib
|
|||||||
xub_StrLen nEnd;
|
xub_StrLen nEnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
SV_DECL_VARARR_VISIBILITY( EECharAttribArray, EECharAttrib, 0, 4, EDITENG_DLLPUBLIC )
|
|
||||||
|
|
||||||
struct MoveParagraphsInfo
|
struct MoveParagraphsInfo
|
||||||
{
|
{
|
||||||
sal_uInt16 nStartPara;
|
sal_uInt16 nStartPara;
|
||||||
|
@@ -236,7 +236,7 @@ public:
|
|||||||
virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
|
virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
|
||||||
virtual const SfxItemSet& GetParaAttribs( sal_uInt16 nPara ) const;
|
virtual const SfxItemSet& GetParaAttribs( sal_uInt16 nPara ) const;
|
||||||
|
|
||||||
void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const;
|
void GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const;
|
||||||
|
|
||||||
SfxItemSet GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags = 0xFF ) const;
|
SfxItemSet GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags = 0xFF ) const;
|
||||||
SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All );
|
SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All );
|
||||||
|
@@ -34,14 +34,16 @@
|
|||||||
#include <rsc/rscsfx.hxx>
|
#include <rsc/rscsfx.hxx>
|
||||||
#include <svl/itemset.hxx>
|
#include <svl/itemset.hxx>
|
||||||
#include <editeng/eeitem.hxx>
|
#include <editeng/eeitem.hxx>
|
||||||
|
#include <editeng/editdata.hxx>
|
||||||
#include "editeng/editengdllapi.h"
|
#include "editeng/editengdllapi.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
DBG_NAMEEX( EE_EditTextObject )
|
DBG_NAMEEX( EE_EditTextObject )
|
||||||
|
|
||||||
class SfxItemPool;
|
class SfxItemPool;
|
||||||
class SfxStyleSheetPool;
|
class SfxStyleSheetPool;
|
||||||
class SvxFieldItem;
|
class SvxFieldItem;
|
||||||
class EECharAttribArray;
|
|
||||||
|
|
||||||
#define EDTOBJ_SETTINGS_ULITEMSUMMATION 0x00000001
|
#define EDTOBJ_SETTINGS_ULITEMSUMMATION 0x00000001
|
||||||
#define EDTOBJ_SETTINGS_ULITEMFIRSTPARA 0x00000002
|
#define EDTOBJ_SETTINGS_ULITEMFIRSTPARA 0x00000002
|
||||||
@@ -96,7 +98,7 @@ public:
|
|||||||
virtual sal_Bool HasOnlineSpellErrors() const;
|
virtual sal_Bool HasOnlineSpellErrors() const;
|
||||||
|
|
||||||
virtual sal_Bool HasCharAttribs( sal_uInt16 nWhich = 0 ) const;
|
virtual sal_Bool HasCharAttribs( sal_uInt16 nWhich = 0 ) const;
|
||||||
virtual void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const;
|
virtual void GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const;
|
||||||
|
|
||||||
virtual sal_Bool RemoveCharAttribs( sal_uInt16 nWhich = 0 );
|
virtual sal_Bool RemoveCharAttribs( sal_uInt16 nWhich = 0 );
|
||||||
virtual sal_Bool RemoveParaAttribs( sal_uInt16 nWhich = 0 );
|
virtual sal_Bool RemoveParaAttribs( sal_uInt16 nWhich = 0 );
|
||||||
|
@@ -55,7 +55,6 @@ class SvxViewForwarder;
|
|||||||
class SvxEditViewForwarder;
|
class SvxEditViewForwarder;
|
||||||
class SvxFieldItem;
|
class SvxFieldItem;
|
||||||
class SfxBroadcaster;
|
class SfxBroadcaster;
|
||||||
class EECharAttribArray;
|
|
||||||
class SvxUnoTextRangeBase;
|
class SvxUnoTextRangeBase;
|
||||||
|
|
||||||
typedef std::list< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseList;
|
typedef std::list< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseList;
|
||||||
|
@@ -97,7 +97,6 @@ using namespace ::com::sun::star;
|
|||||||
using namespace ::com::sun::star::uno;
|
using namespace ::com::sun::star::uno;
|
||||||
using namespace ::com::sun::star::linguistic2;
|
using namespace ::com::sun::star::linguistic2;
|
||||||
|
|
||||||
|
|
||||||
DBG_NAME( EditEngine )
|
DBG_NAME( EditEngine )
|
||||||
DBG_NAMEEX( EditView )
|
DBG_NAMEEX( EditView )
|
||||||
|
|
||||||
@@ -105,8 +104,6 @@ DBG_NAMEEX( EditView )
|
|||||||
static sal_Bool bDebugPaint = sal_False;
|
static sal_Bool bDebugPaint = sal_False;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SV_IMPL_VARARR( EECharAttribArray, EECharAttrib );
|
|
||||||
|
|
||||||
static SfxItemPool* pGlobalPool=0;
|
static SfxItemPool* pGlobalPool=0;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
@@ -1498,7 +1495,7 @@ const SfxPoolItem& EditEngine::GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhic
|
|||||||
return pImpEditEngine->GetParaAttrib( nPara, nWhich );
|
return pImpEditEngine->GetParaAttrib( nPara, nWhich );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEngine::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const
|
void EditEngine::GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const
|
||||||
{
|
{
|
||||||
DBG_CHKTHIS( EditEngine, 0 );
|
DBG_CHKTHIS( EditEngine, 0 );
|
||||||
pImpEditEngine->GetCharAttribs( nPara, rLst );
|
pImpEditEngine->GetCharAttribs( nPara, rLst );
|
||||||
|
@@ -235,7 +235,7 @@ sal_Bool EditTextObject::HasCharAttribs( sal_uInt16 ) const
|
|||||||
return sal_False;
|
return sal_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditTextObject::GetCharAttribs( sal_uInt16 /*nPara*/, EECharAttribArray& /*rLst*/ ) const
|
void EditTextObject::GetCharAttribs( sal_uInt16 /*nPara*/, std::vector<EECharAttrib>& /*rLst*/ ) const
|
||||||
{
|
{
|
||||||
OSL_FAIL( "Virtual method direct from EditTextObject!" );
|
OSL_FAIL( "Virtual method direct from EditTextObject!" );
|
||||||
}
|
}
|
||||||
@@ -792,9 +792,9 @@ sal_Bool BinTextObject::HasCharAttribs( sal_uInt16 _nWhich ) const
|
|||||||
return sal_False;
|
return sal_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BinTextObject::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const
|
void BinTextObject::GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const
|
||||||
{
|
{
|
||||||
rLst.Remove( 0, rLst.Count() );
|
rLst.clear();
|
||||||
ContentInfo* pC = GetContents().GetObject( nPara );
|
ContentInfo* pC = GetContents().GetObject( nPara );
|
||||||
if ( pC )
|
if ( pC )
|
||||||
{
|
{
|
||||||
@@ -806,7 +806,7 @@ void BinTextObject::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst )
|
|||||||
aEEAttr.nPara = nPara;
|
aEEAttr.nPara = nPara;
|
||||||
aEEAttr.nStart = pAttr->GetStart();
|
aEEAttr.nStart = pAttr->GetStart();
|
||||||
aEEAttr.nEnd = pAttr->GetEnd();
|
aEEAttr.nEnd = pAttr->GetEnd();
|
||||||
rLst.Insert( aEEAttr, rLst.Count() );
|
rLst.push_back(aEEAttr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -247,7 +247,7 @@ public:
|
|||||||
virtual sal_Bool HasOnlineSpellErrors() const;
|
virtual sal_Bool HasOnlineSpellErrors() const;
|
||||||
|
|
||||||
virtual sal_Bool HasCharAttribs( sal_uInt16 nWhich = 0 ) const;
|
virtual sal_Bool HasCharAttribs( sal_uInt16 nWhich = 0 ) const;
|
||||||
virtual void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const;
|
virtual void GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const;
|
||||||
|
|
||||||
virtual sal_Bool RemoveCharAttribs( sal_uInt16 nWhich = 0 );
|
virtual sal_Bool RemoveCharAttribs( sal_uInt16 nWhich = 0 );
|
||||||
virtual sal_Bool RemoveParaAttribs( sal_uInt16 nWhich = 0 );
|
virtual sal_Bool RemoveParaAttribs( sal_uInt16 nWhich = 0 );
|
||||||
|
@@ -550,7 +550,7 @@ private:
|
|||||||
sal_uInt16 GetParaAttrib( sal_uInt8 nFunc, EditSelection aSel );
|
sal_uInt16 GetParaAttrib( sal_uInt8 nFunc, EditSelection aSel );
|
||||||
void SetCharAttrib( EditSelection aSel, const SfxPoolItem& rItem );
|
void SetCharAttrib( EditSelection aSel, const SfxPoolItem& rItem );
|
||||||
void ParaAttribsToCharAttribs( ContentNode* pNode );
|
void ParaAttribsToCharAttribs( ContentNode* pNode );
|
||||||
void GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const;
|
void GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const;
|
||||||
|
|
||||||
EditTextObject* CreateBinTextObject( EditSelection aSelection, SfxItemPool*, sal_Bool bAllowBigObjects = sal_False, sal_uInt16 nBigObjStart = 0 ) const;
|
EditTextObject* CreateBinTextObject( EditSelection aSelection, SfxItemPool*, sal_Bool bAllowBigObjects = sal_False, sal_uInt16 nBigObjStart = 0 ) const;
|
||||||
void StoreBinTextObject( SvStream& rOStream, BinTextObject& rTextObject );
|
void StoreBinTextObject( SvStream& rOStream, BinTextObject& rTextObject );
|
||||||
|
@@ -742,21 +742,22 @@ const SfxPoolItem& ImpEditEngine::GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nW
|
|||||||
return pNode->GetContentAttribs().GetItem( nWhich );
|
return pNode->GetContentAttribs().GetItem( nWhich );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImpEditEngine::GetCharAttribs( sal_uInt16 nPara, EECharAttribArray& rLst ) const
|
void ImpEditEngine::GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const
|
||||||
{
|
{
|
||||||
rLst.Remove( 0, rLst.Count() );
|
rLst.clear();
|
||||||
ContentNode* pNode = aEditDoc.GetObject( nPara );
|
ContentNode* pNode = aEditDoc.GetObject( nPara );
|
||||||
if ( pNode )
|
if ( pNode )
|
||||||
{
|
{
|
||||||
for ( sal_uInt16 nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ )
|
rLst.reserve(pNode->GetCharAttribs().Count());
|
||||||
|
for (size_t i = 0; i < pNode->GetCharAttribs().Count(); ++i)
|
||||||
{
|
{
|
||||||
EditCharAttribPtr pAttr = pNode->GetCharAttribs().GetAttribs()[ nAttr ];
|
EditCharAttribPtr pAttr = pNode->GetCharAttribs().GetAttribs()[i];
|
||||||
EECharAttrib aEEAttr;
|
EECharAttrib aEEAttr;
|
||||||
aEEAttr.pAttr = pAttr->GetItem();
|
aEEAttr.pAttr = pAttr->GetItem();
|
||||||
aEEAttr.nPara = nPara;
|
aEEAttr.nPara = nPara;
|
||||||
aEEAttr.nStart = pAttr->GetStart();
|
aEEAttr.nStart = pAttr->GetStart();
|
||||||
aEEAttr.nEnd = pAttr->GetEnd();
|
aEEAttr.nEnd = pAttr->GetEnd();
|
||||||
rLst.Insert( aEEAttr, rLst.Count() );
|
rLst.push_back(aEEAttr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -132,37 +132,33 @@ void SvxEditSourceHint::SetEndValue( sal_uLong n )
|
|||||||
|
|
||||||
sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex )
|
sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex )
|
||||||
{
|
{
|
||||||
EECharAttribArray aCharAttribs;
|
std::vector<EECharAttrib> aCharAttribs;
|
||||||
|
|
||||||
rEE.GetCharAttribs( nPara, aCharAttribs );
|
rEE.GetCharAttribs( nPara, aCharAttribs );
|
||||||
|
|
||||||
// find closest index in front of nIndex
|
// find closest index in front of nIndex
|
||||||
sal_uInt16 nAttr, nCurrIndex;
|
sal_uInt16 nCurrIndex;
|
||||||
sal_Int32 nClosestStartIndex;
|
sal_Int32 nClosestStartIndex = 0;
|
||||||
for( nAttr=0, nClosestStartIndex=0; nAttr<aCharAttribs.Count(); ++nAttr )
|
for(std::vector<EECharAttrib>::iterator i = aCharAttribs.begin(); i < aCharAttribs.end(); ++i)
|
||||||
{
|
{
|
||||||
nCurrIndex = aCharAttribs[nAttr].nStart;
|
nCurrIndex = i->nStart;
|
||||||
|
|
||||||
if( nCurrIndex > nIndex )
|
if( nCurrIndex > nIndex )
|
||||||
break; // aCharAttribs array is sorted in increasing order for nStart values
|
break; // aCharAttribs array is sorted in increasing order for nStart values
|
||||||
|
else if( nCurrIndex > nClosestStartIndex )
|
||||||
if( nCurrIndex > nClosestStartIndex )
|
|
||||||
{
|
{
|
||||||
nClosestStartIndex = nCurrIndex;
|
nClosestStartIndex = nCurrIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// find closest index behind of nIndex
|
// find closest index behind of nIndex
|
||||||
sal_Int32 nClosestEndIndex;
|
sal_Int32 nClosestEndIndex = rEE.GetTextLen(nPara);
|
||||||
for( nAttr=0, nClosestEndIndex=rEE.GetTextLen(nPara); nAttr<aCharAttribs.Count(); ++nAttr )
|
for(std::vector<EECharAttrib>::iterator i = aCharAttribs.begin(); i < aCharAttribs.end(); ++i)
|
||||||
{
|
{
|
||||||
nCurrIndex = aCharAttribs[nAttr].nEnd;
|
nCurrIndex = i->nEnd;
|
||||||
|
|
||||||
if( nCurrIndex > nIndex &&
|
if( nCurrIndex > nIndex && nCurrIndex < nClosestEndIndex )
|
||||||
nCurrIndex < nClosestEndIndex )
|
|
||||||
{
|
|
||||||
nClosestEndIndex = nCurrIndex;
|
nClosestEndIndex = nCurrIndex;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nStartIndex = static_cast<sal_uInt16>( nClosestStartIndex );
|
nStartIndex = static_cast<sal_uInt16>( nClosestStartIndex );
|
||||||
|
@@ -177,7 +177,7 @@ void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, sal_uInt1
|
|||||||
|
|
||||||
sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich )
|
sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich )
|
||||||
{
|
{
|
||||||
EECharAttribArray aAttribs;
|
std::vector<EECharAttrib> aAttribs;
|
||||||
|
|
||||||
const SfxPoolItem* pLastItem = NULL;
|
const SfxPoolItem* pLastItem = NULL;
|
||||||
|
|
||||||
@@ -207,83 +207,44 @@ sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection&
|
|||||||
|
|
||||||
const SfxPoolItem* pParaItem = NULL;
|
const SfxPoolItem* pParaItem = NULL;
|
||||||
|
|
||||||
for( sal_uInt16 nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++ )
|
for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
|
||||||
{
|
{
|
||||||
struct EECharAttrib aAttrib = aAttribs.GetObject( nAttrib );
|
DBG_ASSERT(i->pAttr, "GetCharAttribs gives corrupt data");
|
||||||
DBG_ASSERT( aAttrib.pAttr, "GetCharAttribs gives corrupt data" );
|
|
||||||
|
|
||||||
const sal_Bool bEmptyPortion = aAttrib.nStart == aAttrib.nEnd;
|
const sal_Bool bEmptyPortion = i->nStart == i->nEnd;
|
||||||
if( (!bEmptyPortion && (aAttrib.nStart >= nEndPos)) || (bEmptyPortion && (aAttrib.nStart > nEndPos)) )
|
if((!bEmptyPortion && i->nStart >= nEndPos) ||
|
||||||
|
(bEmptyPortion && i->nStart > nEndPos))
|
||||||
break; // break if we are already behind our selektion
|
break; // break if we are already behind our selektion
|
||||||
|
|
||||||
if( (!bEmptyPortion && (aAttrib.nEnd <= nPos)) || (bEmptyPortion && (aAttrib.nEnd < nPos)) )
|
if((!bEmptyPortion && i->nEnd <= nPos) ||
|
||||||
|
(bEmptyPortion && i->nEnd < nPos))
|
||||||
continue; // or if the attribute ends before our selektion
|
continue; // or if the attribute ends before our selektion
|
||||||
|
|
||||||
if( aAttrib.pAttr->Which() != nWhich )
|
if(i->pAttr->Which() != nWhich)
|
||||||
continue; // skip if is not the searched item
|
continue; // skip if is not the searched item
|
||||||
|
|
||||||
// if we already found an item
|
// if we already found an item
|
||||||
if( pParaItem )
|
if( pParaItem )
|
||||||
{
|
{
|
||||||
// ... and its different to this one than the state is dont care
|
// ... and its different to this one than the state is dont care
|
||||||
if( *pParaItem != *aAttrib.pAttr )
|
if(*pParaItem != *(i->pAttr))
|
||||||
return SFX_ITEM_DONTCARE;
|
return SFX_ITEM_DONTCARE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
pParaItem = i->pAttr;
|
||||||
pParaItem = aAttrib.pAttr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( bEmpty )
|
if( bEmpty )
|
||||||
bEmpty = sal_False;
|
bEmpty = sal_False;
|
||||||
|
|
||||||
if( !bGaps && aAttrib.nStart > nLastEnd )
|
if(!bGaps && i->nStart > nLastEnd)
|
||||||
bGaps = sal_True;
|
bGaps = sal_True;
|
||||||
|
|
||||||
nLastEnd = aAttrib.nEnd;
|
nLastEnd = i->nEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) )
|
if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) )
|
||||||
bGaps = sal_True;
|
bGaps = sal_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 )
|
if( bEmpty )
|
||||||
eParaState = SFX_ITEM_DEFAULT;
|
eParaState = SFX_ITEM_DEFAULT;
|
||||||
else if( bGaps )
|
else if( bGaps )
|
||||||
|
@@ -1142,7 +1142,7 @@ void SmTextForwarder::FieldClicked(const SvxFieldItem&, sal_uInt16, sal_uInt16)
|
|||||||
|
|
||||||
sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich )
|
sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich )
|
||||||
{
|
{
|
||||||
EECharAttribArray aAttribs;
|
std::vector<EECharAttrib> aAttribs;
|
||||||
|
|
||||||
const SfxPoolItem* pLastItem = NULL;
|
const SfxPoolItem* pLastItem = NULL;
|
||||||
|
|
||||||
@@ -1172,40 +1172,39 @@ sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection&
|
|||||||
|
|
||||||
const SfxPoolItem* pParaItem = NULL;
|
const SfxPoolItem* pParaItem = NULL;
|
||||||
|
|
||||||
for( sal_uInt16 nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++ )
|
for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
|
||||||
{
|
{
|
||||||
struct EECharAttrib aAttrib = aAttribs.GetObject( nAttrib );
|
OSL_ENSURE( i->pAttr, "GetCharAttribs gives corrupt data" );
|
||||||
OSL_ENSURE( aAttrib.pAttr, "GetCharAttribs gives corrupt data" );
|
|
||||||
|
|
||||||
const sal_Bool bEmptyPortion = aAttrib.nStart == aAttrib.nEnd;
|
const sal_Bool bEmptyPortion = (i->nStart == i->nEnd);
|
||||||
if( (!bEmptyPortion && (aAttrib.nStart >= nEndPos)) || (bEmptyPortion && (aAttrib.nStart > nEndPos)) )
|
if( (!bEmptyPortion && (i->nStart >= nEndPos)) || (bEmptyPortion && (i->nStart > nEndPos)) )
|
||||||
break; // break if we are already behind our selektion
|
break; // break if we are already behind our selektion
|
||||||
|
|
||||||
if( (!bEmptyPortion && (aAttrib.nEnd <= nPos)) || (bEmptyPortion && (aAttrib.nEnd < nPos)) )
|
if( (!bEmptyPortion && (i->nEnd <= nPos)) || (bEmptyPortion && (i->nEnd < nPos)) )
|
||||||
continue; // or if the attribute ends before our selektion
|
continue; // or if the attribute ends before our selektion
|
||||||
|
|
||||||
if( aAttrib.pAttr->Which() != nWhich )
|
if( i->pAttr->Which() != nWhich )
|
||||||
continue; // skip if is not the searched item
|
continue; // skip if is not the searched item
|
||||||
|
|
||||||
// if we already found an item
|
// if we already found an item
|
||||||
if( pParaItem )
|
if( pParaItem )
|
||||||
{
|
{
|
||||||
// ... and its different to this one than the state is dont care
|
// ... and its different to this one than the state is dont care
|
||||||
if( *pParaItem != *aAttrib.pAttr )
|
if( *pParaItem != *(i->pAttr) )
|
||||||
return SFX_ITEM_DONTCARE;
|
return SFX_ITEM_DONTCARE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pParaItem = aAttrib.pAttr;
|
pParaItem = i->pAttr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( bEmpty )
|
if( bEmpty )
|
||||||
bEmpty = false;
|
bEmpty = false;
|
||||||
|
|
||||||
if( !bGaps && aAttrib.nStart > nLastEnd )
|
if( !bGaps && i->nStart > nLastEnd )
|
||||||
bGaps = true;
|
bGaps = true;
|
||||||
|
|
||||||
nLastEnd = aAttrib.nEnd;
|
nLastEnd = i->nEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) )
|
if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) )
|
||||||
|
@@ -456,19 +456,16 @@ namespace sdr
|
|||||||
if(aSet.GetItemState(EE_CHAR_COLOR) == SFX_ITEM_SET)
|
if(aSet.GetItemState(EE_CHAR_COLOR) == SFX_ITEM_SET)
|
||||||
{
|
{
|
||||||
EditEngine* pEditEngine = const_cast<EditEngine*>(&(pOutliner->GetEditEngine()));
|
EditEngine* pEditEngine = const_cast<EditEngine*>(&(pOutliner->GetEditEngine()));
|
||||||
EECharAttribArray aAttribs;
|
std::vector<EECharAttrib> aAttribs;
|
||||||
pEditEngine->GetCharAttribs((sal_uInt16)nPara, aAttribs);
|
pEditEngine->GetCharAttribs((sal_uInt16)nPara, aAttribs);
|
||||||
sal_uInt16 nAttrib;
|
|
||||||
|
|
||||||
for(nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++)
|
for(std::vector<EECharAttrib>::iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
|
||||||
{
|
{
|
||||||
struct EECharAttrib aAttrib(aAttribs.GetObject(nAttrib));
|
if(EE_FEATURE_FIELD == i->pAttr->Which())
|
||||||
|
|
||||||
if(EE_FEATURE_FIELD == aAttrib.pAttr->Which())
|
|
||||||
{
|
{
|
||||||
if(aAttrib.pAttr)
|
if(i->pAttr)
|
||||||
{
|
{
|
||||||
SvxFieldItem* pFieldItem = (SvxFieldItem*)aAttrib.pAttr;
|
SvxFieldItem* pFieldItem = (SvxFieldItem*)(i->pAttr);
|
||||||
|
|
||||||
if(pFieldItem)
|
if(pFieldItem)
|
||||||
{
|
{
|
||||||
@@ -491,20 +488,16 @@ namespace sdr
|
|||||||
|
|
||||||
ESelection aSel((sal_uInt16)nPara, 0);
|
ESelection aSel((sal_uInt16)nPara, 0);
|
||||||
|
|
||||||
for(nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++)
|
for(std::vector<EECharAttrib>::iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
|
||||||
{
|
{
|
||||||
struct EECharAttrib aAttrib(aAttribs.GetObject(nAttrib));
|
if(EE_FEATURE_FIELD == i->pAttr->Which())
|
||||||
|
|
||||||
if(EE_FEATURE_FIELD == aAttrib.pAttr->Which())
|
|
||||||
{
|
{
|
||||||
aSel.nEndPos = aAttrib.nStart;
|
aSel.nEndPos = i->nStart;
|
||||||
|
|
||||||
if(aSel.nStartPos != aSel.nEndPos)
|
if(aSel.nStartPos != aSel.nEndPos)
|
||||||
{
|
|
||||||
pEditEngine->QuickSetAttribs(aColorSet, aSel);
|
pEditEngine->QuickSetAttribs(aColorSet, aSel);
|
||||||
}
|
|
||||||
|
|
||||||
aSel.nStartPos = aAttrib.nEnd;
|
aSel.nStartPos = i->nEnd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -859,7 +859,7 @@ void WW8Export::AppendFlyInFlys(const sw::Frame& rFrmFmt,
|
|||||||
MSWord_SdrAttrIter::MSWord_SdrAttrIter( MSWordExportBase& rWr,
|
MSWord_SdrAttrIter::MSWord_SdrAttrIter( MSWordExportBase& rWr,
|
||||||
const EditTextObject& rEditObj, sal_uInt8 nTyp )
|
const EditTextObject& rEditObj, sal_uInt8 nTyp )
|
||||||
: MSWordAttrIter( rWr ), pEditObj(&rEditObj), pEditPool(0),
|
: MSWordAttrIter( rWr ), pEditObj(&rEditObj), pEditPool(0),
|
||||||
aTxtAtrArr( 0, 4 ), aChrTxtAtrArr( 0, 4 ), aChrSetArr( 0, 4 ),
|
aTxtAtrArr(), aChrTxtAtrArr( 0, 4 ), aChrSetArr( 0, 4 ),
|
||||||
mnTyp(nTyp)
|
mnTyp(nTyp)
|
||||||
{
|
{
|
||||||
NextPara( 0 );
|
NextPara( 0 );
|
||||||
@@ -898,29 +898,22 @@ rtl_TextEncoding MSWord_SdrAttrIter::GetNextCharSet() const
|
|||||||
// der erste Parameter in SearchNext() liefert zurueck, ob es ein TxtAtr ist.
|
// der erste Parameter in SearchNext() liefert zurueck, ob es ein TxtAtr ist.
|
||||||
xub_StrLen MSWord_SdrAttrIter::SearchNext( xub_StrLen nStartPos )
|
xub_StrLen MSWord_SdrAttrIter::SearchNext( xub_StrLen nStartPos )
|
||||||
{
|
{
|
||||||
xub_StrLen nPos;
|
sal_uInt16 nMinPos = STRING_MAXLEN;
|
||||||
xub_StrLen nMinPos = STRING_MAXLEN;
|
for(std::vector<EECharAttrib>::const_iterator i = aTxtAtrArr.begin(); i < aTxtAtrArr.end(); ++i)
|
||||||
xub_StrLen i;
|
|
||||||
|
|
||||||
for( i = 0; i < aTxtAtrArr.Count(); i++ )
|
|
||||||
{
|
{
|
||||||
const EECharAttrib& rHt = aTxtAtrArr[ i ];
|
sal_uInt16 nPos = i->nStart; // gibt erstes Attr-Zeichen
|
||||||
nPos = rHt.nStart; // gibt erstes Attr-Zeichen
|
|
||||||
if( nPos >= nStartPos && nPos <= nMinPos )
|
if( nPos >= nStartPos && nPos <= nMinPos )
|
||||||
{
|
{
|
||||||
nMinPos = nPos;
|
nMinPos = nPos;
|
||||||
SetCharSet(rHt, true);
|
SetCharSet(*i, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nPos = i->nEnd; // gibt letztes Attr-Zeichen + 1
|
||||||
|
if( nPos >= nStartPos && nPos < nMinPos )
|
||||||
{
|
{
|
||||||
nPos = rHt.nEnd; // gibt letztes Attr-Zeichen + 1
|
nMinPos = nPos;
|
||||||
if( nPos >= nStartPos && nPos < nMinPos )
|
SetCharSet(*i, false);
|
||||||
{
|
|
||||||
nMinPos = nPos;
|
|
||||||
SetCharSet(rHt, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return nMinPos;
|
return nMinPos;
|
||||||
}
|
}
|
||||||
@@ -978,7 +971,7 @@ void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
|
|||||||
{
|
{
|
||||||
OutParaAttr(true);
|
OutParaAttr(true);
|
||||||
|
|
||||||
if( aTxtAtrArr.Count() )
|
if(!aTxtAtrArr.empty())
|
||||||
{
|
{
|
||||||
const SwModify* pOldMod = m_rExport.pOutFmtNode;
|
const SwModify* pOldMod = m_rExport.pOutFmtNode;
|
||||||
m_rExport.pOutFmtNode = 0;
|
m_rExport.pOutFmtNode = 0;
|
||||||
@@ -987,16 +980,15 @@ void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
|
|||||||
const SfxItemPool& rDstPool = m_rExport.pDoc->GetAttrPool();
|
const SfxItemPool& rDstPool = m_rExport.pDoc->GetAttrPool();
|
||||||
|
|
||||||
nTmpSwPos = nSwPos;
|
nTmpSwPos = nSwPos;
|
||||||
sal_uInt16 i, nWhich, nSlotId;
|
sal_uInt16 nWhich, nSlotId;
|
||||||
for( i = 0; i < aTxtAtrArr.Count(); i++ )
|
for(std::vector<EECharAttrib>::const_iterator i = aTxtAtrArr.begin(); i < aTxtAtrArr.end(); ++i)
|
||||||
{
|
{
|
||||||
const EECharAttrib& rHt = aTxtAtrArr[ i ];
|
if (nSwPos >= i->nStart && nSwPos < i->nEnd)
|
||||||
if (nSwPos >= rHt.nStart && nSwPos < rHt.nEnd)
|
|
||||||
{
|
{
|
||||||
nWhich = rHt.pAttr->Which();
|
nWhich = i->pAttr->Which();
|
||||||
if (nWhich == EE_FEATURE_FIELD)
|
if (nWhich == EE_FEATURE_FIELD)
|
||||||
{
|
{
|
||||||
OutEEField(*rHt.pAttr);
|
OutEEField(*(i->pAttr));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (nWhich == EE_FEATURE_TAB)
|
else if (nWhich == EE_FEATURE_TAB)
|
||||||
@@ -1014,7 +1006,7 @@ void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
|
|||||||
m_rExport.CollapseScriptsforWordOk(nScript,nWhich))
|
m_rExport.CollapseScriptsforWordOk(nScript,nWhich))
|
||||||
{
|
{
|
||||||
// use always the SW-Which Id !
|
// use always the SW-Which Id !
|
||||||
SfxPoolItem* pI = rHt.pAttr->Clone();
|
SfxPoolItem* pI = i->pAttr->Clone();
|
||||||
pI->SetWhich( nWhich );
|
pI->SetWhich( nWhich );
|
||||||
m_rExport.AttrOutput().OutputItem( *pI );
|
m_rExport.AttrOutput().OutputItem( *pI );
|
||||||
delete pI;
|
delete pI;
|
||||||
@@ -1022,7 +1014,7 @@ void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( nSwPos < rHt.nStart )
|
if( nSwPos < i->nStart )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1033,18 +1025,13 @@ void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
|
|||||||
|
|
||||||
bool MSWord_SdrAttrIter::IsTxtAttr(xub_StrLen nSwPos)
|
bool MSWord_SdrAttrIter::IsTxtAttr(xub_StrLen nSwPos)
|
||||||
{
|
{
|
||||||
for (sal_uInt16 i = 0; i < aTxtAtrArr.Count(); ++i)
|
for (std::vector<EECharAttrib>::const_iterator i = aTxtAtrArr.begin(); i < aTxtAtrArr.end(); ++i)
|
||||||
{
|
{
|
||||||
const EECharAttrib& rHt = aTxtAtrArr[ i ];
|
if (nSwPos >= i->nStart && nSwPos < i->nEnd)
|
||||||
if (nSwPos >= rHt.nStart && nSwPos < rHt.nEnd)
|
|
||||||
{
|
{
|
||||||
if (
|
if (i->pAttr->Which() == EE_FEATURE_FIELD ||
|
||||||
(rHt.pAttr->Which() == EE_FEATURE_FIELD) ||
|
i->pAttr->Which() == EE_FEATURE_TAB)
|
||||||
(rHt.pAttr->Which() == EE_FEATURE_TAB)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -1058,27 +1045,19 @@ bool MSWord_SdrAttrIter::IsTxtAttr(xub_StrLen nSwPos)
|
|||||||
// Es wird mit bDeep gesucht
|
// Es wird mit bDeep gesucht
|
||||||
const SfxPoolItem* MSWord_SdrAttrIter::HasTextItem(sal_uInt16 nWhich) const
|
const SfxPoolItem* MSWord_SdrAttrIter::HasTextItem(sal_uInt16 nWhich) const
|
||||||
{
|
{
|
||||||
const SfxPoolItem* pRet = 0;
|
|
||||||
nWhich = sw::hack::TransformWhichBetweenPools(*pEditPool,
|
nWhich = sw::hack::TransformWhichBetweenPools(*pEditPool,
|
||||||
m_rExport.pDoc->GetAttrPool(), nWhich);
|
m_rExport.pDoc->GetAttrPool(), nWhich);
|
||||||
if (nWhich)
|
if (nWhich)
|
||||||
{
|
{
|
||||||
for (sal_uInt16 i = 0; i < aTxtAtrArr.Count(); ++i)
|
for (std::vector<EECharAttrib>::const_iterator i = aTxtAtrArr.begin(); i < aTxtAtrArr.end(); ++i)
|
||||||
{
|
{
|
||||||
const EECharAttrib& rHt = aTxtAtrArr[i];
|
if (nWhich == i->pAttr->Which() && nTmpSwPos >= i->nStart && nTmpSwPos < i->nEnd)
|
||||||
if (
|
return i->pAttr; // Found
|
||||||
nWhich == rHt.pAttr->Which() && nTmpSwPos >= rHt.nStart &&
|
else if (nTmpSwPos < i->nStart)
|
||||||
nTmpSwPos < rHt.nEnd
|
return NULL; // dann kommt da nichts mehr
|
||||||
)
|
|
||||||
{
|
|
||||||
pRet = rHt.pAttr; // Found
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (nTmpSwPos < rHt.nStart)
|
|
||||||
break; // dann kommt da nichts mehr
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pRet;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SfxPoolItem& MSWord_SdrAttrIter::GetItem( sal_uInt16 nWhich ) const
|
const SfxPoolItem& MSWord_SdrAttrIter::GetItem( sal_uInt16 nWhich ) const
|
||||||
|
@@ -1371,7 +1371,7 @@ class MSWord_SdrAttrIter : public MSWordAttrIter
|
|||||||
private:
|
private:
|
||||||
const EditTextObject* pEditObj;
|
const EditTextObject* pEditObj;
|
||||||
const SfxItemPool* pEditPool;
|
const SfxItemPool* pEditPool;
|
||||||
EECharAttribArray aTxtAtrArr;
|
std::vector<EECharAttrib> aTxtAtrArr;
|
||||||
SvPtrarr aChrTxtAtrArr;
|
SvPtrarr aChrTxtAtrArr;
|
||||||
std::vector<sal_uInt16> aChrSetArr;
|
std::vector<sal_uInt16> aChrSetArr;
|
||||||
sal_uInt16 nPara;
|
sal_uInt16 nPara;
|
||||||
|
Reference in New Issue
Block a user