summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjp <jp@openoffice.org>2000-11-23 19:08:52 +0000
committerjp <jp@openoffice.org>2000-11-23 19:08:52 +0000
commit1cb58f596e4c317a133d1b09593330899ade7d32 (patch)
tree0d29d57b65da993eb8bb400b0abccb59fc95d7f5
parentd00bb6d5d9cc1c1efcdf5b66e528c6b5ff0e3790 (diff)
Task #80648#: use new class SvxScriptSetItem
-rw-r--r--sw/source/ui/shells/basesh.cxx133
-rw-r--r--sw/source/ui/shells/txtattr.cxx70
2 files changed, 94 insertions, 109 deletions
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index 16b962ece9df..7a96d4fe8033 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: basesh.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jp $ $Date: 2000-11-13 13:19:55 $
+ * last change: $Author: jp $ $Date: 2000-11-23 20:08:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -172,6 +172,9 @@
#ifndef _SVX_BORDER_HXX
#include <svx/border.hxx>
#endif
+#ifndef _SVX_SCRIPTTYPEITEM_HXX
+#include <svx/scripttypeitem.hxx>
+#endif
#ifndef _FMTURL_HXX //autogen
#include <fmturl.hxx>
@@ -269,9 +272,6 @@
#ifndef _SWWAIT_HXX
#include <swwait.hxx>
#endif
-#ifndef _SCRPMTCH_HXX
-#include <scrpmtch.hxx>
-#endif
#ifndef _CMDID_H
#include <cmdid.h>
@@ -1840,42 +1840,29 @@ SwBaseShell::~SwBaseShell()
Beschreibung:
--------------------------------------------------------------------*/
-void SwBaseShell::ExecTxtCtrl(SfxRequest& rReq)
+void SwBaseShell::ExecTxtCtrl( SfxRequest& rReq )
{
const SfxItemSet *pArgs = rReq.GetArgs();
if( pArgs)
{
SwWrtShell &rSh = GetShell();
- USHORT nWhich = pArgs->GetPool()->GetWhich( rReq.GetSlot() );
- GetLatinAsianComplexAttr* pGetAttr = 0;
+ SvxScriptSetItem* pSSetItem = 0;
+ USHORT nWhich = rReq.GetSlot();
switch( nWhich )
{
- case RES_CHRATR_FONT:
- case RES_CHRATR_FONTSIZE:
- case RES_CHRATR_POSTURE:
- case RES_CHRATR_WEIGHT:
- case RES_CHRATR_LANGUAGE:
- pGetAttr = new GetLatinAsianComplexAttr( nWhich, rSh );
- SfxItemSet* pSet = (SfxItemSet*)pGetAttr->GetItemSet(
- rSh.GetScriptType() );
- if( pSet )
+ case SID_ATTR_CHAR_FONT:
+ case SID_ATTR_CHAR_FONTHEIGHT:
+ case SID_ATTR_CHAR_POSTURE:
+ case SID_ATTR_CHAR_WEIGHT:
{
- SfxPoolItem* pNew = pArgs->Get( nWhich ).Clone();
- SfxItemIter aIter( *pSet );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- while( TRUE )
- {
- pNew->SetWhich( pItem->Which() );
- pSet->Put( *pNew );
-
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
- }
- delete pNew;
+ SfxItemPool& rPool = rSh.GetAttrPool();
+ pSSetItem = new SvxScriptSetItem( nWhich, rPool );
+ nWhich = rPool.GetWhich( nWhich );
+ pSSetItem->PutItemForScriptType( rSh.GetScriptType(),
+ pArgs->Get( nWhich ));
+ pArgs = &pSSetItem->GetItemSet();
}
- pArgs = pSet;
break;
}
@@ -1889,9 +1876,8 @@ void SwBaseShell::ExecTxtCtrl(SfxRequest& rReq)
rSh.AutoUpdatePara( pColl, *pArgs );
else
rSh.SetAttr( *pArgs );
-
- delete pGetAttr;
}
+ delete pSSetItem;
}
}
@@ -1908,60 +1894,48 @@ void SwBaseShell::GetTxtCtrlState( SfxItemSet& rSet )
void SwBaseShell::GetTxtFontCtrlState( SfxItemSet& rSet )
{
SwWrtShell &rSh = GetShell();
- rSh.GetAttr( rSet );
-
- USHORT nWhich = rSet.GetWhichByPos( 0 );
- switch( nWhich )
+ BOOL bFirst = TRUE;
+ SfxItemSet* pFntCoreSet = 0;
+ USHORT nScriptType;
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ while( nWhich )
{
- case RES_CHRATR_FONT:
- case RES_CHRATR_FONTSIZE:
- case RES_CHRATR_POSTURE:
- case RES_CHRATR_WEIGHT:
- case RES_CHRATR_LANGUAGE:
+ switch( nWhich )
{
- GetLatinAsianComplexAttr aGetAttr( nWhich, rSh );
- const SfxItemSet* pSet = aGetAttr.GetItemSet(
- rSh.GetScriptType(), rSet );
- if( pSet )
+ case RES_CHRATR_FONT:
+ case RES_CHRATR_FONTSIZE:
+ case RES_CHRATR_WEIGHT:
+ case RES_CHRATR_POSTURE:
{
- SfxItemIter aIter( *pSet );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- SfxPoolItem* pSetItem = 0;
- while( (SfxPoolItem*)-1 != pSetItem )
+ if( !pFntCoreSet )
{
- if( !pSetItem )
- {
- pSetItem = pItem->Clone();
- pSetItem->SetWhich( nWhich );
- }
- else
- {
- SfxPoolItem* pCmp = pItem->Clone();
- pCmp->SetWhich( nWhich );
- if( *pSetItem != *pCmp )
- {
- delete pSetItem;
- pSetItem = (SfxPoolItem*)-1;
- }
- delete pCmp;
- }
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
+ pFntCoreSet = new SfxItemSet( *rSet.GetPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1 );
+ rSh.GetAttr( *pFntCoreSet );
+ nScriptType = rSh.GetScriptType();
}
+ SfxItemPool& rPool = *rSet.GetPool();
+ SvxScriptSetItem aSetItem( rPool.GetSlotId( nWhich ), rPool );
+ aSetItem.GetItemSet().Put( *pFntCoreSet, FALSE );
+ const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
+ if( pI )
+ rSet.Put( *pI, nWhich );
+ else
+ rSet.InvalidateItem( nWhich );
+ }
+ break;
- if( (SfxPoolItem*)-1 != pSetItem && 0 != pSetItem )
- {
- rSet.Put( *pSetItem );
- delete pSetItem;
- }
+ default:
+ if( bFirst )
+ {
+ rSh.GetAttr( rSet );
+ bFirst = FALSE;
}
}
- break;
-
- default:
- ASSERT( !this, "wrong Which Id in the set" );
+ nWhich = aIter.NextWhich();
}
+ delete pFntCoreSet;
}
/*--------------------------------------------------------------------
@@ -2533,6 +2507,9 @@ void SwBaseShell::ExecField( SfxRequest& rReq )
/*------------------------------------------------------------------------
$Log: not supported by cvs2svn $
+ Revision 1.2 2000/11/13 13:19:55 jp
+ new method GetTextFontCtrl
+
Revision 1.1.1.1 2000/09/18 17:14:46 hr
initial import
diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx
index 527a9d273548..1b87aacc8a7d 100644
--- a/sw/source/ui/shells/txtattr.cxx
+++ b/sw/source/ui/shells/txtattr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtattr.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jp $ $Date: 2000-11-13 13:21:12 $
+ * last change: $Author: jp $ $Date: 2000-11-23 20:08:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,7 +65,9 @@
#pragma hdrstop
-#include "hintids.hxx"
+#ifndef _HINTIDS_HXX
+#include <hintids.hxx>
+#endif
#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
@@ -103,6 +105,9 @@
#ifndef _SVX_HTMLMODE_HXX //autogen
#include <svx/htmlmode.hxx>
#endif
+#ifndef _SVX_SCRIPTTYPEITEM_HXX
+#include <svx/scripttypeitem.hxx>
+#endif
#ifndef _FMTINFMT_HXX //autogen
@@ -141,9 +146,6 @@
#ifndef _FMTCOL_HXX
#include <fmtcol.hxx>
#endif
-#ifndef _SCRPMTCH_HXX
-#include <scrpmtch.hxx>
-#endif
#ifndef _CMDID_H
#include <cmdid.h>
@@ -272,15 +274,16 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
int bGrow = FALSE;
SwWrtShell& rWrtSh = GetShell();
SwTxtFmtColl* pColl = 0;
+
// nur gesetzt, wenn gesamter Absatz selektiert ist und AutoUpdateFmt gesetzt ist
- if(rWrtSh.HasSelection() &&
- rWrtSh.IsSelFullPara())
+ if( rWrtSh.HasSelection() && rWrtSh.IsSelFullPara() )
{
pColl = rWrtSh.GetCurTxtFmtColl();
if(pColl && !pColl->IsAutoUpdateFmt())
pColl = 0;
}
- USHORT nWhich = GetPool().GetWhich(nSlot);
+ SfxItemPool& rPool = GetPool();
+ USHORT nWhich = rPool.GetWhich(nSlot);
switch ( nSlot )
{
case FN_TXTATR_INET:
@@ -312,16 +315,19 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
// kein break !!
case FN_SHRINK_FONT_SIZE:
{
- GetLatinAsianComplexAttr aAttrs( RES_CHRATR_FONTSIZE, rWrtSh );
- SfxItemSet* pSet = (SfxItemSet*)aAttrs.GetItemSet(
- rWrtSh.GetScriptType());
- if( pSet )
- {
- SfxItemIter aIter( *pSet );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- while( TRUE )
+ SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, rPool );
+ rWrtSh.GetAttr( aSetItem.GetItemSet() );
+ SfxItemSet aAttrSet( rPool, aSetItem.GetItemSet().GetRanges() );
+
+ const SfxPoolItem* pI;
+ static const USHORT aScrTypes[] = {
+ SCRIPTTYPE_LATIN, SCRIPTTYPE_ASIAN, SCRIPTTYPE_COMPLEX, 0 };
+ USHORT nScriptType = rWrtSh.GetScriptType();
+ for( const USHORT* pScrpTyp = aScrTypes; *pScrpTyp; ++pScrpTyp )
+ if( ( nScriptType & *pScrpTyp ) &&
+ 0 != ( pI = aSetItem.GetItemOfScript( *pScrpTyp )))
{
- SvxFontHeightItem aSize( *(const SvxFontHeightItem*)pItem);
+ SvxFontHeightItem aSize( *(const SvxFontHeightItem*)pI );
SwTwips lSize = (SwTwips) aSize.GetHeight();
if (bGrow)
@@ -339,18 +345,15 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
lSize = 4;
}
aSize.SetHeight( lSize );
- pSet->Put( aSize );
-
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
+ aAttrSet.Put( aSize );
+ }
+ if( aAttrSet.Count() )
+ {
+ if( pColl )
+ pColl->SetAttr( aAttrSet );
+ else
+ rWrtSh.SetAttr( aAttrSet );
}
-
- if( pColl )
- pColl->SetAttr( *pSet );
- else
- rWrtSh.SetAttr( *pSet );
- }
}
break;
@@ -665,8 +668,10 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet)
case FN_GROW_FONT_SIZE:
case FN_SHRINK_FONT_SIZE:
{
- GetLatinAsianComplexAttr aAttrs( RES_CHRATR_FONTSIZE );
- if( !aAttrs.GetItemSet( rSh.GetScriptType(), aCoreSet ))
+ SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT,
+ *rSet.GetPool() );
+ aSetItem.GetItemSet().Put( aCoreSet, FALSE );
+ if( !aSetItem.GetItemOfScript( rSh.GetScriptType() ))
rSet.DisableItem( nSlot );
nSlot = 0;
}
@@ -751,6 +756,9 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet)
/*------------------------------------------------------------------------
$Log: not supported by cvs2svn $
+ Revision 1.2 2000/11/13 13:21:12 jp
+ support CJK attributes
+
Revision 1.1.1.1 2000/09/18 17:14:47 hr
initial import