[Libreoffice-commits] core.git: 2 commits - cui/source include/xmloff xmloff/source
Jim Raykowski
raykowj at gmail.com
Fri Jan 26 07:10:40 UTC 2018
cui/source/inc/paragrph.hxx | 4
cui/source/tabpages/paragrph.cxx | 184 +++++++++++++++++++++++----------------
include/xmloff/txtparae.hxx | 12 +-
xmloff/source/text/txtparae.cxx | 20 ++--
4 files changed, 129 insertions(+), 91 deletions(-)
New commits:
commit 122da2eea23faf6916c3f3b9e1895f5c404b26c7
Author: Jim Raykowski <raykowj at gmail.com>
Date: Sat Nov 18 22:21:24 2017 -0900
tdf#107567 et al. Paragraph dialog preview windows fixes
tdf#107567 tdf#98211 tdf#98212 tdf#113275
Change-Id: I6d11cb809283eee4fa79acae9aa32baaab558833
Reviewed-on: https://gerrit.libreoffice.org/45273
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index 2060cd224064..bc79add8c31c 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -46,6 +46,7 @@ class SvxLineSpacingItem;
class SvxStdParagraphTabPage: public SfxTabPage
{
friend class VclPtr<SvxStdParagraphTabPage>;
+ using TabPage::ActivatePage;
using TabPage::DeactivatePage;
static const sal_uInt16 pStdRanges[];
@@ -94,6 +95,7 @@ private:
DECL_LINK( AutoHdl_Impl, Button*, void );
protected:
+ virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
@@ -124,6 +126,7 @@ public:
class SvxParaAlignTabPage : public SfxTabPage
{
friend class VclPtr<SvxParaAlignTabPage>;
+ using TabPage::ActivatePage;
using TabPage::DeactivatePage;
static const sal_uInt16 pAlignRanges[];
@@ -159,6 +162,7 @@ class SvxParaAlignTabPage : public SfxTabPage
SvxParaAlignTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
protected:
+ virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
public:
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 5ea77cf288e1..61cdb6603321 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -617,6 +617,43 @@ void SvxStdParagraphTabPage::EnableRelativeMode()
bRelativeMode = true;
}
+void SvxStdParagraphTabPage::ActivatePage( const SfxItemSet& rSet )
+{
+ sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
+ SfxItemState eItemState = rSet.GetItemState( _nWhich );
+
+ if ( eItemState >= SfxItemState::DEFAULT )
+ {
+ const SvxAdjustItem& rAdj = static_cast<const SvxAdjustItem&>( rSet.Get( _nWhich ) );
+ SvxAdjust eAdjust = rAdj.GetAdjust();
+ if ( eAdjust == SvxAdjust::Center || eAdjust == SvxAdjust::Block )
+ {
+ _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
+ eItemState = rSet.GetItemState( _nWhich );
+
+ if ( eItemState >= SfxItemState::DEFAULT )
+ {
+ const SvxFrameDirectionItem& rFrameDirItem = static_cast<const SvxFrameDirectionItem&>( rSet.Get( _nWhich ) );
+ SvxFrameDirection eFrameDirection = rFrameDirItem.GetValue();
+
+ m_pExampleWin->EnableRTL( SvxFrameDirection::Horizontal_RL_TB == eFrameDirection );
+
+ if ( eAdjust == SvxAdjust::Block )
+ m_pExampleWin->SetLastLine( rAdj.GetLastBlock() );
+ }
+ }
+ else
+ {
+ m_pExampleWin->EnableRTL( eAdjust == SvxAdjust::Right );
+ eAdjust = SvxAdjust::Left; //required for correct preview display
+ m_pExampleWin->SetLastLine( eAdjust );
+ }
+ m_pExampleWin->SetAdjust( eAdjust );
+
+ UpdateExample_Impl();
+ }
+}
+
DeactivateRC SvxStdParagraphTabPage::DeactivatePage( SfxItemSet* _pSet )
{
ELRLoseFocusHdl( *m_pFLineIndent );
@@ -1002,6 +1039,8 @@ SvxParaAlignTabPage::SvxParaAlignTabPage( vcl::Window* pParent, const SfxItemSet
get(m_pPropertiesFL,"framePROPERTIES");
get(m_pTextDirectionLB,"comboLB_TEXTDIRECTION");
+ SetExchangeSupport();
+
SvtLanguageOptions aLangOptions;
sal_uInt16 nLastLinePos = LASTLINEPOS_DEFAULT;
@@ -1083,69 +1122,35 @@ bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet )
{
bool bModified = false;
- bool bAdj = false, bChecked = false;
SvxAdjust eAdjust = SvxAdjust::Left;
if ( m_pLeft->IsChecked() )
- {
eAdjust = SvxAdjust::Left;
- bAdj = !m_pLeft->GetSavedValue();
- bChecked = true;
- }
else if ( m_pRight->IsChecked() )
- {
eAdjust = SvxAdjust::Right;
- bAdj = !m_pRight->GetSavedValue();
- bChecked = true;
- }
else if ( m_pCenter->IsChecked() )
- {
eAdjust = SvxAdjust::Center;
- bAdj = !m_pCenter->GetSavedValue();
- bChecked = true;
- }
else if ( m_pJustify->IsChecked() )
- {
eAdjust = SvxAdjust::Block;
- bAdj = !m_pJustify->GetSavedValue() ||
- m_pExpandCB->IsValueChangedFromSaved() ||
- m_pLastLineLB->IsValueChangedFromSaved();
- bChecked = true;
- }
- sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
-
- if ( bAdj )
- {
- const SvxAdjustItem* pOld = static_cast<const SvxAdjustItem*>(GetOldItem( *rOutSet, SID_ATTR_PARA_ADJUST ));
- SvxAdjust eOneWord = m_pExpandCB->IsChecked() ? SvxAdjust::Block : SvxAdjust::Left;
+ sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
- sal_Int32 nLBPos = m_pLastLineLB->GetSelectedEntryPos();
- SvxAdjust eLastBlock = SvxAdjust::Left;
+ SvxAdjust eOneWord = m_pExpandCB->IsChecked() ? SvxAdjust::Block : SvxAdjust::Left;
- if ( 1 == nLBPos )
- eLastBlock = SvxAdjust::Center;
- else if ( 2 == nLBPos )
- eLastBlock = SvxAdjust::Block;
+ sal_Int32 nLBPos = m_pLastLineLB->GetSelectedEntryPos();
+ SvxAdjust eLastBlock = SvxAdjust::Left;
+ if ( 1 == nLBPos )
+ eLastBlock = SvxAdjust::Center;
+ else if ( 2 == nLBPos )
+ eLastBlock = SvxAdjust::Block;
- bool bNothingWasChecked =
- !m_pLeft->GetSavedValue() && !m_pRight->GetSavedValue() &&
- !m_pCenter->GetSavedValue() && !m_pJustify->GetSavedValue();
+ SvxAdjustItem aAdj( static_cast<const SvxAdjustItem&>(GetItemSet().Get( _nWhich )) );
+ aAdj.SetAdjust( eAdjust );
+ aAdj.SetOneWord( eOneWord );
+ aAdj.SetLastBlock( eLastBlock );
+ rOutSet->Put( aAdj );
+ bModified = true;
- if ( !pOld || pOld->GetAdjust() != eAdjust ||
- pOld->GetOneWord() != eOneWord ||
- pOld->GetLastBlock() != eLastBlock ||
- ( bChecked && bNothingWasChecked ) )
- {
- bModified = true;
- SvxAdjustItem aAdj(
- static_cast<const SvxAdjustItem&>(GetItemSet().Get( _nWhich )) );
- aAdj.SetAdjust( eAdjust );
- aAdj.SetOneWord( eOneWord );
- aAdj.SetLastBlock( eLastBlock );
- rOutSet->Put( aAdj );
- }
- }
if(m_pSnapToGridCB->IsValueChangedFromSaved())
{
rOutSet->Put(SvxParaGridItem(m_pSnapToGridCB->IsChecked(), GetWhich( SID_ATTR_PARA_SNAPTOGRID )));
@@ -1159,9 +1164,9 @@ bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet )
if( m_pTextDirectionLB->IsVisible() )
{
- SvxFrameDirection eDir = m_pTextDirectionLB->GetSelectEntryValue();
if( m_pTextDirectionLB->IsValueChangedFromSaved() )
{
+ SvxFrameDirection eDir = m_pTextDirectionLB->GetSelectEntryValue();
rOutSet->Put( SvxFrameDirectionItem( eDir, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) );
bModified = true;
}
@@ -1169,6 +1174,12 @@ bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet )
return bModified;
}
+
+void SvxParaAlignTabPage::ActivatePage( const SfxItemSet& rSet )
+{
+ Reset( &rSet );
+}
+
void SvxParaAlignTabPage::Reset( const SfxItemSet* rSet )
{
sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
@@ -1285,6 +1296,12 @@ IMPL_LINK_NOARG(SvxParaAlignTabPage, AlignHdl_Impl, Button*, void)
m_pLastLineLB->Enable(bJustify);
bool bLastLineIsBlock = m_pLastLineLB->GetSelectedEntryPos() == 2;
m_pExpandCB->Enable(bJustify && bLastLineIsBlock);
+ //set last line listbox to entry position 0 if not enabled
+ if(!m_pLastLineLB->IsEnabled())
+ m_pLastLineLB->SelectEntryPos(0);
+ //uncheck 'Expand ... word' when check box is not enabled
+ if(!m_pExpandCB->IsEnabled())
+ m_pExpandCB->Check(false);
UpdateExample_Impl();
}
@@ -1293,46 +1310,63 @@ IMPL_LINK_NOARG(SvxParaAlignTabPage, LastLineHdl_Impl, ListBox&, void)
//fdo#41350 only enable 'Expand last word' if last line is also justified
bool bLastLineIsBlock = m_pLastLineLB->GetSelectedEntryPos() == 2;
m_pExpandCB->Enable(bLastLineIsBlock);
+ //uncheck 'Expand ... word' when check box is not enabled
+ if(!m_pExpandCB->IsEnabled())
+ m_pExpandCB->Check(false);
UpdateExample_Impl();
}
IMPL_LINK_NOARG(SvxParaAlignTabPage, TextDirectionHdl_Impl, ListBox&, void)
{
- SvxFrameDirection eDir = m_pTextDirectionLB->GetSelectEntryValue();
- switch ( eDir )
- {
- // check the default alignment for this text direction
- case SvxFrameDirection::Horizontal_LR_TB : m_pLeft->Check(); break;
- case SvxFrameDirection::Horizontal_RL_TB : m_pRight->Check(); break;
- case SvxFrameDirection::Environment : /* do nothing */ break;
- default:
- {
- SAL_WARN( "cui.tabpages", "SvxParaAlignTabPage::TextDirectionHdl_Impl(): other directions not supported" );
- }
- }
UpdateExample_Impl();
}
void SvxParaAlignTabPage::UpdateExample_Impl()
{
if ( m_pLeft->IsChecked() )
+ {
+ m_pExampleWin->EnableRTL( false );
m_pExampleWin->SetAdjust( SvxAdjust::Left );
+ m_pExampleWin->SetLastLine( SvxAdjust::Left );
+ }
else if ( m_pRight->IsChecked() )
- m_pExampleWin->SetAdjust( SvxAdjust::Right );
- else if ( m_pCenter->IsChecked() )
- m_pExampleWin->SetAdjust( SvxAdjust::Center );
- else if ( m_pJustify->IsChecked() )
{
- m_pExampleWin->SetAdjust( SvxAdjust::Block );
- SvxAdjust eLastBlock = SvxAdjust::Left;
- sal_Int32 nLBPos = m_pLastLineLB->GetSelectedEntryPos();
- if(nLBPos == 0 && m_pTextDirectionLB->GetSelectEntryValue() == SvxFrameDirection::Horizontal_RL_TB)
- eLastBlock = SvxAdjust::Right;
- else if(nLBPos == 1)
- eLastBlock = SvxAdjust::Center;
- else if(nLBPos == 2)
- eLastBlock = SvxAdjust::Block;
- m_pExampleWin->SetLastLine( eLastBlock );
+ m_pExampleWin->EnableRTL( true );
+ m_pExampleWin->SetAdjust( SvxAdjust::Left );
+ m_pExampleWin->SetLastLine( SvxAdjust::Left );
+ }
+ else
+ {
+ SvxFrameDirection eDir = m_pTextDirectionLB->GetSelectEntryValue();
+ switch ( eDir )
+ {
+ case SvxFrameDirection::Environment :
+ if ( !m_pRight->IsChecked() )
+ m_pExampleWin->EnableRTL( IsRTLEnabled() /*false*/ );
+ break;
+ case SvxFrameDirection::Horizontal_RL_TB :
+ if ( !m_pLeft->IsChecked() )
+ m_pExampleWin->EnableRTL( true );
+ break;
+ case SvxFrameDirection::Horizontal_LR_TB :
+ if ( !m_pRight->IsChecked() )
+ m_pExampleWin->EnableRTL( false );
+ break;
+ default: ; //prevent warning
+ }
+ if ( m_pCenter->IsChecked() )
+ m_pExampleWin->SetAdjust( SvxAdjust::Center );
+ else if ( m_pJustify->IsChecked() )
+ {
+ m_pExampleWin->SetAdjust( SvxAdjust::Block );
+ sal_Int32 nLBPos = m_pLastLineLB->GetSelectedEntryPos();
+ if(nLBPos == 0)
+ m_pExampleWin->SetLastLine(SvxAdjust::Left);
+ else if(nLBPos == 1)
+ m_pExampleWin->SetLastLine(SvxAdjust::Center);
+ else if(nLBPos == 2)
+ m_pExampleWin->SetLastLine(SvxAdjust::Block);
+ }
}
m_pExampleWin->Invalidate();
commit 674b67ab7d92097089000fcd70c7abd84e180220
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Jan 17 17:23:46 2018 +0200
loplugin:useuniqueptr in XMLTextParagraphExport
Change-Id: I20a45d5d3914c75b01b55339169d495b294fe7fd
Reviewed-on: https://gerrit.libreoffice.org/48514
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx
index d59137ca977e..b9b8db588d93 100644
--- a/include/xmloff/txtparae.hxx
+++ b/include/xmloff/txtparae.hxx
@@ -90,14 +90,14 @@ class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public XMLStyleExport
rtl::Reference < SvXMLExportPropertyMapper > xRubyPropMapper;
const ::std::unique_ptr< ::xmloff::BoundFrameSets > pBoundFrameSets;
- XMLTextFieldExport *pFieldExport;
- std::vector<OUString> *pListElements;
- XMLTextListAutoStylePool maListAutoPool;
- XMLSectionExport *pSectionExport;
- XMLIndexMarkExport *pIndexMarkExport;
+ std::unique_ptr<XMLTextFieldExport> pFieldExport;
+ std::unique_ptr<std::vector<OUString>> pListElements;
+ XMLTextListAutoStylePool maListAutoPool;
+ std::unique_ptr<XMLSectionExport> pSectionExport;
+ std::unique_ptr<XMLIndexMarkExport> pIndexMarkExport;
/// may be NULL (if no redlines should be exported; e.g. in block mode)
- XMLRedlineExport *pRedlineExport;
+ std::unique_ptr<XMLRedlineExport> pRedlineExport;
bool bProgress;
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 4a94221a9460..656c33a6cbb2 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -992,7 +992,7 @@ void XMLTextParagraphExport::exportListChange(
GetExport().StartElement(aElem, false);
if(!pListElements)
- pListElements = new std::vector<OUString>;
+ pListElements.reset( new std::vector<OUString> );
pListElements->push_back(aElem);
mpTextListsHelper->PushListOnStack( sListId,
@@ -1298,12 +1298,12 @@ XMLTextParagraphExport::XMLTextParagraphExport(
xFramePropMapper = new XMLTextExportPropertySetMapper( xPropMapper,
GetExport() );
- pSectionExport = new XMLSectionExport( rExp, *this );
- pIndexMarkExport = new XMLIndexMarkExport( rExp );
+ pSectionExport.reset( new XMLSectionExport( rExp, *this ) );
+ pIndexMarkExport.reset( new XMLIndexMarkExport( rExp ) );
if( ! IsBlockMode() &&
Reference<XRedlinesSupplier>( GetExport().GetModel(), UNO_QUERY ).is())
- pRedlineExport = new XMLRedlineExport( rExp );
+ pRedlineExport.reset( new XMLRedlineExport( rExp ) );
// The text field helper needs a pre-constructed XMLPropertyState
// to export the combined characters field. We construct that
@@ -1313,17 +1313,17 @@ XMLTextParagraphExport::XMLTextParagraphExport(
sal_Int32 nIndex = xTextPropMapper->getPropertySetMapper()->FindEntryIndex(
"", XML_NAMESPACE_STYLE,
GetXMLToken(XML_TEXT_COMBINE));
- pFieldExport = new XMLTextFieldExport( rExp, new XMLPropertyState( nIndex, uno::makeAny(true) ) );
+ pFieldExport.reset( new XMLTextFieldExport( rExp, new XMLPropertyState( nIndex, uno::makeAny(true) ) ) );
PushNewTextListsHelper();
}
XMLTextParagraphExport::~XMLTextParagraphExport()
{
- delete pRedlineExport;
- delete pIndexMarkExport;
- delete pSectionExport;
- delete pFieldExport;
- delete pListElements;
+ pRedlineExport.reset();
+ pIndexMarkExport.reset();
+ pSectionExport.reset();
+ pFieldExport.reset();
+ pListElements.reset();
#ifdef DBG_UTIL
txtparae_bContainsIllegalCharacters = false;
#endif
More information about the Libreoffice-commits
mailing list