[PATCH] Widget for asian typography
Olivier Hallot (via Code Review)
gerrit at gerrit.libreoffice.org
Mon Feb 11 15:43:22 PST 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/2115
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/15/2115/1
Widget for asian typography
Change-Id: I70535593c3e06caca48ae8bc8b9476ae09210df8
---
M cui/source/inc/paragrph.hxx
M cui/source/tabpages/paragrph.cxx
M cui/source/tabpages/paragrph.hrc
M cui/source/tabpages/paragrph.src
4 files changed, 23 insertions(+), 72 deletions(-)
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index ae9904f..045a29d 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -278,17 +278,15 @@
//--------------------------------------------------------------------------
class SvxAsianTabPage : public SfxTabPage
{
- FixedLine aOptionsFL;
- TriStateBox aForbiddenRulesCB;
- TriStateBox aHangingPunctCB;
-
- TriStateBox aScriptSpaceCB;
+ CheckBox* m_pForbiddenRulesCB;
+ CheckBox* m_pHangingPunctCB;
+ CheckBox* m_pScriptSpaceCB;
SvxAsianTabPage( Window* pParent, const SfxItemSet& rSet );
#ifdef _SVX_PARAGRPH_CXX
- DECL_LINK( ClickHdl_Impl, TriStateBox* );
+ DECL_LINK( ClickHdl_Impl, CheckBox* );
#endif
public:
~SvxAsianTabPage();
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 693012c..5d72269 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -2221,19 +2221,17 @@
}
SvxAsianTabPage::SvxAsianTabPage( Window* pParent, const SfxItemSet& rSet ) :
- SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_PARA_ASIAN ), rSet),
- aOptionsFL( this, CUI_RES(FL_AS_OPTIONS )),
- aForbiddenRulesCB( this, CUI_RES(CB_AS_FORBIDDEN )),
- aHangingPunctCB( this, CUI_RES(CB_AS_HANG_PUNC )),
- aScriptSpaceCB( this, CUI_RES(CB_AS_SCRIPT_SPACE ))//,
+ SfxTabPage(pParent, "AsianTypography","cui/ui/asiantypography.ui", rSet)
{
- FreeResource();
+ get(m_pForbiddenRulesCB,"checkForbidList");
+ get(m_pHangingPunctCB,"checkHangPunct");
+ get(m_pScriptSpaceCB,"checkApplySpacing");
Link aLink = LINK( this, SvxAsianTabPage, ClickHdl_Impl );
- aHangingPunctCB.SetClickHdl( aLink );
- aScriptSpaceCB.SetClickHdl( aLink );
- aForbiddenRulesCB.SetClickHdl( aLink );
+ m_pHangingPunctCB->SetClickHdl( aLink );
+ m_pScriptSpaceCB->SetClickHdl( aLink );
+ m_pForbiddenRulesCB->SetClickHdl( aLink );
}
@@ -2255,34 +2253,34 @@
};
return pRanges;
}
-
+//FIXME: This crash in Calc, but works in Writer/Draw/Impress
sal_Bool SvxAsianTabPage::FillItemSet( SfxItemSet& rSet )
{
sal_Bool bRet = sal_False;
SfxItemPool* pPool = rSet.GetPool();
- if(aScriptSpaceCB.IsChecked() != aScriptSpaceCB.GetSavedValue())
+ if(m_pScriptSpaceCB->IsChecked() != m_pScriptSpaceCB->GetSavedValue())
{
SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone();
- pNewItem->SetValue(aScriptSpaceCB.IsChecked());
+ pNewItem->SetValue(m_pScriptSpaceCB->IsChecked());
rSet.Put(*pNewItem);
delete pNewItem;
bRet = sal_True;
}
- if(aHangingPunctCB.IsChecked() != aHangingPunctCB.GetSavedValue())
+ if(m_pHangingPunctCB->IsChecked() != m_pHangingPunctCB->GetSavedValue())
{
SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone();
- pNewItem->SetValue(aHangingPunctCB.IsChecked());
+ pNewItem->SetValue(m_pHangingPunctCB->IsChecked());
rSet.Put(*pNewItem);
delete pNewItem;
bRet = sal_True;
}
- if(aForbiddenRulesCB.IsChecked() != aForbiddenRulesCB.GetSavedValue())
+ if(m_pForbiddenRulesCB->IsChecked() != m_pForbiddenRulesCB->GetSavedValue())
{
SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone();
- pNewItem->SetValue(aForbiddenRulesCB.IsChecked());
+ pNewItem->SetValue(m_pForbiddenRulesCB->IsChecked());
rSet.Put(*pNewItem);
delete pNewItem;
bRet = sal_True;
@@ -2290,7 +2288,7 @@
return bRet;
}
-static void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, TriStateBox& rBox)
+static void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, CheckBox& rBox)
{
sal_uInt16 _nWhich = rSet.GetPool()->GetWhich(nSlotId);
SfxItemState eState = rSet.GetItemState(_nWhich, sal_True);
@@ -2309,14 +2307,14 @@
void SvxAsianTabPage::Reset( const SfxItemSet& rSet )
{
- lcl_SetBox(rSet, SID_ATTR_PARA_FORBIDDEN_RULES, aForbiddenRulesCB );
- lcl_SetBox(rSet, SID_ATTR_PARA_HANGPUNCTUATION, aHangingPunctCB );
+ lcl_SetBox(rSet, SID_ATTR_PARA_FORBIDDEN_RULES, *m_pForbiddenRulesCB );
+ lcl_SetBox(rSet, SID_ATTR_PARA_HANGPUNCTUATION, *m_pHangingPunctCB );
//character distance not yet available
- lcl_SetBox(rSet, SID_ATTR_PARA_SCRIPTSPACE, aScriptSpaceCB );
+ lcl_SetBox(rSet, SID_ATTR_PARA_SCRIPTSPACE, *m_pScriptSpaceCB );
}
-IMPL_LINK( SvxAsianTabPage, ClickHdl_Impl, TriStateBox*, pBox )
+IMPL_LINK( SvxAsianTabPage, ClickHdl_Impl, CheckBox*, pBox )
{
pBox->EnableTriState( sal_False );
return 0;
diff --git a/cui/source/tabpages/paragrph.hrc b/cui/source/tabpages/paragrph.hrc
index cf44622..8377d75 100644
--- a/cui/source/tabpages/paragrph.hrc
+++ b/cui/source/tabpages/paragrph.hrc
@@ -100,14 +100,6 @@
#define LB_TEXTDIRECTION 92
-//asian typography
-#define FL_AS_OPTIONS 1
-#define CB_AS_HANG_PUNC 2
-
-#define CB_AS_FORBIDDEN 4
-
-#define CB_AS_SCRIPT_SPACE 7
-
#define STR_EXAMPLE 5010
#define STR_PAGE_STYLE 5011
#endif
diff --git a/cui/source/tabpages/paragrph.src b/cui/source/tabpages/paragrph.src
index d27d636..5b3f14c 100644
--- a/cui/source/tabpages/paragrph.src
+++ b/cui/source/tabpages/paragrph.src
@@ -692,43 +692,6 @@
Left = TRUE ;
};
};
-
-// Asian typography
-TabPage RID_SVXPAGE_PARA_ASIAN
-{
- HelpId = HID_SVXPAGE_PARA_ASIAN ;
- Hide = TRUE ;
- Text [ en-US ] = "Asian Typography";
- Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ;
- FixedLine FL_AS_OPTIONS
- {
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 248 , 8 ) ;
- Text [ en-US ] = "Line change";
- };
- TriStateBox CB_AS_FORBIDDEN
- {
- HelpID = "cui:TriStateBox:RID_SVXPAGE_PARA_ASIAN:CB_AS_FORBIDDEN";
- Pos = MAP_APPFONT ( 12 , 14 ) ;
- Size = MAP_APPFONT ( 242 , 10 ) ;
- Text [ en-US ] = "Apply list of forbidden characters to the beginning and end of lines";
- };
- TriStateBox CB_AS_HANG_PUNC
- {
- HelpID = "cui:TriStateBox:RID_SVXPAGE_PARA_ASIAN:CB_AS_HANG_PUNC";
- Pos = MAP_APPFONT ( 12 , 28 ) ;
- Size = MAP_APPFONT ( 242 , 10 ) ;
- Text [ en-US ] = "Allow hanging punctuation";
- };
- TriStateBox CB_AS_SCRIPT_SPACE
- {
- HelpID = "cui:TriStateBox:RID_SVXPAGE_PARA_ASIAN:CB_AS_SCRIPT_SPACE";
- Pos = MAP_APPFONT ( 12 , 42 ) ;
- Size = MAP_APPFONT ( 242 , 10 ) ;
- Text [ en-US ] = "Apply spacing between Asian, Latin and Complex text";
- };
-};
-
String STR_EXAMPLE
{
Text [ en-US ] = "Example" ;
--
To view, visit https://gerrit.libreoffice.org/2115
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I70535593c3e06caca48ae8bc8b9476ae09210df8
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Olivier Hallot <olivier.hallot at alta.org.br>
More information about the LibreOffice
mailing list